Updated on 2026-08-14
This commit is contained in:
parent
cafd4d074b
commit
f1f9dff5ce
2 changed files with 9 additions and 3 deletions
|
|
@ -36,7 +36,8 @@ interface HotWalletPasswordRequester {
|
|||
* @param hotWalletId The ID of the hot wallet to authenticate with.
|
||||
* @param authMode Indicates whether the request is for authentication mode.
|
||||
* In auth mode user can be deleted after failed attempts.
|
||||
* @param hasBiometry Indicates whether to show biometric authentication option.
|
||||
* @param hasBiometry Indicates whether to show biometric authentication option to the user.
|
||||
* Will be ignored if the device does not support biometry at the moment of the request.
|
||||
*/
|
||||
data class AttemptRequest(
|
||||
val hotWalletId: HotWalletId,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.tangem.core.ui.extensions.resourceReference
|
|||
import com.tangem.core.ui.extensions.wrappedList
|
||||
import com.tangem.domain.common.wallets.UserWalletsListRepository
|
||||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.settings.CanUseBiometryUseCase
|
||||
import com.tangem.domain.wallets.hot.HotWalletAccessCodeAttemptsRepository
|
||||
import com.tangem.domain.wallets.hot.HotWalletAccessCodeAttemptsRepository.Attempts
|
||||
import com.tangem.domain.wallets.hot.HotWalletAccessCodeAttemptsRepository.Companion.MAX_FAST_FORWARD_ATTEMPTS
|
||||
|
|
@ -31,6 +32,7 @@ internal class HotAccessCodeRequestModel @Inject constructor(
|
|||
override val dispatchers: CoroutineDispatcherProvider,
|
||||
private val hotAccessCodeAttemptsRepository: HotWalletAccessCodeAttemptsRepository,
|
||||
private val userWalletsListRepository: UserWalletsListRepository,
|
||||
private val canUseBiometryUseCase: CanUseBiometryUseCase,
|
||||
) : Model() {
|
||||
|
||||
private val result = MutableStateFlow<HotWalletPasswordRequester.Result?>(null)
|
||||
|
|
@ -60,7 +62,7 @@ internal class HotAccessCodeRequestModel @Inject constructor(
|
|||
it.copy(
|
||||
isShown = true,
|
||||
accessCode = "",
|
||||
useBiometricVisible = attemptRequest.hasBiometry,
|
||||
useBiometricVisible = attemptRequest.isBiometryButtonVisible(),
|
||||
onAccessCodeChange = ::onAccessCodeChange,
|
||||
)
|
||||
}
|
||||
|
|
@ -83,7 +85,7 @@ internal class HotAccessCodeRequestModel @Inject constructor(
|
|||
it.copy(
|
||||
accessCodeColor = PinTextColor.WrongCode,
|
||||
onAccessCodeChange = {},
|
||||
useBiometricVisible = currentRequest.hasBiometry,
|
||||
useBiometricVisible = currentRequest.isBiometryButtonVisible(),
|
||||
)
|
||||
}
|
||||
delay(timeMillis = 500) // Delay to show the wrong access code state
|
||||
|
|
@ -212,6 +214,9 @@ internal class HotAccessCodeRequestModel @Inject constructor(
|
|||
dismiss()
|
||||
}
|
||||
|
||||
private suspend fun HotWalletPasswordRequester.AttemptRequest.isBiometryButtonVisible(): Boolean =
|
||||
hasBiometry && canUseBiometryUseCase()
|
||||
|
||||
private fun dismissState() {
|
||||
uiState.update {
|
||||
it.copy(isShown = false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue