diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/AccessCodeModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/AccessCodeModel.kt index 6f078713cb..7027bcd915 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/AccessCodeModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/AccessCodeModel.kt @@ -6,6 +6,7 @@ import com.tangem.core.decompose.di.ModelScoped import com.tangem.core.decompose.model.Model import com.tangem.core.decompose.model.ParamsContainer import com.tangem.core.decompose.ui.UiMessageSender +import com.tangem.core.ui.components.fields.PinTextColor import com.tangem.core.ui.extensions.resourceReference import com.tangem.core.ui.message.DialogMessage import com.tangem.core.ui.message.EventMessageAction @@ -60,6 +61,7 @@ internal class AccessCodeModel @Inject constructor( private fun getInitialState() = AccessCodeUM( accessCode = "", + accessCodeColor = PinTextColor.Primary, onAccessCodeChange = ::onAccessCodeChange, isConfirmMode = params.accessCodeToConfirm != null, buttonEnabled = false, @@ -76,6 +78,12 @@ internal class AccessCodeModel @Inject constructor( } else { value.length == uiState.value.accessCodeLength }, + accessCodeColor = when { + params.accessCodeToConfirm == null -> PinTextColor.Primary + value.length != uiState.value.accessCodeLength -> PinTextColor.Primary + value == params.accessCodeToConfirm -> PinTextColor.Success + else -> PinTextColor.WrongCode + }, ) } } diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/entity/AccessCodeUM.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/entity/AccessCodeUM.kt index 11eccc1463..be65b51a49 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/entity/AccessCodeUM.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/entity/AccessCodeUM.kt @@ -1,9 +1,11 @@ package com.tangem.features.hotwallet.accesscode.entity +import com.tangem.core.ui.components.fields.PinTextColor import com.tangem.features.hotwallet.accesscode.ACCESS_CODE_LENGTH internal data class AccessCodeUM( val accessCode: String, + val accessCodeColor: PinTextColor, val onAccessCodeChange: (String) -> Unit, val isConfirmMode: Boolean, val buttonEnabled: Boolean, diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/ui/AccessCode.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/ui/AccessCode.kt index 4596985307..87161aa57b 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/ui/AccessCode.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/accesscode/ui/AccessCode.kt @@ -76,7 +76,7 @@ internal fun AccessCode(state: AccessCodeUM, modifier: Modifier = Modifier) { length = state.accessCodeLength, isPasswordVisual = state.isConfirmMode, value = state.accessCode, - pinTextColor = PinTextColor.Primary, + pinTextColor = state.accessCodeColor, onValueChange = state.onAccessCodeChange, ) } @@ -109,6 +109,7 @@ private fun PreviewSet() { AccessCode( state = AccessCodeUM( accessCode = "", + accessCodeColor = PinTextColor.Primary, onAccessCodeChange = {}, isConfirmMode = false, buttonEnabled = false, @@ -127,6 +128,7 @@ private fun PreviewConfirm() { AccessCode( state = AccessCodeUM( accessCode = "123456", + accessCodeColor = PinTextColor.Success, onAccessCodeChange = {}, isConfirmMode = true, buttonEnabled = true,