Library store pills follow the new default store order (#2811)

* fix(library): move an unarranged store order to the new default at startup

* fix(stores): forget an unarranged store order instead of saving the default
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-18 00:47:44 -05:00
1 parent c1cf0f3a9c
commit c336f994e1
4 files changed
+61 -12

No files matched your search

@@ -53,6 +53,7 @@ class App : Application() {
com.droiddeck.launcher.session.QuestExperimental.initialize(this)
com.droiddeck.launcher.session.SessionPrefs.applyNtsyncDefault(this)
com.droiddeck.launcher.session.SessionPrefs.settleGpuDriverMode(this)
com.droiddeck.launcher.session.SessionPrefs.settleStoresTabOrder(this, com.droiddeck.launcher.stores.Store.entries.map { it.id })
com.droiddeck.launcher.update.AppUpdates.init(this)
com.droiddeck.launcher.update.UpdateWatch.sync(this, com.droiddeck.launcher.update.AppUpdates.follow(this, null))
com.droiddeck.launcher.core.DownloadSource.init(this)
@@ -315,6 +315,20 @@ object SessionPrefs {
fun storesTabOrder(context: Context): List<String> = idList(prefs(context).getString("storesTabOrder", null))
private val LEGACY_STORES_TAB_ORDER = listOf("gog", "epic", "amazon", "xbox", "itch", "gamejolt", "battlenet", "ubisoft", "ea", "rockstar")
/**
* Forgets an order the user never arranged, so the Stores tabs and Library pills follow whatever the default is now.
* Earlier versions saved the default of their day, which is why a saved order alone does not mean the user chose it.
*/
fun settleStoresTabOrder(context: Context, defaults: List<String>) {
if (storesTabOrderCustomized(context)) return
val saved = storesTabOrder(context)
if (saved.isEmpty()) return
if (saved == LEGACY_STORES_TAB_ORDER || saved == defaults) prefs(context).edit().remove("storesTabOrder").apply()
else setStoresTabOrderCustomized(context, true)
}
fun setStoresTabOrder(context: Context, order: List<String>) {
prefs(context).edit().putString("storesTabOrder", order.joinToString(",")).apply()
}
@@ -155,18 +155,7 @@ internal fun StoresPage(s: FrontEndState, a: FrontEndActions, modifier: Modifier
val padH = if (narrow) 14.dp else 22.dp
val tabs = remember {
androidx.compose.runtime.mutableStateListOf<StoreTab>().apply {
val savedOrder = SessionPrefs.storesTabOrder(ctx)
if (!SessionPrefs.storesTabOrderCustomized(ctx)) {
val legacyOrder = listOf(
"gog", "epic", "amazon", "xbox", "itch",
"gamejolt", "battlenet", "ubisoft", "ea", "rockstar"
)
if (savedOrder.isNotEmpty() && savedOrder != legacyOrder) {
SessionPrefs.setStoresTabOrderCustomized(ctx, true)
} else {
SessionPrefs.setStoresTabOrder(ctx, Store.entries.map { it.id })
}
}
SessionPrefs.settleStoresTabOrder(ctx, Store.entries.map { it.id })
addAll(arrangeStoreTabs(SessionPrefs.storesTabOrder(ctx), SessionPrefs.storesTabHidden(ctx)))
}
}