commit 28975e03b2f323d4000997620d7e6531832010cf
parent 718f2125ba86f8dfe3be192567722d813e5a4de0
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date: Wed, 22 May 2024 16:51:23 +0200
fix(inapp_overlay): dismiss gesture
Diffstat:
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
@@ -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())
}
}