-
Notifications
You must be signed in to change notification settings - Fork 303
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
Refactor Sync API #1578
Refactor Sync API #1578
Conversation
@maimoonak FYI - the current sync APIs need some simplification. please see this pr. i think the main issue is that the sync job shouldn't be exposed to the client and information should be exposed as flow. we can discuss in more detail if you like. @joiskash and @PallaviGanorkar fyi too discussed this with @aditya-07 |
demo/src/main/java/com/google/android/fhir/demo/MainActivity.kt
Outdated
Show resolved
Hide resolved
demo/src/main/java/com/google/android/fhir/demo/PatientListFragment.kt
Outdated
Show resolved
Hide resolved
demo/src/main/java/com/google/android/fhir/demo/PatientListFragment.kt
Outdated
Show resolved
Hide resolved
engine/src/main/java/com/google/android/fhir/sync/SyncJobStatus.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!
* Remove the `SyncJob` interface * Remove the `SyncJob` interface * Run spotless * Use worker's class name as the unique identifier for the job * Refactor result API * Run spotless apply * Add API to retrieve last updated timestamp * Uncomment accidentally commented code * Add documentation to sync job status * Use KEEP policy for periodic sync * Wrap one time sync in a function * Fix application context * Run spotless Co-authored-by: aditya-07 <[email protected]>
* Remove the `SyncJob` interface * Remove the `SyncJob` interface * Run spotless * Use worker's class name as the unique identifier for the job * Refactor result API * Run spotless apply * Add API to retrieve last updated timestamp * Uncomment accidentally commented code * Add documentation to sync job status * Use KEEP policy for periodic sync * Wrap one time sync in a function * Fix application context * Run spotless Co-authored-by: aditya-07 <[email protected]>
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Description
FhirPeriodicSyncWorker
toFhirSyncWorker
since it is now used by both periodic sync and one time syncSyncJob
API and its implementationSyncJobImp
since it is not the right level of abstraction we should be providing to the application.StateFlow
to return the worker status for both one time and periodic work.State
toSyncJobStatus
Future work:
Alternative(s) considered
@aditya-07 and I have discussed the current approach and concluded the current API isn't easy to use by the client
Type
Code health
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.