mirror of
				https://github.com/InsanusMokrassar/MicroUtils.git
				synced 2025-11-04 06:00:22 +00:00 
			
		
		
		
	deprecate broadcast channel flow extensions
This commit is contained in:
		@@ -4,6 +4,9 @@
 | 
			
		||||
 | 
			
		||||
* `Versions`
 | 
			
		||||
    * `Serialization`: `1.0.0` -> `1.0.1`
 | 
			
		||||
* `Coroutines`
 | 
			
		||||
    * `BroadcastFlow` now is deprecated
 | 
			
		||||
    * `BroadcastStateFlow` now is deprecated
 | 
			
		||||
 | 
			
		||||
## 0.2.3
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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>
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user