From 28975e03b2f323d4000997620d7e6531832010cf Mon Sep 17 00:00:00 2001 From: rhunk <101876869+rhunk@users.noreply.github.com> Date: Wed, 22 May 2024 16:51:23 +0200 Subject: [PATCH] fix(inapp_overlay): dismiss gesture --- .../kotlin/me/rhunk/snapenhance/core/ui/InAppOverlay.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/InAppOverlay.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/InAppOverlay.kt index 6ba1027f..7967edc6 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/InAppOverlay.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/InAppOverlay.kt @@ -128,6 +128,7 @@ class InAppOverlay { LaunchedEffect(toast) { toast.visible = true + if (toast.durationMs < 0) return@LaunchedEffect delay(toast.durationMs.toLong()) toast.visible = false delay(1000) @@ -145,6 +146,7 @@ class InAppOverlay { velocityThreshold = { deviceWidth / 2f }, animationSpec = tween(), confirmValueChange = { + if (it == 0) return@AnchoredDraggableState true toast.visible = false true } @@ -236,7 +238,7 @@ class InAppOverlay { ) { toasts.add(Toast( composable = { - Card( + ElevatedCard( modifier = Modifier .padding(16.dp) .shadow(8.dp, RoundedCornerShape(8.dp)) @@ -253,7 +255,7 @@ class InAppOverlay { icon() text() } - if (showDuration) { + if (showDuration && durationMs > 0) { DurationProgress(duration = durationMs, modifier = Modifier.fillMaxWidth()) } }