mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
remember the library tab across restarts
The selected tab lived in rememberSaveable, which survives a rotation or a process-death restore but not a cold start, so the app always came back on Albums. It goes through DataStore now, like the per-tab sort and filters, which were already durable - landing on a different tab than the one you had filtered is what made the filters look reset.
This commit is contained in:
@@ -45,6 +45,22 @@ class UserPreferencesTest {
|
||||
file.delete()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theSelectedLibraryTabRoundTrips() =
|
||||
runTest {
|
||||
val file = File.createTempFile("user-prefs", ".preferences_pb").apply { delete() }
|
||||
val store = PreferenceDataStoreFactory.create(scope = backgroundScope) { file }
|
||||
val prefs = UserPreferences(store)
|
||||
|
||||
assertEquals("Albums", prefs.libraryTab().first())
|
||||
|
||||
prefs.setLibraryTab("Playlists")
|
||||
|
||||
assertEquals("Playlists", prefs.libraryTab().first())
|
||||
|
||||
file.delete()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aListQueryStoredBeforeTheDownloadedFilterStillDecodes() =
|
||||
runTest {
|
||||
|
||||
Reference in New Issue
Block a user