Skip to content

Commit 302c7f7

Browse files
committed
chore: remove animations from onboarding notification step
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 276643d commit 302c7f7

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

apps/flipcash/shared/permissions/src/main/kotlin/com/flipcash/app/permissions/internal/NotificationPermissionScreenContent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ internal fun NotificationScreenContent(
4444
modifier = Modifier.align(Alignment.Center),
4545
horizontalAlignment = Alignment.CenterHorizontally,
4646
) {
47-
AnimatedNotificationPreview()
47+
AnimatedNotificationPreview(animate = false)
4848

4949
Text(
5050
text = stringResource(R.string.permissions_title_push),

apps/flipcash/shared/permissions/src/main/kotlin/com/flipcash/app/permissions/internal/NotificationRationalePermissionContent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ internal fun NotificationRationalePermissionContent(permanentlyDenied: Boolean =
8787
.align(Alignment.Center),
8888
horizontalAlignment = Alignment.CenterHorizontally,
8989
) {
90-
AnimatedSwitchPreview()
90+
AnimatedSwitchPreview(animate = false)
9191

9292
Column(
9393
modifier = Modifier

apps/flipcash/shared/permissions/src/main/kotlin/com/flipcash/app/permissions/internal/components/AnimatedNotificationPreview.kt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,17 @@ private class NotificationAnimationState(
2323
)
2424

2525
@Composable
26-
private fun rememberNotificationAnimation(): NotificationAnimationState {
26+
private fun rememberNotificationAnimation(animate: Boolean = true): NotificationAnimationState {
2727
val density = LocalDensity.current
28-
val progress = remember { Animatable(0f) }
28+
val progress = remember { Animatable(if (animate) 0f else 2f) }
2929

3030
LaunchedEffect(Unit) {
31-
delay(300)
32-
progress.animateTo(1f, tween(600))
33-
delay(600)
34-
progress.animateTo(2f, tween(600))
31+
if (animate) {
32+
delay(300)
33+
progress.animateTo(1f, tween(600))
34+
delay(600)
35+
progress.animateTo(2f, tween(600))
36+
}
3537
}
3638

3739
val p = progress.value
@@ -52,8 +54,8 @@ private fun rememberNotificationAnimation(): NotificationAnimationState {
5254
}
5355

5456
@Composable
55-
internal fun AnimatedNotificationPreview() {
56-
val animation = rememberNotificationAnimation()
57+
internal fun AnimatedNotificationPreview(animate: Boolean = true) {
58+
val animation = rememberNotificationAnimation(animate)
5759

5860
DeviceFrame(
5961
clipToFrame = animation.isInsidePhone

0 commit comments

Comments
 (0)