Last active
November 14, 2022 20:40
-
-
Save sergei-mikhailovskii-idf/ad057c8414a8415691661eccea019c31 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
class DataStoreRepository internal constructor( | |
private val dataStore: DataStore<Preferences> | |
) : com.fitnest.domain.repository.DataStoreRepository { | |
override suspend fun saveString(key: String, value: String) { | |
dataStore.edit { it[stringPreferencesKey(key)] = value } | |
} | |
override suspend fun getString(key: String) = dataStore.data.map { | |
it[stringPreferencesKey(key)] | |
}.firstOrNull() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment