mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-24 07:16:04 +00:00
feat(stores): Steam first in the Stores tabs
This commit is contained in:
1 parent
15b9700f03
commit
9bba2f6a3c
2 files changed
+4
-3
No files matched your search
@@ -1,14 +1,14 @@
|
||||
package com.droiddeck.launcher.stores
|
||||
|
||||
enum class Store(val id: String, val label: String, val shortLabel: String) {
|
||||
STEAM("steamstore", "Steam", "Steam"),
|
||||
GOG("gog", "GOG", "GOG"),
|
||||
EPIC("epic", "Epic Games", "Epic"),
|
||||
AMAZON("amazon", "Amazon Games", "Amazon"),
|
||||
XBOX("xbox", "Xbox", "Xbox"),
|
||||
ITCH("itch", "Itch.io", "Itch.io"),
|
||||
GAMEJOLT("gamejolt", "Game Jolt", "Game Jolt"),
|
||||
BATTLENET("battlenet", "Battle.net", "Battle.net"),
|
||||
STEAM("steamstore", "Steam", "Steam");
|
||||
BATTLENET("battlenet", "Battle.net", "Battle.net");
|
||||
|
||||
val folder: String get() = if (this == ITCH) "itch" else shortLabel
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ data class StoreTab(val store: Store, val shown: Boolean)
|
||||
|
||||
fun arrangeStoreTabs(order: List<String>, hidden: Set<String>): List<StoreTab> {
|
||||
val known = Store.entries.associateBy { it.id }
|
||||
val listed = order.mapNotNull { known[it] }.distinct()
|
||||
val saved = order.mapNotNull { known[it] }.distinct()
|
||||
val listed = if (saved.isNotEmpty() && Store.STEAM !in saved) listOf(Store.STEAM) + saved else saved
|
||||
return (listed + Store.entries.filterNot { it in listed }).map { StoreTab(it, it.id !in hidden) }
|
||||
}
|
||||
Reference in new issue
Block a user