Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tfcporciuncula committed Jul 25, 2022
1 parent c843488 commit cf11674
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ package com.fredporciuncula.flow.preferences

import android.content.SharedPreferences
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlin.coroutines.CoroutineContext

internal typealias KeyFlow = Flow<String?>

@ExperimentalCoroutinesApi
class FlowSharedPreferences @JvmOverloads constructor(
val sharedPreferences: SharedPreferences,
val coroutineContext: CoroutineContext = Dispatchers.IO
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.fredporciuncula.flow.preferences

import android.content.SharedPreferences
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.callbackFlow

@ExperimentalCoroutinesApi
val SharedPreferences.keyFlow
get() = callbackFlow {
// key can be null when preferences are cleared on Android R+
Expand Down

0 comments on commit cf11674

Please # to comment.