mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 13:55:58 +00:00
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:
1 parent
c1cf0f3a9c
commit
c336f994e1
4 files changed
+61
-12
No files matched your search
@@ -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()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user