-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
api support for sync job cancellation. #2717
Conversation
Screen.Recording.2024-11-11.at.12.24.05.PM.movScreen.Recording.2024-11-11.at.2.23.30.PM.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One way to do this is to accept ExistingWorkPolicy
in sync apis. Instead of ExistingWorkPolicy.KEEP
if application provides ExistingWorkPolicy.REPLACE
, workmanager library will cancel the current one and add new one with the same name.
Why not the above approach ?
engine/src/main/java/com/google/android/fhir/sync/FhirDataStore.kt
Outdated
Show resolved
Hide resolved
engine/src/main/java/com/google/android/fhir/sync/FhirDataStore.kt
Outdated
Show resolved
Hide resolved
engine/src/main/java/com/google/android/fhir/sync/FhirDataStore.kt
Outdated
Show resolved
Hide resolved
demo/src/main/java/com/google/android/fhir/demo/SyncFragment.kt
Outdated
Show resolved
Hide resolved
engine/src/main/java/com/google/android/fhir/sync/FhirDataStore.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks Santosh.
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #2695
Description
Once a one-time or periodic sync job is canceled, it should emit the current sync job status. The cancel state, represented by the WorkInfo state, needs to be transformed into the current sync job status. This is done by listening to the WorkInfo state and mapping it to the current sync job status, using the WorkManager state for intermediate states and the FhirDataStore state for terminal states.
Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?
Type
Choose one: Feature
Screenshots (if applicable)
Checklist
./gradlew spotlessApply
and./gradlew spotlessCheck
to check my code follows the style guide of this project../gradlew check
and./gradlew connectedCheck
to test my changes locally.