Skip to content

Fixed deprecations#592

Merged
sunkup merged 1 commit into
devfrom
fix-deprecations
Jun 11, 2025
Merged

Fixed deprecations#592
sunkup merged 1 commit into
devfrom
fix-deprecations

Conversation

@ArnyminerZ
Copy link
Copy Markdown
Member

Purpose

Fixed two small deprecations.

Short description

  • Using the CancellableContinuation.resume overload that takes more arguments in onCancellation.
  • Using IntentCompat.getSerializableExtra instead of the deprecated Intent.getSerializableExtra.

Checklist

  • The PR has a proper title, description and label.
  • I have self-reviewed the PR.
  • I have added documentation to complex functions and functions that can be used by other modules.
  • I have added reasonable tests or consciously decided to not add tests.

Signed-off-by: Arnau Mora <arnyminerz@proton.me>
@ArnyminerZ ArnyminerZ self-assigned this Jun 11, 2025
@ArnyminerZ ArnyminerZ added the refactoring Quality improvement of existing functions label Jun 11, 2025
@ArnyminerZ ArnyminerZ requested review from Copilot and sunkup June 11, 2025 06:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses two deprecations by updating call sites to use non-deprecated overloads.

  • Switches to the new CancellableContinuation.resume overload with a three-parameter cancellation lambda.
  • Replaces deprecated Intent.getSerializableExtra with IntentCompat.getSerializableExtra.
  • Adds necessary imports for IntentCompat and companion constants.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
app/src/main/java/at/bitfire/icsdroid/ui/views/CalendarListActivity.kt Replaced getSerializableExtra call with IntentCompat.getSerializableExtra, imported IntentCompat and companion constants.
app/src/main/java/at/bitfire/icsdroid/AsyncUtils.kt Updated resume call to the new overload signature using a three-argument cancellation lambda.
Comments suppressed due to low confidence (2)

app/src/main/java/at/bitfire/icsdroid/ui/views/CalendarListActivity.kt:24

  • [nitpick] The explicit import of companion object members can be removed, since Kotlin allows direct access to EXTRA_ERROR_MESSAGE and EXTRA_THROWABLE without importing them.
import at.bitfire.icsdroid.ui.views.CalendarListActivity.Companion.EXTRA_ERROR_MESSAGE

app/src/main/java/at/bitfire/icsdroid/AsyncUtils.kt:29

  • [nitpick] Consider using continuation.invokeOnCancellation { call.cancel() } before enqueueing. This separates cancellation handling from the resume logic and avoids the less-readable multi-parameter lambda on resume.
continuation.resume(value = response, onCancellation = { _, _, _ -> call.cancel() })

@sunkup sunkup merged commit f492d0d into dev Jun 11, 2025
7 checks passed
@sunkup sunkup deleted the fix-deprecations branch June 11, 2025 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Quality improvement of existing functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants