Skip to content

Commit 27f706a

Browse files
committed
chore(flipcash): reduce cash link confirmation modal delay
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 276da20 commit 27f706a

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

apps/flipcash/shared/session/src/main/kotlin/com/flipcash/app/session/internal/RealSessionController.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class RealSessionController @Inject constructor(
175175
toastController.show(
176176
amount = amount,
177177
isDeposit = true,
178-
initialDelay = 1.seconds
178+
initialDelay = AIRDROP_INITIAL_DELAY
179179
)
180180
}
181181
}
@@ -330,7 +330,7 @@ class RealSessionController @Inject constructor(
330330
shareSheetController.reset(setChecked = true)
331331

332332
// delay _slightly_ before presenting confirmation
333-
delay(2.5.seconds)
333+
delay(CASH_LINK_CONFIRMATION_DELAY)
334334

335335
// confirm the result of the share
336336
val confirmResult = shareConfirmationController.confirm(shareable, result)
@@ -591,12 +591,15 @@ class RealSessionController @Inject constructor(
591591
billController.reset(showToast = shown)
592592

593593
if (shown) {
594-
delay(5.seconds)
594+
delay(ToastController.SHOW_DELAY)
595595
}
596596
if (!overrideToast) {
597597
shareSheetController.reset()
598598
}
599599
billController.reset()
600600
}
601601
}
602-
}
602+
}
603+
604+
private val AIRDROP_INITIAL_DELAY = 1.seconds
605+
private val CASH_LINK_CONFIRMATION_DELAY = 1.seconds

apps/flipcash/shared/session/src/main/kotlin/com/flipcash/app/session/internal/toast/ToastController.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ import kotlin.time.Duration.Companion.seconds
1919
class ToastController @Inject constructor(
2020
private val billController: BillController
2121
) {
22+
companion object {
23+
val INITIAL_DELAY = 500.milliseconds
24+
val SHOW_DELAY = 5.seconds
25+
}
2226
private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
2327

2428
fun showIfNeeded(
@@ -49,7 +53,7 @@ class ToastController @Inject constructor(
4953
fun show(
5054
amount: LocalFiat,
5155
isDeposit: Boolean = false,
52-
initialDelay: Duration = 500.milliseconds
56+
initialDelay: Duration = INITIAL_DELAY
5357
) {
5458
if (amount.converted.doubleValue == 0.0) {
5559
return
@@ -64,7 +68,7 @@ class ToastController @Inject constructor(
6468
)
6569
}
6670

67-
delay(5.seconds)
71+
delay(SHOW_DELAY)
6872

6973
billController.update {
7074
it.copy(
@@ -73,11 +77,10 @@ class ToastController @Inject constructor(
7377
}
7478

7579
// wait for animation to run
76-
delay(500.milliseconds)
80+
delay(INITIAL_DELAY)
7781
billController.update {
7882
it.copy(toast = null)
7983
}
8084
}
81-
8285
}
8386
}

0 commit comments

Comments
 (0)