2021-10-19 05:02:15 -07:00
|
|
|
package co.electriccoin.zcash.preference.api
|
|
|
|
|
|
|
|
import co.electriccoin.zcash.preference.model.entry.Key
|
|
|
|
import kotlinx.coroutines.flow.Flow
|
|
|
|
|
|
|
|
interface PreferenceProvider {
|
|
|
|
|
|
|
|
suspend fun hasKey(key: Key): Boolean
|
|
|
|
|
2021-11-12 04:09:30 -08:00
|
|
|
suspend fun putString(key: Key, value: String?)
|
2021-10-19 05:02:15 -07:00
|
|
|
|
|
|
|
suspend fun getString(key: Key): String?
|
|
|
|
|
2021-11-12 04:09:30 -08:00
|
|
|
/**
|
|
|
|
* @return Flow to observe potential changes to the value associated with the key in the preferences.
|
|
|
|
* Consumers of the flow will need to then query the value and determine whether it has changed.
|
|
|
|
*/
|
|
|
|
fun observe(key: Key): Flow<Unit>
|
2021-10-19 05:02:15 -07:00
|
|
|
}
|