fix: fix theme switch
This commit is contained in:
@@ -20,6 +20,7 @@ class PreferencesManager(private val context: Context) {
|
||||
// Onboarding & Theme
|
||||
val HAS_SEEN_ONBOARDING = booleanPreferencesKey("has_seen_onboarding")
|
||||
val IS_DARK_THEME = booleanPreferencesKey("is_dark_theme")
|
||||
val THEME_MODE = stringPreferencesKey("theme_mode") // "light", "dark", "auto"
|
||||
|
||||
// Notifications
|
||||
val NOTIFICATIONS_ENABLED = booleanPreferencesKey("notifications_enabled")
|
||||
@@ -63,6 +64,15 @@ class PreferencesManager(private val context: Context) {
|
||||
context.dataStore.edit { preferences -> preferences[IS_DARK_THEME] = value }
|
||||
}
|
||||
|
||||
val themeMode: Flow<String> =
|
||||
context.dataStore.data.map { preferences ->
|
||||
preferences[THEME_MODE] ?: "dark" // Default to dark theme
|
||||
}
|
||||
|
||||
suspend fun setThemeMode(value: String) {
|
||||
context.dataStore.edit { preferences -> preferences[THEME_MODE] = value }
|
||||
}
|
||||
|
||||
// ═════════════════════════════════════════════════════════════
|
||||
// 🔔 NOTIFICATIONS
|
||||
// ═════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user