@@ -3,6 +3,7 @@ package com.shifthackz.aisdv1.data.preference
33import android.content.SharedPreferences
44import com.shifthackz.aisdv1.core.common.extensions.fixUrlSlashes
55import com.shifthackz.aisdv1.core.common.extensions.shouldUseNewMediaStore
6+ import com.shifthackz.aisdv1.domain.entity.ColorToken
67import com.shifthackz.aisdv1.domain.entity.HuggingFaceModel
78import com.shifthackz.aisdv1.domain.entity.ServerSource
89import com.shifthackz.aisdv1.domain.entity.Settings
@@ -129,6 +130,33 @@ class PreferenceManagerImpl(
129130 .apply ()
130131 .also { onPreferencesChanged() }
131132
133+ override var designUseSystemColorPalette: Boolean
134+ get() = preferences.getBoolean(KEY_DESIGN_DYNAMIC_COLORS , false )
135+ set(value) = preferences.edit()
136+ .putBoolean(KEY_DESIGN_DYNAMIC_COLORS , value)
137+ .apply ()
138+ .also { onPreferencesChanged() }
139+
140+ override var designUseSystemDarkTheme: Boolean
141+ get() = preferences.getBoolean(KEY_DESIGN_SYSTEM_DARK_THEME , true )
142+ set(value) = preferences.edit()
143+ .putBoolean(KEY_DESIGN_SYSTEM_DARK_THEME , value)
144+ .apply ()
145+ .also { onPreferencesChanged() }
146+
147+ override var designDarkTheme: Boolean
148+ get() = preferences.getBoolean(KEY_DESIGN_DARK_THEME , true )
149+ set(value) = preferences.edit()
150+ .putBoolean(KEY_DESIGN_DARK_THEME , value)
151+ .apply ()
152+ .also { onPreferencesChanged() }
153+ override var designColorToken: String
154+ get() = preferences.getString(KEY_DESIGN_COLOR_TOKEN , " ${ColorToken .MAUVE } " ) ? : " ${ColorToken .MAUVE } "
155+ set(value) = preferences.edit()
156+ .putString(KEY_DESIGN_COLOR_TOKEN , value)
157+ .apply ()
158+ .also { onPreferencesChanged() }
159+
132160 override fun observe (): Flowable <Settings > = preferencesChangedSubject
133161 .toFlowable(BackpressureStrategy .LATEST )
134162 .map {
@@ -143,6 +171,10 @@ class PreferenceManagerImpl(
143171 source = source,
144172 hordeApiKey = hordeApiKey,
145173 localUseNNAPI = localUseNNAPI,
174+ designUseSystemColorPalette = designUseSystemColorPalette,
175+ designUseSystemDarkTheme = designUseSystemDarkTheme,
176+ designDarkTheme = designDarkTheme,
177+ designColorToken = designColorToken,
146178 )
147179 }
148180
@@ -163,6 +195,10 @@ class PreferenceManagerImpl(
163195 private const val KEY_HUGGING_FACE_MODEL_KEY = " key_hugging_face_model_key"
164196 private const val KEY_LOCAL_NN_API = " key_local_nn_api"
165197 private const val KEY_LOCAL_MODEL_ID = " key_local_model_id"
198+ private const val KEY_DESIGN_DYNAMIC_COLORS = " key_design_dynamic_colors"
199+ private const val KEY_DESIGN_SYSTEM_DARK_THEME = " key_design_system_dark_theme"
200+ private const val KEY_DESIGN_DARK_THEME = " key_design_dark_theme"
201+ private const val KEY_DESIGN_COLOR_TOKEN = " key_design_color_token_theme"
166202 private const val KEY_FORCE_SETUP_AFTER_UPDATE = " force_upd_setup_v0.x.x-v0.5.8"
167203 }
168204}
0 commit comments