Updated on 2026-08-14
This commit is contained in:
parent
b340fc7e33
commit
7fee3c6d3b
2 changed files with 34 additions and 31 deletions
|
|
@ -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") }
|
||||
|
|
|
|||
|
|
@ -262,6 +262,7 @@ private fun UpgradeWalletBlock(model: WalletSettingsItemUM.UpgradeWallet, modifi
|
|||
iconSize = 36.dp,
|
||||
onClick = model.onClick,
|
||||
onCloseClick = model.onDismissClick,
|
||||
shouldShowArrowIcon = false,
|
||||
),
|
||||
modifier = modifier,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue