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`
* `Serialization`: `1.0.0` -> `1.0.1`
* `Coroutines`
* `BroadcastFlow` now is deprecated
* `BroadcastStateFlow` now is deprecated
## 0.2.3

View File

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

View File

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