Repository: alexvanyo/composelife (kotlin)

Issue:
Convert `ComposeLifeDispatchers` to use `CoroutineContext` for all entries
https://code.cash.app/dispatchers-unconfined

Pull request:
Fixes #2322

Patch:
diff --git a/dispatchers/src/commonMain/kotlin/com/alexvanyo/composelife/dispatchers/ComposeLifeDispatchers.kt b/dispatchers/src/commonMain/kotlin/com/alexvanyo/composelife/dispatchers/ComposeLifeDispatchers.kt
index 01c4142776..a200cbdea4 100644
--- a/dispatchers/src/commonMain/kotlin/com/alexvanyo/composelife/dispatchers/ComposeLifeDispatchers.kt
+++ b/dispatchers/src/commonMain/kotlin/com/alexvanyo/composelife/dispatchers/ComposeLifeDispatchers.kt
@@ -16,10 +16,7 @@
 
 package com.alexvanyo.composelife.dispatchers
 
-import kotlinx.coroutines.CoroutineDispatcher
 import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.IO
-import kotlinx.coroutines.MainCoroutineDispatcher
 import me.tatarka.inject.annotations.Inject
 import kotlin.coroutines.CoroutineContext
 import kotlin.coroutines.EmptyCoroutineContext
@@ -32,22 +29,22 @@ interface ComposeLifeDispatchers {
     /**
      * @see Dispatchers.Default
      */
-    val Default: CoroutineDispatcher
+    val Default: CoroutineContext
 
     /**
      * @see Dispatchers.Main
      */
-    val Main: CoroutineDispatcher
+    val Main: CoroutineContext
 
     /**
      * @see Dispatchers.Unconfined
      */
-    val Unconfined: CoroutineDispatcher
+    val Unconfined: CoroutineContext
 
     /**
      * @see Dispatchers.IO
      */
-    val IO: CoroutineDispatcher
+    val IO: CoroutineContext
 
     /**
      * The [CoroutineContext] for driving cell state ticks, in response to time delays.
@@ -61,9 +58,9 @@ interface ComposeLifeDispatchers {
 @Suppress("InjectDispatcher")
 @Inject
 class DefaultComposeLifeDispatchers : ComposeLifeDispatchers {
-    override val Default: CoroutineDispatcher = Dispatchers.Default
-    override val Main: MainCoroutineDispatcher = Dispatchers.Main
-    override val Unconfined: CoroutineDispatcher = Dispatchers.Unconfined
-    override val IO: CoroutineDispatcher = Dispatchers.IO
+    override val Default: CoroutineContext = Dispatchers.Default
+    override val Main: CoroutineContext = Dispatchers.Main
+    override val Unconfined: CoroutineContext = Dispatchers.Unconfined
+    override val IO: CoroutineContext = Dispatchers.IO
     override val CellTicker: CoroutineContext = EmptyCoroutineContext
 }
diff --git a/image-loader/src/commonMain/kotlin/com/alexvanyo/composelife/imageloader/di/ImageLoaderDiskCacheComponent.kt b/image-loader/src/commonMain/kotlin/com/alexvanyo/composelife/imageloader/di/ImageLoaderDiskCacheComponent.kt
index 6e73929a40..e59a651976 100644
--- a/image-loader/src/commonMain/kotlin/com/alexvanyo/composelife/imageloader/di/ImageLoaderDiskCacheComponent.kt
+++ b/image-loader/src/commonMain/kotlin/com/alexvanyo/composelife/imageloader/di/ImageLoaderDiskCacheComponent.kt
@@ -32,6 +32,6 @@ interface ImageLoaderDiskCacheComponent : FileSystemModule {
     ): DiskCache = DiskCache.Builder()
         .directory(FileSystem.SYSTEM_TEMPORARY_DIRECTORY / "coil3_disk_cache")
         .fileSystem(fileSystem)
-        .cleanupDispatcher(dispatchers.IO)
+        .cleanupCoroutineContext(dispatchers.IO)
         .build()
 }


Test patch:
diff --git a/dispatchers-test/src/commonMain/kotlin/com/alexvanyo/composelife/dispatchers/TestComposeLifeDispatchers.kt b/dispatchers-test/src/commonMain/kotlin/com/alexvanyo/composelife/dispatchers/TestComposeLifeDispatchers.kt
index 198bbf9419..f850d9ba87 100644
--- a/dispatchers-test/src/commonMain/kotlin/com/alexvanyo/composelife/dispatchers/TestComposeLifeDispatchers.kt
+++ b/dispatchers-test/src/commonMain/kotlin/com/alexvanyo/composelife/dispatchers/TestComposeLifeDispatchers.kt
@@ -16,7 +16,6 @@
 
 package com.alexvanyo.composelife.dispatchers
 
-import kotlinx.coroutines.CoroutineDispatcher
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.test.TestDispatcher
 import me.tatarka.inject.annotations.Inject
@@ -34,9 +33,9 @@ class TestComposeLifeDispatchers(
     generalTestDispatcher: @GeneralTestDispatcher TestDispatcher,
     cellTickerTestDispatcher: @CellTickerTestDispatcher TestDispatcher,
 ) : ComposeLifeDispatchers {
-    override val Default: CoroutineDispatcher = generalTestDispatcher
-    override val Main: CoroutineDispatcher = generalTestDispatcher
-    override val Unconfined: CoroutineDispatcher = Dispatchers.Unconfined
-    override val IO: CoroutineDispatcher = generalTestDispatcher
+    override val Default: CoroutineContext = generalTestDispatcher
+    override val Main: CoroutineContext = generalTestDispatcher
+    override val Unconfined: CoroutineContext = Dispatchers.Unconfined
+    override val IO: CoroutineContext = generalTestDispatcher
     override val CellTicker: CoroutineContext = cellTickerTestDispatcher
 }