From ef158b6b69b21fab76bcc60e4daea2c39db67a20 Mon Sep 17 00:00:00 2001 From: HeroBrine1st Erquilenne Date: Tue, 2 Apr 2024 17:36:16 +0300 Subject: [PATCH] Use regular Job in coroutine contexts --- .../main/java/ru/herobrine1st/e621/navigation/Extensions.kt | 4 ++-- app/src/main/java/ru/herobrine1st/e621/util/InstanceBase.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/ru/herobrine1st/e621/navigation/Extensions.kt b/app/src/main/java/ru/herobrine1st/e621/navigation/Extensions.kt index 7a3d6b8a..3c5f7017 100644 --- a/app/src/main/java/ru/herobrine1st/e621/navigation/Extensions.kt +++ b/app/src/main/java/ru/herobrine1st/e621/navigation/Extensions.kt @@ -26,7 +26,7 @@ import com.arkivanov.essenty.lifecycle.LifecycleOwner import com.arkivanov.essenty.lifecycle.doOnDestroy import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.Job import kotlinx.coroutines.cancel import kotlin.coroutines.CoroutineContext @@ -36,7 +36,7 @@ inline fun StackNavigator.pushIndexed(crossinline create: (index: I } @Suppress("FunctionName") -fun LifecycleOwner.LifecycleScope(context: CoroutineContext = Dispatchers.Main.immediate + SupervisorJob()): CoroutineScope { +fun LifecycleOwner.LifecycleScope(context: CoroutineContext = Dispatchers.Main.immediate + Job()): CoroutineScope { val coroutineScope = CoroutineScope(context) lifecycle.doOnDestroy { coroutineScope.cancel() diff --git a/app/src/main/java/ru/herobrine1st/e621/util/InstanceBase.kt b/app/src/main/java/ru/herobrine1st/e621/util/InstanceBase.kt index e491f5a5..6c136693 100644 --- a/app/src/main/java/ru/herobrine1st/e621/util/InstanceBase.kt +++ b/app/src/main/java/ru/herobrine1st/e621/util/InstanceBase.kt @@ -24,11 +24,11 @@ import androidx.annotation.CallSuper import com.arkivanov.essenty.instancekeeper.InstanceKeeper import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.Job import kotlinx.coroutines.cancel abstract class InstanceBase : InstanceKeeper.Instance { - protected val lifecycleScope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate) + protected val lifecycleScope = CoroutineScope(Job() + Dispatchers.Main.immediate) @CallSuper override fun onDestroy() {