From 7ff42274432a2a3174693376cfca88e85baae71f Mon Sep 17 00:00:00 2001 From: Tangem Date: Fri, 14 Nov 2025 21:32:29 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../tangem/tap/routing/utils/ChildFactory.kt | 1 + .../com/tangem/common/routing/AppRoute.kt | 1 + .../hotwallet/UpdateAccessCodeComponent.kt | 5 ++++- .../entry/AddExistingWalletModel.kt | 2 +- .../MobileWalletSetupFinishedComponent.kt | 2 +- .../MobileWalletSetupFinishedModel.kt | 2 +- .../entity/MobileWalletSetupFinishedUM.kt | 2 +- .../ui/MobileWalletSetupFinishedContent.kt | 8 ++++---- .../UpdateAccessCodeContent.kt | 19 ++++++++++++++----- .../updateaccesscode/UpdateAccessCodeModel.kt | 15 ++++++++++++++- .../routing/UpdateAccessCodeChildFactory.kt | 7 +++++++ .../routing/UpdateAccessCodeRoute.kt | 3 +++ .../entry/WalletActivationModel.kt | 2 +- .../model/WalletSettingsModel.kt | 15 ++++++++++----- 14 files changed, 63 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt b/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt index 1667f76bb9..38034af856 100644 --- a/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt +++ b/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt @@ -570,6 +570,7 @@ internal class ChildFactory @Inject constructor( context = context, params = UpdateAccessCodeComponent.Params( userWalletId = route.userWalletId, + isFirstSetup = route.isFirstSetup, ), componentFactory = updateAccessCodeComponentFactory, ) diff --git a/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt b/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt index a2fc481786..3d827e8a0a 100644 --- a/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt +++ b/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt @@ -369,6 +369,7 @@ sealed class AppRoute(val path: String) : Route { @Serializable data class UpdateAccessCode( val userWalletId: UserWalletId, + val isFirstSetup: Boolean, ) : AppRoute(path = "/update_access_code/${userWalletId.stringValue}") @Serializable diff --git a/features/hot-wallet/api/src/main/kotlin/com/tangem/features/hotwallet/UpdateAccessCodeComponent.kt b/features/hot-wallet/api/src/main/kotlin/com/tangem/features/hotwallet/UpdateAccessCodeComponent.kt index b2416c8d0a..66b0babfe2 100644 --- a/features/hot-wallet/api/src/main/kotlin/com/tangem/features/hotwallet/UpdateAccessCodeComponent.kt +++ b/features/hot-wallet/api/src/main/kotlin/com/tangem/features/hotwallet/UpdateAccessCodeComponent.kt @@ -5,6 +5,9 @@ import com.tangem.core.ui.decompose.ComposableContentComponent import com.tangem.domain.models.wallet.UserWalletId interface UpdateAccessCodeComponent : ComposableContentComponent { - data class Params(val userWalletId: UserWalletId) + data class Params( + val userWalletId: UserWalletId, + val isFirstSetup: Boolean, + ) interface Factory : ComponentFactory } \ No newline at end of file diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/entry/AddExistingWalletModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/entry/AddExistingWalletModel.kt index c1abf8b0fe..1d3c4a2762 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/entry/AddExistingWalletModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/addexistingwallet/entry/AddExistingWalletModel.kt @@ -150,7 +150,7 @@ internal class AddExistingWalletModel @Inject constructor( inner class MobileWalletSetupFinishedComponentModelCallbacks : MobileWalletSetupFinishedComponent.ModelCallbacks { - override fun onContinueClick() { + override fun onFinishClick() { router.replaceAll(AppRoute.Wallet) } } diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/MobileWalletSetupFinishedComponent.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/MobileWalletSetupFinishedComponent.kt index 21756c5932..73904619cc 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/MobileWalletSetupFinishedComponent.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/MobileWalletSetupFinishedComponent.kt @@ -27,7 +27,7 @@ internal class MobileWalletSetupFinishedComponent @AssistedInject constructor( } interface ModelCallbacks { - fun onContinueClick() + fun onFinishClick() } data class Params( diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/MobileWalletSetupFinishedModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/MobileWalletSetupFinishedModel.kt index d94e79c3ce..4785e8f5c9 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/MobileWalletSetupFinishedModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/MobileWalletSetupFinishedModel.kt @@ -20,7 +20,7 @@ internal class MobileWalletSetupFinishedModel @Inject constructor( internal val uiState: StateFlow field = MutableStateFlow( MobileWalletSetupFinishedUM( - onContinueClick = params.callbacks::onContinueClick, + onFinishClick = params.callbacks::onFinishClick, ), ) } \ No newline at end of file diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/entity/MobileWalletSetupFinishedUM.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/entity/MobileWalletSetupFinishedUM.kt index f33462eaf9..6544116b56 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/entity/MobileWalletSetupFinishedUM.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/entity/MobileWalletSetupFinishedUM.kt @@ -1,5 +1,5 @@ package com.tangem.features.hotwallet.setupfinished.entity internal data class MobileWalletSetupFinishedUM( - val onContinueClick: () -> Unit, + val onFinishClick: () -> Unit, ) \ No newline at end of file diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/ui/MobileWalletSetupFinishedContent.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/ui/MobileWalletSetupFinishedContent.kt index 312e9b93e2..b7ede36d29 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/ui/MobileWalletSetupFinishedContent.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/setupfinished/ui/MobileWalletSetupFinishedContent.kt @@ -70,7 +70,7 @@ internal fun MobileWalletSetupFinishedContent(state: MobileWalletSetupFinishedUM top = 12.dp, end = 48.dp, ), - text = stringResourceSafe(R.string.backup_complete_description), + text = stringResourceSafe(R.string.onboarding_done_wallet), style = TangemTheme.typography.body1, color = TangemTheme.colors.text.secondary, textAlign = TextAlign.Center, @@ -78,10 +78,10 @@ internal fun MobileWalletSetupFinishedContent(state: MobileWalletSetupFinishedUM Spacer(modifier = Modifier.weight(2f)) PrimaryButton( modifier = Modifier.fillMaxWidth(), - text = stringResourceSafe(R.string.common_continue), + text = stringResourceSafe(R.string.common_finish), showProgress = false, enabled = true, - onClick = state.onContinueClick, + onClick = state.onFinishClick, ) } @@ -112,7 +112,7 @@ private fun PreviewMobileWalletSetupFinishedContent() { TangemThemePreview { MobileWalletSetupFinishedContent( state = MobileWalletSetupFinishedUM( - onContinueClick = {}, + onFinishClick = {}, ), ) } diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/UpdateAccessCodeContent.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/UpdateAccessCodeContent.kt index e8f3c4a40d..5ff0f472db 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/UpdateAccessCodeContent.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/UpdateAccessCodeContent.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.imePadding import androidx.compose.foundation.layout.systemBarsPadding import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import com.arkivanov.decompose.extensions.compose.stack.Children import com.arkivanov.decompose.extensions.compose.stack.animation.slide @@ -31,11 +32,19 @@ internal fun SetAccessCodeContent( .imePadding() .systemBarsPadding(), ) { - TangemTopAppBar( - modifier = Modifier, - title = stringResourceSafe(R.string.access_code_navtitle), - startButton = TopAppBarButtonUM.Back(onBackClick), - ) + if (stackState.active.configuration is UpdateAccessCodeRoute.SetupFinished) { + TangemTopAppBar( + modifier = Modifier, + title = stringResourceSafe(R.string.access_code_navtitle), + titleAlignment = Alignment.CenterHorizontally, + ) + } else { + TangemTopAppBar( + modifier = Modifier, + title = stringResourceSafe(R.string.access_code_navtitle), + startButton = TopAppBarButtonUM.Back(onBackClick), + ) + } Children( stack = stackState, animation = stackAnimation(slide()), diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/UpdateAccessCodeModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/UpdateAccessCodeModel.kt index 5cf4e05649..5195793635 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/UpdateAccessCodeModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/UpdateAccessCodeModel.kt @@ -11,6 +11,7 @@ import com.tangem.domain.models.wallet.UserWalletId import com.tangem.features.hotwallet.UpdateAccessCodeComponent import com.tangem.features.hotwallet.updateaccesscode.routing.UpdateAccessCodeRoute import com.tangem.features.hotwallet.accesscode.AccessCodeComponent +import com.tangem.features.hotwallet.setupfinished.MobileWalletSetupFinishedComponent import com.tangem.utils.coroutines.CoroutineDispatcherProvider import kotlinx.coroutines.flow.MutableStateFlow import javax.inject.Inject @@ -27,11 +28,13 @@ internal class UpdateAccessCodeModel @Inject constructor( val stackNavigation = StackNavigation() val startRoute: UpdateAccessCodeRoute = UpdateAccessCodeRoute.SetAccessCode(params.userWalletId) val currentRoute: MutableStateFlow = MutableStateFlow(startRoute) + val mobileWalletSetupFinishedComponentModelCallbacks = MobileWalletSetupFinishedComponentModelCallbacks() fun onChildBack() { when (currentRoute.value) { is UpdateAccessCodeRoute.SetAccessCode -> router.pop() is UpdateAccessCodeRoute.ConfirmAccessCode -> stackNavigation.pop() + is UpdateAccessCodeRoute.SetupFinished -> Unit } } @@ -40,6 +43,16 @@ internal class UpdateAccessCodeModel @Inject constructor( } override fun onAccessCodeUpdated(userWalletId: UserWalletId) { - router.pop() + if (params.isFirstSetup) { + stackNavigation.push(UpdateAccessCodeRoute.SetupFinished) + } else { + router.pop() + } + } + + inner class MobileWalletSetupFinishedComponentModelCallbacks : MobileWalletSetupFinishedComponent.ModelCallbacks { + override fun onFinishClick() { + router.pop() + } } } \ No newline at end of file diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/routing/UpdateAccessCodeChildFactory.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/routing/UpdateAccessCodeChildFactory.kt index 968560b8b3..cad1c55a0e 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/routing/UpdateAccessCodeChildFactory.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/routing/UpdateAccessCodeChildFactory.kt @@ -4,6 +4,7 @@ import com.tangem.core.decompose.context.AppComponentContext import com.tangem.core.ui.decompose.ComposableContentComponent import com.tangem.features.hotwallet.updateaccesscode.UpdateAccessCodeModel import com.tangem.features.hotwallet.accesscode.AccessCodeComponent +import com.tangem.features.hotwallet.setupfinished.MobileWalletSetupFinishedComponent import javax.inject.Inject internal class UpdateAccessCodeChildFactory @Inject constructor( @@ -31,6 +32,12 @@ internal class UpdateAccessCodeChildFactory @Inject constructor( callbacks = model, ), ) + is UpdateAccessCodeRoute.SetupFinished -> MobileWalletSetupFinishedComponent( + context = childContext, + params = MobileWalletSetupFinishedComponent.Params( + callbacks = model.mobileWalletSetupFinishedComponentModelCallbacks, + ), + ) } } } \ No newline at end of file diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/routing/UpdateAccessCodeRoute.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/routing/UpdateAccessCodeRoute.kt index 31d9113158..75c71e79fb 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/routing/UpdateAccessCodeRoute.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/updateaccesscode/routing/UpdateAccessCodeRoute.kt @@ -16,4 +16,7 @@ internal sealed class UpdateAccessCodeRoute : Route { val userWalletId: UserWalletId, val accessCode: String, ) : UpdateAccessCodeRoute() + + @Serializable + data object SetupFinished : UpdateAccessCodeRoute() } \ No newline at end of file diff --git a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletactivation/entry/WalletActivationModel.kt b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletactivation/entry/WalletActivationModel.kt index 71fc8bb713..dcbec9f6f5 100644 --- a/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletactivation/entry/WalletActivationModel.kt +++ b/features/hot-wallet/impl/src/main/kotlin/com/tangem/features/hotwallet/walletactivation/entry/WalletActivationModel.kt @@ -176,7 +176,7 @@ internal class WalletActivationModel @Inject constructor( } inner class MobileWalletSetupFinishedModelCallbacks : MobileWalletSetupFinishedComponent.ModelCallbacks { - override fun onContinueClick() { + override fun onFinishClick() { router.pop() } } diff --git a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt index b442bd86a7..cec439982b 100644 --- a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt +++ b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/model/WalletSettingsModel.kt @@ -361,8 +361,13 @@ internal class WalletSettingsModel @Inject constructor( if (!state.value.isWalletBackedUp) { showMakeBackupAtFirstAlertBS(isUpgradeFlow = false) } else { - unlockWalletIfNeedAndProceed { - router.push(AppRoute.UpdateAccessCode(params.userWalletId)) + unlockWalletIfNeedAndProceed { authorizationRequired -> + router.push( + route = AppRoute.UpdateAccessCode( + userWalletId = params.userWalletId, + isFirstSetup = !authorizationRequired, + ), + ) } } } @@ -409,14 +414,14 @@ internal class WalletSettingsModel @Inject constructor( messageSender.send(message) } - private fun unlockWalletIfNeedAndProceed(action: () -> Unit) { + private fun unlockWalletIfNeedAndProceed(action: (authorizationRequired: Boolean) -> Unit) { val userWallet = getUserWalletUseCase(params.userWalletId) .getOrElse { error("User wallet with id ${params.userWalletId} not found") } if (userWallet is UserWallet.Hot) { val hotWalletId = userWallet.hotWalletId when (hotWalletId.authType) { HotWalletId.AuthType.NoPassword -> { - action() + action(false) } HotWalletId.AuthType.Password, HotWalletId.AuthType.Biometry, @@ -426,7 +431,7 @@ internal class WalletSettingsModel @Inject constructor( Timber.e(it, "Unable to unlock wallet with id ${params.userWalletId}") } .onRight { - action() + action(true) } } }