diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt index f4c32feb54..823acaaa5d 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/implementation/BiometricUserWalletsListManager.kt @@ -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 } } } diff --git a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/BiometricUserWalletsKeysRepository.kt b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/BiometricUserWalletsKeysRepository.kt index bb40308916..17c733dd35 100644 --- a/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/BiometricUserWalletsKeysRepository.kt +++ b/app/src/main/java/com/tangem/tap/domain/userWalletList/repository/implementation/BiometricUserWalletsKeysRepository.kt @@ -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 diff --git a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/WalletSelectorViewModel.kt b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/WalletSelectorViewModel.kt index 1915bd51df..7a83d7bbd4 100644 --- a/app/src/main/java/com/tangem/tap/features/walletSelector/ui/WalletSelectorViewModel.kt +++ b/app/src/main/java/com/tangem/tap/features/walletSelector/ui/WalletSelectorViewModel.kt @@ -192,7 +192,9 @@ internal class WalletSelectorViewModel : ViewModel(), StoreSubscriber WarningModel.KeyInvalidatedWarning( + is UserWalletsListError.AllKeysInvalidated, + is UserWalletsListError.NoUserWalletSelected, + -> WarningModel.KeyInvalidatedWarning( onDismiss = this::dismissWarningDialog, ) is UserWalletsListError.BiometricsAuthenticationDisabled -> WarningModel.BiometricsDisabledWarning( diff --git a/app/src/main/java/com/tangem/tap/features/welcome/ui/WelcomeViewModel.kt b/app/src/main/java/com/tangem/tap/features/welcome/ui/WelcomeViewModel.kt index fbd107685e..1f4b9e650e 100644 --- a/app/src/main/java/com/tangem/tap/features/welcome/ui/WelcomeViewModel.kt +++ b/app/src/main/java/com/tangem/tap/features/welcome/ui/WelcomeViewModel.kt @@ -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( diff --git a/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListError.kt b/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListError.kt index 0bb0ef990b..33f066c9ba 100644 --- a/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListError.kt +++ b/domain/wallets/src/main/java/com/tangem/domain/wallets/legacy/UserWalletsListError.kt @@ -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" }