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 0b02428769..9c9ea5d91d 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 @@ -103,30 +103,6 @@ internal class WalletSettingsModel @Inject constructor( ), ) - private val makeBackupAtFirstAlertBS - get() = bottomSheetMessage { - infoBlock { - icon(R.drawable.ic_passcode_lock_32) { - type = MessageBottomSheetUMV2.Icon.Type.Accent - backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint - } - title = resourceReference(R.string.hw_backup_need_title) - body = resourceReference(R.string.hw_backup_need_description) - } - primaryButton { - text = resourceReference(R.string.hw_backup_need_action) - onClick { - router.push( - AppRoute.CreateWalletBackup( - userWalletId = params.userWalletId, - isUpgradeFlow = false, - ), - ) - closeBs() - } - } - } - init { getUserWalletUseCase.invoke(params.userWalletId).onRight { analyticsContextProxy.addContext(it) @@ -366,7 +342,7 @@ internal class WalletSettingsModel @Inject constructor( private fun onAccessCodeClick() { if (!state.value.isWalletBackedUp) { - messageSender.send(makeBackupAtFirstAlertBS) + showMakeBackupAtFirstAlertBS(isUpgradeFlow = false) } else { unlockWalletIfNeedAndProceed { router.push(AppRoute.UpdateAccessCode(params.userWalletId)) @@ -375,12 +351,12 @@ internal class WalletSettingsModel @Inject constructor( } private fun onUpgradeWalletClick() { - unlockWalletIfNeedAndProceed { - router.push( - AppRoute.UpgradeWallet( - userWalletId = params.userWalletId, - ), - ) + if (!state.value.isWalletBackedUp) { + showMakeBackupAtFirstAlertBS(isUpgradeFlow = true) + } else { + unlockWalletIfNeedAndProceed { + router.push(AppRoute.UpgradeWallet(userWalletId = params.userWalletId)) + } } } @@ -390,6 +366,32 @@ internal class WalletSettingsModel @Inject constructor( } } + private fun showMakeBackupAtFirstAlertBS(isUpgradeFlow: Boolean) { + val message = bottomSheetMessage { + infoBlock { + icon(R.drawable.ic_passcode_lock_32) { + type = MessageBottomSheetUMV2.Icon.Type.Accent + backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint + } + title = resourceReference(R.string.hw_backup_need_title) + body = resourceReference(R.string.hw_backup_need_description) + } + primaryButton { + text = resourceReference(R.string.hw_backup_need_action) + onClick { + router.push( + AppRoute.CreateWalletBackup( + userWalletId = params.userWalletId, + isUpgradeFlow = isUpgradeFlow, + ), + ) + closeBs() + } + } + } + messageSender.send(message) + } + private fun unlockWalletIfNeedAndProceed(action: () -> Unit) { val userWallet = getUserWalletUseCase(params.userWalletId) .getOrElse { error("User wallet with id ${params.userWalletId} not found") } diff --git a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/ui/WalletSettingsScreen.kt b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/ui/WalletSettingsScreen.kt index 4e33a73d35..3ddb2e4aa9 100644 --- a/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/ui/WalletSettingsScreen.kt +++ b/features/wallet-settings/impl/src/main/kotlin/com/tangem/feature/walletsettings/ui/WalletSettingsScreen.kt @@ -262,6 +262,7 @@ private fun UpgradeWalletBlock(model: WalletSettingsItemUM.UpgradeWallet, modifi iconSize = 36.dp, onClick = model.onClick, onCloseClick = model.onDismissClick, + shouldShowArrowIcon = false, ), modifier = modifier, )