@@ -441,64 +441,110 @@ class RealSessionController @Inject constructor(
441
441
// delay _slightly_ before presenting confirmation
442
442
delay(CASH_LINK_CONFIRMATION_DELAY )
443
443
444
- // confirm the result of the share
445
- val confirmResult =
446
- shareConfirmationController.confirm(shareable, result)
444
+ confirmGiftCardSent(
445
+ owner = owner,
446
+ giftCard = giftCard,
447
+ amount = amount,
448
+ shareable = shareable,
449
+ result = result
450
+ )
451
+ }
452
+ }
447
453
448
- // reset isChecking after confirmation
449
- shareSheetController.reset(setChecked = false )
454
+ ShareResult .NotShared -> {
455
+ restartBillGrabber()
456
+ }
457
+ }
458
+ }
459
+ shareSheetController.present(shareable)
460
+ }
461
+ }
450
462
451
- when (confirmResult) {
452
- ShareConfirmationResult .Cancelled -> {
453
- // user selected cancel, dismiss everything back to camera
463
+ private suspend fun confirmGiftCardSent (
464
+ owner : AccountCluster ,
465
+ giftCard : GiftCardAccount ,
466
+ amount : LocalFiat ,
467
+ shareable : Shareable ,
468
+ result : ShareResult .ActionTaken ,
469
+ ) {
470
+ // confirm the result of the share
471
+ val confirmResult =
472
+ shareConfirmationController.confirm(shareable, result)
473
+
474
+ // reset isChecking after confirmation
475
+ shareSheetController.reset(setChecked = false )
476
+
477
+ when (confirmResult) {
478
+ ShareConfirmationResult .Cancelled -> {
479
+ BottomBarManager .showMessage(
480
+ title = " Are You Sure?" ,
481
+ subtitle = " Anyone you sent the link to won’t be able to collect the cash" ,
482
+ actions = listOf (
483
+ BottomBarAction (
484
+ text = " Yes" ,
485
+ onClick = {
486
+ // user selected cancel, dismiss everything back to camera
487
+ scope.launch {
454
488
cancelGiftCard(owner, giftCard)
455
489
}
456
-
457
- is ShareConfirmationResult .Confirmed -> {
458
- when (result) {
459
- ShareResult .CopiedToClipboard -> {
460
- toastController.enqueue(amount, isDeposit = false )
461
- dismissBill(Grabbed )
462
- vibrator.vibrate()
463
- bringActivityFeedCurrent()
464
- analytics.transfer(AnalyticsEvent .SentCashLink (clipboard = true ), amount)
465
- trace(
466
- tag = " Session" ,
467
- message = " Cash link copied to clipboard" ,
468
- metadata = {
469
- " amount" to amount
470
- },
471
- type = TraceType .User ,
472
- )
473
- }
474
-
475
- is ShareResult .SharedToApp -> {
476
- toastController.enqueue(amount, isDeposit = false )
477
- dismissBill(Grabbed )
478
- vibrator.vibrate()
479
- bringActivityFeedCurrent()
480
- analytics.transfer(AnalyticsEvent .SentCashLink (app = result.to), amount)
481
- trace(
482
- tag = " Session" ,
483
- message = " Cash link shared with ${result.to} " ,
484
- metadata = {
485
- " amount" to amount
486
- },
487
- type = TraceType .User ,
488
- )
489
- }
490
- }
490
+ }
491
+ ),
492
+ BottomBarAction (
493
+ text = " Nevermind" ,
494
+ style = BottomBarManager .BottomBarButtonStyle .Text ,
495
+ onClick = {
496
+ scope.launch {
497
+ confirmGiftCardSent(
498
+ owner,
499
+ giftCard,
500
+ amount,
501
+ shareable,
502
+ result
503
+ )
491
504
}
492
505
}
493
- }
506
+ )
507
+ ),
508
+ isDismissible = false ,
509
+ showCancel = false ,
510
+ )
511
+ }
512
+
513
+ is ShareConfirmationResult .Confirmed -> {
514
+ when (result) {
515
+ ShareResult .CopiedToClipboard -> {
516
+ toastController.enqueue(amount, isDeposit = false )
517
+ dismissBill(Grabbed )
518
+ vibrator.vibrate()
519
+ bringActivityFeedCurrent()
520
+ analytics.transfer(AnalyticsEvent .SentCashLink (clipboard = true ), amount)
521
+ trace(
522
+ tag = " Session" ,
523
+ message = " Cash link copied to clipboard" ,
524
+ metadata = {
525
+ " amount" to amount
526
+ },
527
+ type = TraceType .User ,
528
+ )
494
529
}
495
530
496
- ShareResult .NotShared -> {
497
- restartBillGrabber()
531
+ is ShareResult .SharedToApp -> {
532
+ toastController.enqueue(amount, isDeposit = false )
533
+ dismissBill(Grabbed )
534
+ vibrator.vibrate()
535
+ bringActivityFeedCurrent()
536
+ analytics.transfer(AnalyticsEvent .SentCashLink (app = result.to), amount)
537
+ trace(
538
+ tag = " Session" ,
539
+ message = " Cash link shared with ${result.to} " ,
540
+ metadata = {
541
+ " amount" to amount
542
+ },
543
+ type = TraceType .User ,
544
+ )
498
545
}
499
546
}
500
547
}
501
- shareSheetController.present(shareable)
502
548
}
503
549
}
504
550
@@ -716,7 +762,7 @@ class RealSessionController @Inject constructor(
716
762
)
717
763
}
718
764
719
- private fun presentBillToUser (data : List <Byte >, bill : Bill ) {
765
+ private fun presentBillToUser (data : List <Byte >, bill : Bill ) {
720
766
if (billController.state.value.bill != null ) return
721
767
722
768
if (bill.didReceive) {
0 commit comments