Skip to content

Commit

Permalink
fix(card-browser-view-model): column indices
Browse files Browse the repository at this point in the history
* do not update config on init
  • Loading branch information
david-allison authored and mikehardy committed Jun 1, 2024
1 parent f688c1c commit dbd9cbc
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit dbd9cbc

Please sign in to comment.