Skip to content

Commit e7bb727

Browse files
committed
chore: audit use of showError vs showAlert; replace where makes sense
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent f7bd228 commit e7bb727

7 files changed

Lines changed: 17 additions & 13 deletions

File tree

apps/flipcash/features/backupkey/src/main/kotlin/com/flipcash/app/backupkey/internal/BackupKeyScreenContent.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import androidx.compose.ui.draw.scale
3232
import androidx.compose.ui.graphics.asImageBitmap
3333
import androidx.compose.ui.layout.ContentScale
3434
import androidx.compose.ui.platform.LocalContext
35+
import androidx.compose.ui.platform.LocalResources
3536
import androidx.compose.ui.res.stringResource
3637
import androidx.compose.ui.text.style.TextAlign
3738
import androidx.compose.ui.unit.Dp
@@ -55,6 +56,7 @@ import com.getcode.util.permissions.rememberStoragePermission
5556
@Composable
5657
internal fun BackupKeyScreenContent(viewModel: BackupKeyScreenViewModel) {
5758
val context = LocalContext.current
59+
val resources = LocalResources.current
5860
val dataState by viewModel.uiFlow.collectAsState()
5961

6062
var isExportSeedRequested by remember { mutableStateOf(false) }
@@ -66,12 +68,12 @@ internal fun BackupKeyScreenContent(viewModel: BackupKeyScreenViewModel) {
6668

6769
if (!isStoragePermissionGranted) {
6870
BottomBarManager.showError(
69-
title = context.getString(R.string.error_title_failedToSave),
70-
message = context.getString(R.string.error_description_failedToSave),
71+
title = resources.getString(R.string.error_title_failedToSave),
72+
message = resources.getString(R.string.error_description_failedToSave),
7173
actions = listOf(
7274
BottomBarAction.Ok,
7375
BottomBarAction(
74-
text = context.getString(R.string.action_openSettings),
76+
text = resources.getString(R.string.action_openSettings),
7577
style = BottomBarManager.BottomBarButtonStyle.Filled50,
7678
onClick = { context.launchAppSettings() }
7779
)

apps/flipcash/features/cash/src/main/kotlin/com/flipcash/app/cash/internal/CashScreenViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ internal class CashScreenViewModel @Inject constructor(
168168
currency.code?.let { stateFlow.value.limits?.sendLimitFor(it) } ?: SendLimit.Zero
169169
val isOverLimit = amount > sendLimit.nextTransaction
170170
if (isOverLimit) {
171-
BottomBarManager.showError(
171+
BottomBarManager.showAlert(
172172
resources.getString(R.string.error_title_sendLimitReached),
173173
resources.getString(R.string.error_description_sendLimitReached)
174174
)

apps/flipcash/features/contact-verification/src/main/kotlin/com/flipcash/app/contact/verification/internal/email/EmailVerificationViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class EmailVerificationViewModel @Inject constructor(
208208
dispatchEvent(Event.OnSendingCodeChanged(loading = true))
209209
if (stateFlow.value.attempts >= 3) {
210210
dispatchEvent(Event.OnSendingCodeChanged())
211-
BottomBarManager.showError(
211+
BottomBarManager.showAlert(
212212
title = resources.getString(R.string.error_title_maxAttemptsReached),
213213
message = resources.getString(R.string.error_description_maxAttemptsReached),
214214
) {

apps/flipcash/features/contact-verification/src/main/kotlin/com/flipcash/app/contact/verification/internal/phone/PhoneVerificationViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ internal class PhoneVerificationViewModel @Inject constructor(
202202
dispatchEvent(Event.OnSendingCodeChanged(loading = true))
203203
if (stateFlow.value.attempts >= 3) {
204204
dispatchEvent(Event.OnSendingCodeChanged())
205-
BottomBarManager.showError(
205+
BottomBarManager.showAlert(
206206
title = resources.getString(R.string.error_title_maxAttemptsReached),
207207
message = resources.getString(R.string.error_description_maxAttemptsReached),
208208
) {

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import androidx.compose.ui.Alignment.Companion.BottomCenter
3232
import androidx.compose.ui.Modifier
3333
import androidx.compose.ui.graphics.Color
3434
import androidx.compose.ui.platform.LocalContext
35+
import androidx.compose.ui.platform.LocalResources
3536
import androidx.compose.ui.platform.testTag
3637
import androidx.compose.ui.unit.dp
3738
import androidx.lifecycle.compose.collectAsStateWithLifecycle
@@ -71,15 +72,16 @@ internal fun BillContainer(
7172
) {
7273
val session = LocalSessionController.current!!
7374
val context = LocalContext.current
75+
val resources = LocalResources.current
7476
val onPermissionResult = { result: PermissionResult ->
7577
if (result == PermissionResult.PermanentlyDenied) {
76-
BottomBarManager.showError(
77-
title = context.getString(R.string.action_allowCameraAccess),
78-
message = context.getString(R.string.error_description_cameraAccessRequired),
78+
BottomBarManager.showAlert(
79+
title = resources.getString(R.string.action_allowCameraAccess),
80+
message = resources.getString(R.string.error_description_cameraAccessRequired),
7981
actions = listOf(
8082
BottomBarAction.Ok,
8183
BottomBarAction(
82-
text = context.getString(R.string.action_openSettings),
84+
text = resources.getString(R.string.action_openSettings),
8385
style = BottomBarManager.BottomBarButtonStyle.Filled50,
8486
onClick = { context.launchAppSettings() }
8587

apps/flipcash/features/withdrawal/src/main/kotlin/com/flipcash/app/withdrawal/WithdrawalViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ internal class WithdrawalViewModel @Inject constructor(
168168

169169
val isOverBalance = enteredInUsdc > tokenBalance.rounded()
170170
if (isOverBalance || conversionRate == Rate.ignore) {
171-
BottomBarManager.showError(
171+
BottomBarManager.showAlert(
172172
title = resources.getString(R.string.error_title_insufficientFunds),
173173
message = resources.getString(R.string.error_description_insufficientFunds)
174174
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,14 +751,14 @@ class RealSessionController @Inject constructor(
751751
}
752752

753753
is ReceiveGiftTransactorError.AlreadyClaimed -> {
754-
BottomBarManager.showError(
754+
BottomBarManager.showAlert(
755755
resources.getString(R.string.error_title_alreadyCollected),
756756
resources.getString(R.string.error_description_alreadyCollected)
757757
)
758758
}
759759

760760
is ReceiveGiftTransactorError.Expired -> {
761-
BottomBarManager.showError(
761+
BottomBarManager.showAlert(
762762
resources.getString(R.string.error_title_linkExpired),
763763
resources.getString(R.string.error_description_linkExpired)
764764
)

0 commit comments

Comments
 (0)