From 39a2cb8431d34ac3bbc2dff553afd5067531213e Mon Sep 17 00:00:00 2001 From: Mahdi Hosseinzadeh Date: Mon, 11 Nov 2024 09:55:13 +0330 Subject: [PATCH] Add a TODO --- .../ir/mahozad/multiplatform/comshot/Comshot.android.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/src/androidMain/kotlin/ir/mahozad/multiplatform/comshot/Comshot.android.kt b/library/src/androidMain/kotlin/ir/mahozad/multiplatform/comshot/Comshot.android.kt index 373e649..40d9971 100644 --- a/library/src/androidMain/kotlin/ir/mahozad/multiplatform/comshot/Comshot.android.kt +++ b/library/src/androidMain/kotlin/ir/mahozad/multiplatform/comshot/Comshot.android.kt @@ -3,6 +3,7 @@ package ir.mahozad.multiplatform.comshot import android.app.Activity import android.graphics.Bitmap import android.graphics.Canvas +import android.os.Handler import android.os.Looper import android.view.View import android.view.ViewGroup @@ -11,6 +12,7 @@ import androidx.compose.runtime.* import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.asImageBitmap import androidx.compose.ui.platform.ComposeView +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleObserver @@ -35,9 +37,16 @@ fun captureToImage( activity: Activity, composable: @Composable () -> Unit ): ImageBitmap { + + + // TODO: Remove the below check and wrap the code in this block + // Handler(Looper.getMainLooper()).post { + // // Code that runs in main + // } if (Looper.myLooper() != Looper.getMainLooper()) { error("This function should be called from the main (UI) thread. See the function documentation.") } + ////////////////////////////////////////////////// ////////////////////////////////////////////////// //////////////////////////////////////////////////