fix(client/android): clear all favorites when other settings are reset#6707
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| @ApplicationContext context: Context, | ||
| ): Bundle = (context.getSystemService(Context.RESTRICTIONS_SERVICE) as android.content.RestrictionsManager).applicationRestrictions | ||
|
|
||
| @Singleton |
There was a problem hiding this comment.
Without this line, Hilt was creating 2 Repository instances, one for each ViewModel. I have no clue how Hilt works internally so I'm not sure why it did that.
thomaseizinger
left a comment
There was a problem hiding this comment.
Nice! Thanks for knocking this one out.
|
|
||
| fun addFavoriteResource(id: String) { | ||
| favorites.value.inner.add(id) | ||
| saveFavoritesSync() |
There was a problem hiding this comment.
Instead of repeating this, can we now subscribe to changes to the MutableStateFlow and save them on every change?
There was a problem hiding this comment.
Alternatively, we could make it directly a DataStore perhaps? Not sure how difficult that would be.
There was a problem hiding this comment.
It might be hard to get rid of because we're also manually triggering the flow to emit in saveFavoritesSync. Maybe in a future PR
This required some refactoring since we want to move away from
LiveDataand towardsStateFlowCloses #6293