-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dfb89e0
commit e048049
Showing
26 changed files
with
118 additions
and
237 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Binary file not shown.
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
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
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
12 changes: 6 additions & 6 deletions
12
app/src/main/java/com/yangdai/opennote/domain/repository/DataStoreRepository.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
package com.yangdai.opennote.domain.repository | ||
|
||
import androidx.datastore.core.DataStore | ||
import androidx.datastore.preferences.core.Preferences | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface DataStoreRepository { | ||
|
||
suspend fun putString(key: String, value: String) | ||
suspend fun putInt(key: String, value: Int) | ||
suspend fun putFloat(key: String, value: Float) | ||
suspend fun putBoolean(key: String, value: Boolean) | ||
suspend fun putStringSet(key: String, value: Set<String>) | ||
|
||
suspend fun getString(key: String): String? | ||
suspend fun getInt(key: String): Int? | ||
suspend fun putBoolean(key: String, value: Boolean) | ||
suspend fun getFloat(key: String): Float? | ||
suspend fun getBoolean(key: String): Boolean? | ||
suspend fun putStringSet(key: String, value: Set<String>) | ||
suspend fun getStringSet(key: String): Set<String>? | ||
|
||
fun intFlow(key: String): Flow<Int> | ||
fun floatFlow(key: String): Flow<Float> | ||
fun stringFlow(key: String): Flow<String> | ||
fun booleanFlow(key: String): Flow<Boolean> | ||
fun stringSetFlow(key: String): Flow<Set<String>> | ||
fun preferencesFlow(): Flow<Preferences> | ||
fun getDataStore(): DataStore<Preferences> | ||
} |
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
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
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
Oops, something went wrong.