Fix BrowseSourceController losing scroll position when navigating back

This commit is contained in:
arkon
2020-04-27 16:21:23 -04:00
parent 850654dccc
commit 2a41e4ce68
3 changed files with 8 additions and 18 deletions

View File

@@ -6,8 +6,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.launch
fun launchUI(block: suspend CoroutineScope.() -> Unit): Job =
@@ -19,10 +17,3 @@ fun launchIO(block: suspend CoroutineScope.() -> Unit): Job =
@OptIn(ExperimentalCoroutinesApi::class)
fun launchNow(block: suspend CoroutineScope.() -> Unit): Job =
GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, block)
@OptIn(ExperimentalCoroutinesApi::class)
fun <T> Flow<T>.startWithCurrentValue(block: () -> T?): Flow<T> {
return onStart {
block()?.let { emit(it) }
}
}