Updated on 2026-08-14

This commit is contained in:
Tangem 2023-10-23 16:09:14 +04:00
parent 6bbe8b6606
commit 0928055213
5 changed files with 15 additions and 7 deletions

View file

@ -16,6 +16,7 @@ import com.tangem.tap.domain.userWalletList.utils.toUserWallets
import com.tangem.tap.domain.userWalletList.utils.updateWith
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.*
import timber.log.Timber
@OptIn(ExperimentalCoroutinesApi::class)
internal class BiometricUserWalletsListManager(
@ -217,9 +218,8 @@ internal class BiometricUserWalletsListManager(
}
.map {
selectedUserWalletSync.guard {
throw UserWalletsListError.UnableToUnlockUserWallets(
cause = IllegalStateException("No user wallet selected"),
)
Timber.e("Unable to find selected user wallet")
throw UserWalletsListError.NoUserWalletSelected
}
}
}

View file

@ -38,7 +38,7 @@ internal class BiometricUserWalletsKeysRepository(
is TangemSdkError.AuthenticationPermanentLockout ->
UserWalletsListError.BiometricsAuthenticationLockout(isPermanent = true)
is TangemSdkError.KeystoreInvalidated ->
UserWalletsListError.EncryptionKeyInvalidated
UserWalletsListError.AllKeysInvalidated
is TangemSdkError.AuthenticationUnavailable ->
UserWalletsListError.BiometricsAuthenticationDisabled
else -> error

View file

@ -192,7 +192,9 @@ internal class WalletSelectorViewModel : ViewModel(), StoreSubscriber<WalletSele
isPermanent = error.isPermanent,
onDismiss = this::dismissWarningDialog,
)
is UserWalletsListError.EncryptionKeyInvalidated -> WarningModel.KeyInvalidatedWarning(
is UserWalletsListError.AllKeysInvalidated,
is UserWalletsListError.NoUserWalletSelected,
-> WarningModel.KeyInvalidatedWarning(
onDismiss = this::dismissWarningDialog,
)
is UserWalletsListError.BiometricsAuthenticationDisabled -> WarningModel.BiometricsDisabledWarning(

View file

@ -92,7 +92,9 @@ internal class WelcomeViewModel @Inject constructor(
isPermanent = error.isPermanent,
onDismiss = this::dismissWarning,
)
is UserWalletsListError.EncryptionKeyInvalidated -> WarningModel.KeyInvalidatedWarning(
is UserWalletsListError.AllKeysInvalidated,
is UserWalletsListError.NoUserWalletSelected,
-> WarningModel.KeyInvalidatedWarning(
onDismiss = this::dismissWarning,
)
is UserWalletsListError.BiometricsAuthenticationDisabled -> WarningModel.BiometricsDisabledWarning(

View file

@ -15,7 +15,7 @@ sealed class UserWalletsListError(code: Int) : TangemError(code) {
override val messageResId: Int = R.string.user_wallet_list_error_wallet_already_saved
}
object EncryptionKeyInvalidated : UserWalletsListError(code = 60002) {
object AllKeysInvalidated : UserWalletsListError(code = 60002) {
override var customMessage: String = "Encryption key invalidated"
}
@ -23,6 +23,10 @@ sealed class UserWalletsListError(code: Int) : TangemError(code) {
override var customMessage: String = "Biometrics authentication disabled"
}
object NoUserWalletSelected : UserWalletsListError(code = 60006) {
override var customMessage: String = "No user wallet selected"
}
data class BiometricsAuthenticationLockout(val isPermanent: Boolean) : UserWalletsListError(code = 60003) {
override var customMessage: String = "Biometric authentication lockout, permanent: $isPermanent"
}