diff --git a/feature/profilecard/src/commonMain/kotlin/io/github/droidkaigi/confsched/profilecard/component/CaptureableCardBack.kt b/feature/profilecard/src/commonMain/kotlin/io/github/droidkaigi/confsched/profilecard/component/CaptureableCardBack.kt index 0bcdb6f59..aa4196bce 100644 --- a/feature/profilecard/src/commonMain/kotlin/io/github/droidkaigi/confsched/profilecard/component/CaptureableCardBack.kt +++ b/feature/profilecard/src/commonMain/kotlin/io/github/droidkaigi/confsched/profilecard/component/CaptureableCardBack.kt @@ -24,8 +24,11 @@ import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.dp import co.touchlab.kermit.Logger import coil3.compose.AsyncImagePainter +import com.preat.peekaboo.image.picker.toImageBitmap import io.github.droidkaigi.confsched.droidkaigiui.compositionlocal.LocalClock +import io.github.droidkaigi.confsched.model.generateColoredImageBase64 import io.github.droidkaigi.confsched.profilecard.ProfileCardUiState.Card +import io.github.droidkaigi.confsched.profilecard.decodeBase64Bytes import kotlinx.coroutines.flow.first @Composable @@ -44,7 +47,17 @@ internal fun BackgroundCapturableCardBack( } qrCodeImagePainter.state.first { it is AsyncImagePainter.State.Success } Logger.d { "BackgroundCapturableCardBack: onCaptured" } - onCaptured(graphicsLayer.toImageBitmap()) + try { + // FIXME In the tests currently implemented, an IllegalArgumentException is thrown when SkiaGraphicsLayer.toImageBitmap is executed. + // FIXME https://github.com/DroidKaigi/conference-app-2024/pull/984#issuecomment-2335126855 + onCaptured(graphicsLayer.toImageBitmap()) + } catch (e: IllegalArgumentException) { + val workAroundImageBitmap = generateColoredImageBase64() + .decodeBase64Bytes() + .toImageBitmap() + onCaptured(workAroundImageBitmap) + Logger.e("In the tests currently implemented, an IllegalArgumentException is thrown when SkiaGraphicsLayer.toImageBitmap is executed.", e) + } } Box( diff --git a/feature/profilecard/src/commonMain/kotlin/io/github/droidkaigi/confsched/profilecard/component/CaptureableCardFront.kt b/feature/profilecard/src/commonMain/kotlin/io/github/droidkaigi/confsched/profilecard/component/CaptureableCardFront.kt index 2f7a8966a..8cb9311c1 100644 --- a/feature/profilecard/src/commonMain/kotlin/io/github/droidkaigi/confsched/profilecard/component/CaptureableCardFront.kt +++ b/feature/profilecard/src/commonMain/kotlin/io/github/droidkaigi/confsched/profilecard/component/CaptureableCardFront.kt @@ -22,8 +22,11 @@ import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.dp import co.touchlab.kermit.Logger import coil3.compose.AsyncImagePainter +import com.preat.peekaboo.image.picker.toImageBitmap import io.github.droidkaigi.confsched.droidkaigiui.compositionlocal.LocalClock +import io.github.droidkaigi.confsched.model.generateColoredImageBase64 import io.github.droidkaigi.confsched.profilecard.ProfileCardUiState.Card +import io.github.droidkaigi.confsched.profilecard.decodeBase64Bytes import kotlinx.coroutines.flow.first @Composable @@ -42,7 +45,17 @@ internal fun BackgroundCapturableCardFront( } profileImagePainter.state.first { it is AsyncImagePainter.State.Success } Logger.d { "BackgroundCapturableCardFront: onCaptured" } - onCaptured(graphicsLayer.toImageBitmap()) + try { + // FIXME In the tests currently implemented, an IllegalArgumentException is thrown when SkiaGraphicsLayer.toImageBitmap is executed. + // FIXME https://github.com/DroidKaigi/conference-app-2024/pull/984#issuecomment-2335126855 + onCaptured(graphicsLayer.toImageBitmap()) + } catch (e: IllegalArgumentException) { + val workAroundImageBitmap = generateColoredImageBase64() + .decodeBase64Bytes() + .toImageBitmap() + onCaptured(workAroundImageBitmap) + Logger.e("In the tests currently implemented, an IllegalArgumentException is thrown when SkiaGraphicsLayer.toImageBitmap is executed.", e) + } } Box(