From ce17c06c9ed7888c95ace5603eac5ad23cdcef1f Mon Sep 17 00:00:00 2001 From: Jan Seeger Date: Wed, 22 May 2024 11:35:29 +0200 Subject: [PATCH] Add SharingStarted helper --- .../de/sipgate/dachlatten/flow/SharingStartedExt.kt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 dachlatten-flow/src/main/kotlin/de/sipgate/dachlatten/flow/SharingStartedExt.kt diff --git a/dachlatten-flow/src/main/kotlin/de/sipgate/dachlatten/flow/SharingStartedExt.kt b/dachlatten-flow/src/main/kotlin/de/sipgate/dachlatten/flow/SharingStartedExt.kt new file mode 100644 index 0000000..61e4f8c --- /dev/null +++ b/dachlatten-flow/src/main/kotlin/de/sipgate/dachlatten/flow/SharingStartedExt.kt @@ -0,0 +1,8 @@ +package de.sipgate.dachlatten.flow + +import kotlinx.coroutines.flow.SharingStarted +import kotlin.time.Duration + +fun SharingStarted.WhileSubscribed(duration: Duration): SharingStarted { + return SharingStarted.WhileSubscribed(stopTimeoutMillis = duration.inWholeMilliseconds) +}