From 4c32104d29de32cecf3c9647a8f628bd835e14cf Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 5 Jan 2019 00:34:11 -0500 Subject: Use conflated channels where possible, resolves #1314 --- .../kotlin/com/pitchedapps/frost/views/FrostContentView.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt index 72d8803c..575e5a4d 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt @@ -43,6 +43,7 @@ import com.pitchedapps.frost.utils.Prefs import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.BroadcastChannel +import kotlinx.coroutines.channels.ConflatedBroadcastChannel import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.launch @@ -82,9 +83,13 @@ abstract class FrostContentView @JvmOverloads constructor( override val core: FrostContentCore get() = coreView - override val refreshChannel: BroadcastChannel = BroadcastChannel(100) - override val progressChannel: BroadcastChannel = BroadcastChannel(100) - override val titleChannel: BroadcastChannel = BroadcastChannel(100) + /** + * While this can be conflated, there exist situations where we wish to watch refresh cycles. + * Here, we'd need to make sure we don't skip events + */ + override val refreshChannel: BroadcastChannel = BroadcastChannel(10) + override val progressChannel: BroadcastChannel = ConflatedBroadcastChannel() + override val titleChannel: BroadcastChannel = ConflatedBroadcastChannel() override lateinit var scope: CoroutineScope -- cgit v1.2.3