Open rob729 opened 4 years ago
@rob729 i want to claim this issue
Go Ahead @coder2699
@rob729 There are many problems that are coming in implementing the task. One of the major problem is coming while using viewModel to store ACTIVE_PROFILE_NAME, etc. inside StartAlarm and EndAlarm.
Since we are saving a lot of data from StartAlarm and EndAlarm (like BEGIN_STATUS, ACTIVE_PROFILE_ID, END_TIME......etc), many issues are arising.
The following link describes the problem very similar to what I m facing: https://stackoverflow.com/questions/50892220/how-to-get-a-viewmodel-from-a-worker-class
And the solutions mentioned either don't work or require too many changes in the application's code.
Why are you using view model to store ACTIVE_PROFILE_NAME, etc. inside StartAlarm and EndAlarm?
@rob729 Because we need "viewModelScope" to read/write values...this is what I understood after going through the articles. Please correct me if I have misunderstood something.
https://developer.android.com/codelabs/android-preferences-datastore#7 https://blog.mindorks.com/jetpack-datastore-preferences
What is actually viewModelScope? This is the question that you should be searching for. The ViewModel is not a requirement for Preferences DataStore. The basic concept behind the Preferences DataStore is that data is read/write on a background thread. In the above example, the same is achieved using coroutine. There are more ways to use coroutines. You should explore more about Preferences DataStore & coroutines to get a proper idea.
@rob729 I am unable to implement Preference Data Store, so it will be better if you unassign me.
Okay
Describe the feature you'd like Currently, the app uses shared preferences for storing data used in general computation purposes. Replace it with Preferences DataStore as it is one of the recommended ways now. It has to implement it in an optimal way like how the shared preferences has been implemented in the app.
Would you like to work on the issue?