@@ -13,6 +13,7 @@ import androidx.datastore.preferences.core.stringPreferencesKey
13
13
import androidx.datastore.preferences.preferencesDataStore
14
14
import com.OxGames.Pluvia.enums.AppTheme
15
15
import com.OxGames.Pluvia.service.SteamService
16
+ import com.OxGames.Pluvia.ui.enums.HomeDestination
16
17
import com.OxGames.Pluvia.ui.enums.Orientation
17
18
import com.materialkolor.PaletteStyle
18
19
import com.winlator.box86_64.Box86_64Preset
@@ -26,10 +27,12 @@ import kotlinx.coroutines.Dispatchers
26
27
import kotlinx.coroutines.flow.first
27
28
import kotlinx.coroutines.launch
28
29
import kotlinx.coroutines.runBlocking
30
+ import kotlinx.serialization.json.Json
29
31
import timber.log.Timber
30
32
31
33
/* *
32
- * Kind of ugly, but works to be a universal preference manager.
34
+ * A universal Preference Manager that can be used anywhere within Pluvia.
35
+ * Note: King of ugly though.
33
36
*/
34
37
object PrefManager {
35
38
@@ -371,4 +374,32 @@ object PrefManager {
371
374
set(value) {
372
375
setPref(APP_THEME_PALETTE , value.ordinal)
373
376
}
377
+
378
+ private val START_SCREEN = intPreferencesKey(" start screen" )
379
+ var startScreen: HomeDestination
380
+ get() {
381
+ val value = getPref(START_SCREEN , HomeDestination .Library .ordinal)
382
+ return HomeDestination .entries.getOrNull(value) ? : HomeDestination .Library
383
+ }
384
+ set(value) {
385
+ setPref(START_SCREEN , value.ordinal)
386
+ }
387
+
388
+ private val FRIENDS_LIST_HEADER = stringPreferencesKey(" friends_list_header" )
389
+ var friendsListHeader: Set <String >
390
+ get() {
391
+ val value = getPref(FRIENDS_LIST_HEADER , " []" )
392
+ return Json .decodeFromString<Set <String >>(value)
393
+ }
394
+ set(value) {
395
+ setPref(FRIENDS_LIST_HEADER , Json .encodeToString(value))
396
+ }
397
+
398
+ // NOTE: This should be removed once chat is considered stable.
399
+ private val ACK_CHAT_PREVIEW = booleanPreferencesKey(" ack_chat_preview" )
400
+ var ackChatPreview: Boolean
401
+ get() = getPref(ACK_CHAT_PREVIEW , false )
402
+ set(value) {
403
+ setPref(ACK_CHAT_PREVIEW , value)
404
+ }
374
405
}
0 commit comments