mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
Save the store order only once the user arranges it (#2812)
* fix(stores): save the store order only once the user arranges it * test(stores): exercise the tab save the hide toggle uses
This commit is contained in:
1 parent
bf0260de61
commit
ecd74fce79
3 files changed
+19
-3
No files matched your search
@@ -315,6 +315,13 @@ object SessionPrefs {
|
||||
|
||||
fun storesTabOrder(context: Context): List<String> = idList(prefs(context).getString("storesTabOrder", null))
|
||||
|
||||
/** An order nobody arranged stays unsaved, so it keeps following the default. */
|
||||
fun saveStoresTabs(context: Context, order: List<String>, hidden: Set<String>, arranged: Boolean) {
|
||||
if (arranged) setStoresTabOrderCustomized(context, true)
|
||||
if (storesTabOrderCustomized(context)) setStoresTabOrder(context, order)
|
||||
setStoresTabHidden(context, hidden)
|
||||
}
|
||||
|
||||
private val LEGACY_STORES_TAB_ORDER = listOf("gog", "epic", "amazon", "xbox", "itch", "gamejolt", "battlenet", "ubisoft", "ea", "rockstar")
|
||||
|
||||
/**
|
||||
|
||||
@@ -163,9 +163,7 @@ internal fun StoresPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier
|
||||
var arranging by remember { mutableStateOf(false) }
|
||||
val shownStores = tabs.filter { it.shown }.map { it.store }
|
||||
fun commitTabs(markCustomized: Boolean = false) {
|
||||
SessionPrefs.setStoresTabOrder(ctx, tabs.map { it.store.id })
|
||||
SessionPrefs.setStoresTabHidden(ctx, tabs.filterNot { it.shown }.map { it.store.id }.toSet())
|
||||
if (markCustomized) SessionPrefs.setStoresTabOrderCustomized(ctx, true)
|
||||
SessionPrefs.saveStoresTabs(ctx, tabs.map { it.store.id }, tabs.filterNot { it.shown }.map { it.store.id }.toSet(), markCustomized)
|
||||
}
|
||||
fun shiftTab(store: Store, delta: Int) {
|
||||
val from = tabs.indexOfFirst { it.store == store }
|
||||
|
||||
Reference in new issue
Block a user