0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 03:52:15 +02:00

fix(card-browser-view-model): column indices

* do not update config on init
This commit is contained in:
David Allison 2024-05-27 16:05:50 +01:00 committed by Mike Hardy
parent f688c1ce74
commit dbd9cbcd6e

View File

@ -82,6 +82,7 @@ import kotlin.math.max
import kotlin.math.min
@NeedsTest("reverseDirectionFlow/sortTypeFlow are not updated on .launch { }")
@NeedsTest("columIndex1/2 config is not not updated on init")
@NeedsTest("13442: selected deck is not changed, as this affects the reviewer")
@NeedsTest("search is called after launch()")
class CardBrowserViewModel(
@ -274,11 +275,19 @@ class CardBrowserViewModel(
}
flowOfColumnIndex1
.onEach { index -> sharedPrefs().edit { putInt(DISPLAY_COLUMN_1_KEY, index) } }
.ignoreValuesFromViewModelLaunch()
.onEach { index ->
Timber.d("updating %s", DISPLAY_COLUMN_1_KEY)
sharedPrefs().edit { putInt(DISPLAY_COLUMN_1_KEY, index) }
}
.launchIn(viewModelScope)
flowOfColumnIndex2
.onEach { index -> sharedPrefs().edit { putInt(DISPLAY_COLUMN_2_KEY, index) } }
.ignoreValuesFromViewModelLaunch()
.onEach { index ->
Timber.d("updating %s", DISPLAY_COLUMN_2_KEY)
sharedPrefs().edit { putInt(DISPLAY_COLUMN_2_KEY, index) }
}
.launchIn(viewModelScope)
performSearchFlow.onEach {