Updated on 2026-08-14

This commit is contained in:
Tangem 2025-12-04 15:24:59 +02:00
parent a291a9a8c0
commit 1bae7d2277
49 changed files with 514 additions and 219 deletions

View file

@ -1,10 +0,0 @@
<?xml version="1.0" ?>
<SmellBaseline>
<ManuallySuppressedIssues/>
<CurrentIssues>
<ID>BooleanPropertyNaming:AskBiometryUM.kt$AskBiometryUM$val bottomSheetVariant: Boolean = false</ID>
<ID>BooleanPropertyNaming:AskBiometryUM.kt$AskBiometryUM$val showProgress: Boolean = false</ID>
<ID>BooleanPropertyNaming:DefaultAskBiometryComponent.kt$DefaultAskBiometryComponent$val bsShown by bsShown.collectAsStateWithLifecycle()</ID>
<ID>MultilineLambdaItParameter:AskBiometryModel.kt$AskBiometryModel${ uiMessageSender.send( SnackbarMessage(stringReference("Something went wrong. Please contact support: $it")), ) }</ID>
</CurrentIssues>
</SmellBaseline>

View file

@ -41,10 +41,10 @@ internal class DefaultAskBiometryComponent @AssistedInject constructor(
@Composable
override fun BottomSheet() {
val state by model.uiState.collectAsStateWithLifecycle()
val bsShown by bsShown.collectAsStateWithLifecycle()
val bsConfig = remember(this, bsShown) {
val isBSShown by bsShown.collectAsStateWithLifecycle()
val bsConfig = remember(this, isBSShown) {
TangemBottomSheetConfig(
isShown = bsShown,
isShown = isBSShown,
onDismissRequest = ::dismiss,
content = TangemBottomSheetConfigContent.Empty,
)

View file

@ -55,7 +55,7 @@ internal class AskBiometryModel @Inject constructor(
private val _uiState = MutableStateFlow(
AskBiometryUM(
bottomSheetVariant = params.isBottomSheetVariant,
isBottomSheetVariant = params.isBottomSheetVariant,
onAllowClick = ::onAllowClick,
onDontAllowClick = ::dontAllow,
onDismiss = ::dismiss,
@ -85,7 +85,7 @@ internal class AskBiometryModel @Inject constructor(
return@launch
}
_uiState.update { it.copy(showProgress = true) }
_uiState.update { it.copy(shouldShowProgress = true) }
/*
@ -96,7 +96,7 @@ internal class AskBiometryModel @Inject constructor(
uiMessageSender.send(
SnackbarMessage(stringReference("No selected user wallet")),
)
_uiState.update { it.copy(showProgress = false) }
_uiState.update { it.copy(shouldShowProgress = false) }
return@launch
}
@ -128,7 +128,7 @@ internal class AskBiometryModel @Inject constructor(
}
}
if (_uiState.value.bottomSheetVariant) {
if (_uiState.value.isBottomSheetVariant) {
dismissBSFlow.emit(Unit)
delay(timeMillis = 500)
}
@ -142,9 +142,9 @@ internal class AskBiometryModel @Inject constructor(
userWalletId = userWallet.walletId,
lockMethod = UserWalletsListRepository.LockMethod.Biometric,
changeUnsecured = false,
).onLeft {
).onLeft { error ->
uiMessageSender.send(
SnackbarMessage(stringReference("Something went wrong. Please contact support: $it")),
SnackbarMessage(stringReference("Something went wrong. Please contact support: $error")),
)
}
}

View file

@ -29,7 +29,7 @@ internal fun AskBiometry(state: AskBiometryUM, modifier: Modifier = Modifier) {
Column(
modifier = Modifier.weight(1f),
) {
if (state.bottomSheetVariant) {
if (state.isBottomSheetVariant) {
Header(onCloseClick = state.onDismiss)
}
@ -128,12 +128,12 @@ private fun Footer(state: AskBiometryUM, modifier: Modifier = Modifier) {
) {
PrimaryButton(
modifier = Modifier.fillMaxWidth(),
showProgress = state.showProgress,
showProgress = state.shouldShowProgress,
text = stringResourceSafe(id = R.string.save_user_wallet_agreement_allow_biometrics),
onClick = state.onAllowClick,
)
if (state.bottomSheetVariant.not()) {
if (state.isBottomSheetVariant.not()) {
SpacerH12()
SecondaryButton(
@ -199,7 +199,7 @@ private fun Preview() {
private fun PreviewBS() {
TangemThemePreview {
AskBiometry(
state = AskBiometryUM(bottomSheetVariant = true),
state = AskBiometryUM(isBottomSheetVariant = true),
)
}
}

View file

@ -3,8 +3,8 @@ package com.tangem.features.biometry.impl.ui.state
import com.tangem.core.ui.extensions.TextReference
internal data class AskBiometryUM(
val bottomSheetVariant: Boolean = false,
val showProgress: Boolean = false,
val isBottomSheetVariant: Boolean = false,
val shouldShowProgress: Boolean = false,
val error: TextReference? = null,
val onAllowClick: () -> Unit = {},
val onDontAllowClick: () -> Unit = {},