Closed Zhuinden closed 4 years ago
On SavedStateHandle: good point, will update that.
On filtering in the data layer: obvious thing to do in a real app, but in blueprints we use filtering as business logic to showcase how to do operations off the main thread. Same in the usecases branch. Not ideal, but adding more complexity would make the sample harder to follow.
Many thanks!
Now with the ViewModel-SavedState module reaching 1.0.0, the filtering can be persisted using SavedStateHandle.
Added in #700 without LiveData and converting enum to ints since apparently there's no support for enums.
No support for enums? that's odd, enums should (or I would expect them to) fall back to putSerializable
. 🤔
If this is intended, then that is quite an unfortunate limitation. One could use the enum name or ordinals I guess but that is still inconvenient.
They are, my bad. I was simulating process death incorrectly.
Value of
_currentFiltering
is never persisted to Bundle. If one were to useSavedStateHandle
to solve, this, the solution would look like this:The Repository (or
getTaskUseCase
, whichever is used) should select the right DAO method to call for getting filtered results from Room DAOAnd the DAO should expose LiveData with the correct filters