Skip to content

Commit faf4091

Browse files
committed
chore(flipcash): add beta flag for vibrate on scan
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 203aaf5 commit faf4091

5 files changed

Lines changed: 26 additions & 5 deletions

File tree

apps/flipcash/features/lab/src/main/kotlin/com/flipcash/app/lab/internal/LabsScreenContent.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@ internal fun LabsScreenContent() {
6767
private val FeatureFlag.title: String
6868
get() = when (this) {
6969
is FeatureFlag.CredentialManager -> "Credential Manager"
70+
FeatureFlag.VibrateOnScan -> "Vibrate on Scan"
7071
}
7172

7273
private val FeatureFlag.message: String
7374
get() = when (this) {
7475
FeatureFlag.CredentialManager -> "When enabled, you will gain the ability to utilize Google's Password Manager for storing and recovering access keys for easier login experience."
76+
FeatureFlag.VibrateOnScan -> "If enabled, the device will vibrate once to indicate that the camera has registered the code on the bill."
7577
}

apps/flipcash/features/scanner/src/main/kotlin/com/flipcash/app/scanner/internal/bills/BillManagementOptions.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ internal fun BillManagementOptions(
4747
Pill(
4848
modifier = Modifier
4949
.rememberedClickable(enabled = !isSending) { primaryAction.action() },
50-
contentPadding = PaddingValues(15.dp),
50+
contentPadding = PaddingValues(16.dp),
5151
backgroundColor = CodeTheme.colors.action,
5252
) {
5353
Box {
@@ -84,7 +84,7 @@ internal fun BillManagementOptions(
8484
Pill(
8585
modifier = Modifier
8686
.rememberedClickable(enabled = isInteractable) { secondaryAction.action() },
87-
contentPadding = PaddingValues(15.dp),
87+
contentPadding = PaddingValues(16.dp),
8888
backgroundColor = CodeTheme.colors.action,
8989
) {
9090
Row(
@@ -93,7 +93,7 @@ internal fun BillManagementOptions(
9393
Image(
9494
painter = secondaryAction.asset,
9595
contentDescription = "",
96-
modifier = Modifier.size(18.dp)
96+
modifier = Modifier.size(20.dp)
9797
)
9898
secondaryAction.label?.let { label ->
9999
Text(
@@ -108,7 +108,7 @@ internal fun BillManagementOptions(
108108
if (primaryAction == null && secondaryAction == null) {
109109
Pill(
110110
modifier = Modifier.alpha(0f),
111-
contentPadding = PaddingValues(15.dp),
111+
contentPadding = PaddingValues(16.dp),
112112
backgroundColor = Color.Transparent,
113113
) {
114114
Row(

apps/flipcash/shared/featureflags/src/main/kotlin/com/flipcash/app/featureflags/FeatureFlag.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@ sealed interface FeatureFlag {
1515
override val visible: Boolean = BuildConfig.DEBUG
1616
}
1717

18+
data object VibrateOnScan: FeatureFlag {
19+
override val key: String = "scan_debug_enabled"
20+
override val default: Boolean = false
21+
override val launched: Boolean = false
22+
override val visible = true
23+
}
24+
1825
companion object {
19-
val entries: List<FeatureFlag> = listOf(CredentialManager)
26+
val entries: List<FeatureFlag> = listOf(CredentialManager, VibrateOnScan)
2027
}
2128
}
2229

apps/flipcash/shared/session/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ dependencies {
4747

4848
implementation(project(":apps:flipcash:shared:activityfeed"))
4949
implementation(project(":apps:flipcash:shared:appsettings"))
50+
implementation(project(":apps:flipcash:shared:featureflags"))
5051
implementation(project(":apps:flipcash:shared:shareable"))
5152
implementation(project(":apps:flipcash:shared:workers"))
5253
implementation(project(":apps:flipcash:core"))

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import com.flipcash.app.core.internal.bill.BillController
1111
import com.flipcash.app.core.internal.errors.showNetworkError
1212
import com.flipcash.app.core.internal.updater.BalanceUpdater
1313
import com.flipcash.app.core.internal.updater.ExchangeUpdater
14+
import com.flipcash.app.featureflags.FeatureFlag
15+
import com.flipcash.app.featureflags.FeatureFlagController
1416
import com.flipcash.app.session.PresentationStyle
1517
import com.flipcash.app.session.SessionController
1618
import com.flipcash.app.session.SessionState
@@ -84,6 +86,7 @@ class RealSessionController @Inject constructor(
8486
private val billingClient: BillingClient,
8587
private val balanceController: BalanceController,
8688
appSettingsCoordinator: AppSettingsCoordinator,
89+
featureFlagController: FeatureFlagController,
8790
) : SessionController {
8891

8992
private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
@@ -121,6 +124,10 @@ class RealSessionController @Inject constructor(
121124
.observeValue(AppSettingValue.CameraStartByDefault)
122125
.onEach { autoStart -> _state.update { it.copy(autoStartCamera = autoStart) } }
123126
.launchIn(scope)
127+
128+
featureFlagController.observe(FeatureFlag.VibrateOnScan)
129+
.onEach { enabled -> _state.update { it.copy(vibrateOnScan = enabled) } }
130+
.launchIn(scope)
124131
}
125132

126133
override fun onAppInForeground() {
@@ -445,6 +452,10 @@ class RealSessionController @Inject constructor(
445452
return
446453
}
447454

455+
if (state.value.vibrateOnScan) {
456+
vibrator.tick()
457+
}
458+
448459
scannedRendezvous.add(codePayload.rendezvous.publicKey)
449460

450461
trace(

0 commit comments

Comments
 (0)