deprecate broadcast channel flow extensions

This commit is contained in:
InsanusMokrassar 2020-11-01 00:43:47 +06:00
parent 98a1ec82db
commit 7f19b83828
3 changed files with 10 additions and 0 deletions

View File

@ -4,6 +4,9 @@
* `Versions` * `Versions`
* `Serialization`: `1.0.0` -> `1.0.1` * `Serialization`: `1.0.0` -> `1.0.1`
* `Coroutines`
* `BroadcastFlow` now is deprecated
* `BroadcastStateFlow` now is deprecated
## 0.2.3 ## 0.2.3

View File

@ -4,6 +4,7 @@ import kotlinx.coroutines.channels.*
import kotlinx.coroutines.flow.* import kotlinx.coroutines.flow.*
@Suppress("FunctionName") @Suppress("FunctionName")
@Deprecated("Deprecated due to stabilization of SharedFlow and StateFlow")
fun <T> BroadcastFlow( fun <T> BroadcastFlow(
internalChannelSize: Int = Channel.BUFFERED internalChannelSize: Int = Channel.BUFFERED
): BroadcastFlow<T> { ): BroadcastFlow<T> {
@ -15,6 +16,7 @@ fun <T> BroadcastFlow(
) )
} }
@Deprecated("Deprecated due to stabilization of SharedFlow and StateFlow")
class BroadcastFlow<T> internal constructor( class BroadcastFlow<T> internal constructor(
private val channel: BroadcastChannel<T>, private val channel: BroadcastChannel<T>,
private val flow: Flow<T> private val flow: Flow<T>

View File

@ -7,6 +7,7 @@ import kotlinx.coroutines.flow.*
const val defaultBroadcastStateFlowReplayCacheSize = 1 const val defaultBroadcastStateFlowReplayCacheSize = 1
@Deprecated("Deprecated due to stabilization of SharedFlow and StateFlow")
class BroadcastStateFlow<T> internal constructor( class BroadcastStateFlow<T> internal constructor(
parentFlow: Flow<T>, parentFlow: Flow<T>,
initial: T, initial: T,
@ -34,17 +35,20 @@ class BroadcastStateFlow<T> internal constructor(
} }
} }
@Deprecated("Deprecated due to stabilization of SharedFlow and StateFlow")
fun <T> BroadcastChannel<T>.asStateFlow( fun <T> BroadcastChannel<T>.asStateFlow(
value: T, value: T,
scope: CoroutineScope, scope: CoroutineScope,
replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize
): StateFlow<T> = BroadcastStateFlow(asFlow(), value, replayCacheSize, scope) ): StateFlow<T> = BroadcastStateFlow(asFlow(), value, replayCacheSize, scope)
@Deprecated("Deprecated due to stabilization of SharedFlow and StateFlow")
fun <T> BroadcastChannel<T?>.asStateFlow( fun <T> BroadcastChannel<T?>.asStateFlow(
scope: CoroutineScope, scope: CoroutineScope,
replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize replayCacheSize: Int = defaultBroadcastStateFlowReplayCacheSize
): StateFlow<T?> = asStateFlow(null, scope, replayCacheSize) ): StateFlow<T?> = asStateFlow(null, scope, replayCacheSize)
@Deprecated("Deprecated due to stabilization of SharedFlow and StateFlow")
fun <T> broadcastStateFlow( fun <T> broadcastStateFlow(
initial: T, scope: CoroutineScope, initial: T, scope: CoroutineScope,
channelSize: Int = Channel.BUFFERED, channelSize: Int = Channel.BUFFERED,
@ -55,6 +59,7 @@ fun <T> broadcastStateFlow(
it to it.asStateFlow(initial, scope, replayCacheSize) it to it.asStateFlow(initial, scope, replayCacheSize)
} }
@Deprecated("Deprecated due to stabilization of SharedFlow and StateFlow")
fun <T> broadcastStateFlow( fun <T> broadcastStateFlow(
scope: CoroutineScope, scope: CoroutineScope,
channelSize: Int = Channel.BUFFERED, channelSize: Int = Channel.BUFFERED,