-
Notifications
You must be signed in to change notification settings - Fork 249
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
Provide a StateFlow
for sync status
#554
Comments
@jingtang10 Can I take this issue? |
Really sorry but Maimoona was already working on this. Thanks for your enthusiasm please keep an eye on the repo and we can assign you something else. |
No problem |
@maimoonak , is there an ETA by when this issue can be closed? It is blocking #605 which is a high priority for Q3 v0 release. |
@maimoonak , any update on the ETA by when this issue can get closed? |
There are multiple options to run polling with flows.
interface SyncJob -> to allow multiple or different polling strategies 19b2e26 very basic polling with test |
@Tarun-Bhardwaj I tried my best to finish this by this week. However, it looks like in initial discussions we had missed the power that WorkManager gives. I have pushed the code with tests on branch 554_flowapi for onetime sync with flow API, and now trying to see if we can use WorkManger with flow. The WorkManger creates the instances itself and provides a very limited access to running service data later, but we can not avoid it because we want service run even if app is closed, which is provided by WorkManager only. |
@jingtang10 So based on few things missing into our last discussion I have added a complete workflow which implements one-time-sync and polling as well. Both use flow however, since workmanager does not work on flows, I have a doubt on the approach. I also have made the code a little verbose by adding questions and extra comments which would be deleted before making a formal PR. However, I have much more clarity and answers to queries raised in previous discussion. |
Is your feature request related to a problem? Please describe.
We should provide developers access to the status of the sync jobs in order to update the UI.
Describe the solution you'd like
We could use a
StateFlow
to wrap the state of the work managerhttps://developer.android.com/kotlin/flow/stateflow-and-sharedflow
Describe alternatives you've considered
Use
LiveData
: https://developer.android.com/codelabs/android-workmanager#7@yigit made the recommendation that
StateFlow
is the new API and we should use it. This article talks about hwo to replaceLiveData
withStateFlow
: https://betterprogramming.pub/android-data-binding-with-mvvm-using-stateflow-and-viewmodel-bce04d0b9bc4Additional context
NA
Would you like to work on the issue?
NA
The text was updated successfully, but these errors were encountered: