-
-
Notifications
You must be signed in to change notification settings - Fork 111
Refactors #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactors #285
Changes from 6 commits
e32fcb5
65a05f1
cfbb06e
d2d0401
c69cc03
fee0361
f9443f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
package com.hoc.flowmvi.core_ui | ||
|
||
import kotlin.coroutines.ContinuationInterceptor | ||
import kotlinx.coroutines.CoroutineDispatcher | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.currentCoroutineContext | ||
import timber.log.Timber | ||
|
||
suspend fun debugCheckImmediateMainDispatcher() { | ||
@OptIn(ExperimentalStdlibApi::class) | ||
suspend inline fun debugCheckImmediateMainDispatcher() { | ||
if (BuildConfig.DEBUG) { | ||
val interceptor = currentCoroutineContext()[ContinuationInterceptor] | ||
Timber.d("debugCheckImmediateMainDispatcher: interceptor=$interceptor") | ||
val dispatcher = checkNotNull(currentCoroutineContext()[CoroutineDispatcher]) { | ||
"Expected CoroutineDispatcher in current CoroutineContext but was null" | ||
}.also { Timber.d("debugCheckImmediateMainDispatcher: dispatcher=$it") } | ||
|
||
check(interceptor === Dispatchers.Main.immediate) { | ||
"Expected ContinuationInterceptor to be Dispatchers.Main.immediate but was $interceptor" | ||
check( | ||
dispatcher === Dispatchers.Main.immediate || | ||
!dispatcher.isDispatchNeeded(Dispatchers.Main.immediate), | ||
) { | ||
"Expected ContinuationInterceptor to be Dispatchers.Main.immediate but was $dispatcher" | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.