From fc7dd335c11fe2e8531785fde0a3e71ddaafbffd Mon Sep 17 00:00:00 2001 From: 1552980358 <1552980358@qq.com> Date: Wed, 8 Jun 2022 12:23:47 +0800 Subject: [PATCH] Coroutine.kt: Replace .plus with '+' --- .../java/io/legado/app/help/coroutine/Coroutine.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt b/app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt index 538d6a8e2..5e98d7e18 100644 --- a/app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt +++ b/app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt @@ -121,7 +121,7 @@ class Coroutine( if (null == it.context) { it.block.invoke(scope) } else { - withContext(scope.coroutineContext.plus(it.context)) { + withContext(scope.coroutineContext + it.context) { it.block.invoke(this) } } @@ -137,7 +137,7 @@ class Coroutine( context: CoroutineContext, block: suspend CoroutineScope.() -> T ): Job { - return scope.plus(Dispatchers.Main).launch { + return (scope + Dispatchers.Main).launch { try { start?.let { dispatchVoidCallback(this, it) } ensureActive() @@ -166,7 +166,7 @@ class Coroutine( if (null == callback.context) { callback.block.invoke(scope) } else { - withContext(scope.coroutineContext.plus(callback.context)) { + withContext(scope.coroutineContext + callback.context) { callback.block.invoke(this) } } @@ -181,7 +181,7 @@ class Coroutine( if (null == callback.context) { callback.block.invoke(scope, value) } else { - withContext(scope.coroutineContext.plus(callback.context)) { + withContext(scope.coroutineContext + callback.context) { callback.block.invoke(this, value) } } @@ -193,7 +193,7 @@ class Coroutine( timeMillis: Long, noinline block: suspend CoroutineScope.() -> T ): T { - return withContext(scope.coroutineContext.plus(context)) { + return withContext(scope.coroutineContext + context) { if (timeMillis > 0L) withTimeout(timeMillis) { block() } else {