Skip to content

Commit 3282bdc

Browse files
committed
chore(flipcash): add vibration based on bill not direct request
add it for welcome bonus as a result Signed-off-by: Brandon McAnsh <[email protected]>
1 parent 5f94df7 commit 3282bdc

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface SessionController {
2525
fun onAppInBackground()
2626
fun onCameraScanning(scanning: Boolean)
2727
fun onCameraPermissionResult(result: PermissionResult)
28-
fun showBill(bill: Bill, vibrate: Boolean = false)
28+
fun showBill(bill: Bill)
2929
fun dismissBill(action: BillDeterminationResult)
3030
fun onCodeScan(code: ScannableKikCode)
3131
fun openCashLink(cashLink: String?)

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ class RealSessionController @Inject constructor(
306306
_state.update { it.copy(isCameraPermissionGranted = result == PermissionResult.Granted) }
307307
}
308308

309-
override fun showBill(bill: Bill, vibrate: Boolean) {
309+
override fun showBill(bill: Bill) {
310310
if (bill.amount.converted.doubleValue == 0.0) return
311311
val owner = userManager.accountCluster ?: return
312312

@@ -350,7 +350,7 @@ class RealSessionController @Inject constructor(
350350
message = "Cash link not sent. Restarting awaiting grab",
351351
type = TraceType.User,
352352
)
353-
awaitBillGrab(bill, owner, vibrate)
353+
awaitBillGrab(bill, owner)
354354
}
355355
}
356356
),
@@ -361,14 +361,14 @@ class RealSessionController @Inject constructor(
361361
)
362362
}
363363
}
364-
awaitBillGrab(bill, owner, vibrate)
364+
awaitBillGrab(bill, owner)
365365
}
366366
}
367367
}
368368
}
369369
}
370370

371-
private fun awaitBillGrab(bill: Bill, owner: AccountCluster, vibrate: Boolean) {
371+
private fun awaitBillGrab(bill: Bill, owner: AccountCluster) {
372372
billController.awaitGrab(
373373
amount = bill.amount,
374374
owner = owner,
@@ -407,7 +407,7 @@ class RealSessionController @Inject constructor(
407407
type = TraceType.User,
408408
)
409409
}
410-
presentBillToUser(data, bill, vibrate)
410+
presentBillToUser(data, bill)
411411
},
412412
)
413413
}
@@ -612,7 +612,6 @@ class RealSessionController @Inject constructor(
612612
toastController.enqueue(it, isDeposit = true)
613613
showBill(
614614
bill = Bill.Cash(amount = it, didReceive = true),
615-
vibrate = true
616615
)
617616
checkPendingItemsInFeed()
618617
bringActivityFeedCurrent()
@@ -700,7 +699,6 @@ class RealSessionController @Inject constructor(
700699
toastController.enqueue(amount, isDeposit = true)
701700
showBill(
702701
bill = Bill.Cash(amount = amount, didReceive = true),
703-
vibrate = true
704702
)
705703
checkPendingItemsInFeed()
706704
bringActivityFeedCurrent()
@@ -718,7 +716,7 @@ class RealSessionController @Inject constructor(
718716
)
719717
}
720718

721-
private fun presentBillToUser(data : List<Byte>, bill: Bill, isVibrate: Boolean = false) {
719+
private fun presentBillToUser(data : List<Byte>, bill: Bill) {
722720
if (billController.state.value.bill != null) return
723721

724722
if (bill.didReceive) {
@@ -727,6 +725,8 @@ class RealSessionController @Inject constructor(
727725
valuation = PaymentValuation(bill.amount.converted),
728726
)
729727
}
728+
729+
vibrator.vibrate()
730730
}
731731

732732
val style: BillDeterminationResult =
@@ -756,10 +756,6 @@ class RealSessionController @Inject constructor(
756756
// }
757757
// )
758758
}
759-
760-
if (isVibrate) {
761-
vibrator.vibrate()
762-
}
763759
}
764760

765761

0 commit comments

Comments
 (0)