-
-
Save egorikftp/b2a7787bc956812b97e6e39fc7508773 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum class Theme(val storageKey: String) { | |
LIGHT("light"), | |
DARK("dark"), | |
SYSTEM("system") | |
} | |
// initialization DataStore with extension | |
private val dataStore: DataStore<Preferences> = context.dataStore | |
var selectedTheme by PreferenceDataStore<String>( | |
dataStore = dataStore, | |
key = stringPreferencesKey(name = "pref_dark_mode"), | |
defaultValue = SYSTEM.storageKey | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment