Updated on 2026-08-14

This commit is contained in:
Tangem 2025-12-17 19:10:58 +05:00
parent 46c112eca8
commit ed89b4bcd0
8 changed files with 37 additions and 11 deletions

View file

@ -36,6 +36,7 @@ class CardContextInterceptor(
is SignIn.ScreenOpened,
is SignIn.ButtonAddWallet,
-> false
is SignIn.ErrorBiometricUpdated -> !event.isFromUnlockAll
else -> true
}
}

View file

@ -19,6 +19,7 @@ class HotWalletContextInterceptor(
is SignIn.ButtonUnlockAllWithBiometric,
is IntroductionProcess.ButtonScanCard,
-> false
is SignIn.ErrorBiometricUpdated -> !event.isFromUnlockAll
else -> true
}
}

View file

@ -16,6 +16,7 @@ inline fun UnlockWalletError.handle(
onAlreadyUnlocked: () -> Unit = {},
onUserCancelled: () -> Unit = {},
analyticsEventHandler: AnalyticsEventHandler,
isFromUnlockAll: Boolean,
noinline showMessage: (EventMessage) -> Unit,
) {
when (this) {
@ -33,11 +34,17 @@ inline fun UnlockWalletError.handle(
// This should never happen in this flow, as we always check for the wallet existence before unlocking
showMessage(SnackbarMessage(TextReference.Res(R.string.generic_error)))
}
is UnlockWalletError.UnableToUnlock -> handleUnableToUnlock(this, analyticsEventHandler, showMessage)
is UnlockWalletError.UnableToUnlock -> handleUnableToUnlock(
isFromUnlockAll = isFromUnlockAll,
error = this,
analyticsEventHandler = analyticsEventHandler,
showDialog = showMessage,
)
}
}
fun handleUnableToUnlock(
isFromUnlockAll: Boolean,
error: UnlockWalletError.UnableToUnlock,
analyticsEventHandler: AnalyticsEventHandler,
showDialog: (DialogMessage) -> Unit,
@ -46,7 +53,7 @@ fun handleUnableToUnlock(
is UnlockWalletError.UnableToUnlock.WithReason -> {
when (error.reason) {
Reason.AllKeysInvalidated -> {
analyticsEventHandler.send(SignIn.ErrorBiometricUpdated())
analyticsEventHandler.send(SignIn.ErrorBiometricUpdated(isFromUnlockAll))
DialogMessage(
title = resourceReference(R.string.biometric_updated_warning_title),
message = resourceReference(R.string.biometric_updated_warning_description),

View file

@ -21,7 +21,9 @@ sealed class SignIn(
class ButtonUnlockAllWithBiometric : SignIn(event = "Button - Unlock All With Biometric")
class ErrorBiometricUpdated : SignIn(event = "Error - Biometric Updated")
data class ErrorBiometricUpdated(
val isFromUnlockAll: Boolean,
) : SignIn(event = "Error - Biometric Updated")
class ButtonWallet(
signInType: SignInType,

View file

@ -91,7 +91,7 @@ internal class UserWalletListModel @Inject constructor(
private fun onAddNewWalletClick() {
if (hotWalletFeatureToggles.isHotWalletEnabled) {
analyticsEventHandler.send(SignIn.ButtonAddWallet(AnalyticsParam.ScreensSources.SignIn))
analyticsEventHandler.send(SignIn.ButtonAddWallet(AnalyticsParam.ScreensSources.Settings))
router.push(AppRoute.CreateWalletSelection)
} else {
withProgress(isWalletSavingInProgress) {
@ -109,6 +109,7 @@ internal class UserWalletListModel @Inject constructor(
Timber.e("Failed to unlock wallet $userWalletId: $error")
error.handle(
onUserCancelled = {},
isFromUnlockAll = false,
onAlreadyUnlocked = { router.push(AppRoute.WalletSettings(userWalletId)) },
analyticsEventHandler = analyticsEventHandler,
showMessage = messageSender::send,

View file

@ -31,7 +31,6 @@ internal class HotWalletStepperModel @Inject constructor(
}
fun onSkipClick() {
// TODO send analytics
params.callback.onSkipClick()
}
}

View file

@ -200,6 +200,7 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
onAlreadyUnlocked = {},
onUserCancelled = {},
analyticsEventHandler = analyticsEventHandler,
isFromUnlockAll = true,
showMessage = uiMessageSender::send,
)
}

View file

@ -108,9 +108,10 @@ internal class WelcomeModel @Inject constructor(
routedOut = true
router.replaceAll(AppRoute.Wallet)
}
.onLeft {
it.handle(
.onLeft { error ->
error.handle(
specificWalletId = null,
isFromUnlockAll = true,
onUserCancelled = { tryToUnlockWithAccessCodeRightAway() },
)
setSelectWalletState()
@ -146,8 +147,12 @@ internal class WelcomeModel @Inject constructor(
.onRight {
router.replaceAll(AppRoute.Wallet)
}
.onLeft {
it.handle(null, onUserCancelled = { /* ignore */ })
.onLeft { error ->
error.handle(
specificWalletId = null,
isFromUnlockAll = true,
onUserCancelled = { /* ignore */ },
)
}
}
},
@ -202,11 +207,19 @@ internal class WelcomeModel @Inject constructor(
router.replaceAll(AppRoute.Wallet)
}
.onLeft { error ->
error.handle(specificWalletId = userWalletId, onUserCancelled = { /* ignore*/ })
error.handle(
specificWalletId = userWalletId,
isFromUnlockAll = false,
onUserCancelled = { /* ignore*/ },
)
}
}
suspend fun UnlockWalletError.handle(specificWalletId: UserWalletId?, onUserCancelled: suspend () -> Unit = { }) {
suspend fun UnlockWalletError.handle(
specificWalletId: UserWalletId?,
isFromUnlockAll: Boolean,
onUserCancelled: suspend () -> Unit = { },
) {
handle(
onAlreadyUnlocked = {
// this should not happen, as we check for locked state before this
@ -215,6 +228,7 @@ internal class WelcomeModel @Inject constructor(
},
onUserCancelled = { onUserCancelled() },
analyticsEventHandler = analyticsEventHandler,
isFromUnlockAll = isFromUnlockAll,
showMessage = uiMessageSender::send,
)
}