Updated on 2026-08-14
This commit is contained in:
parent
9bcf93922c
commit
4197574fca
10 changed files with 466 additions and 18 deletions
|
|
@ -18,6 +18,7 @@ import com.tangem.core.decompose.ui.UiMessageSender
|
|||
import com.tangem.core.navigation.settings.SettingsManager
|
||||
import com.tangem.core.ui.components.bottomsheets.message.*
|
||||
import com.tangem.core.ui.extensions.resourceReference
|
||||
import com.tangem.core.ui.extensions.stringReference
|
||||
import com.tangem.core.ui.message.DialogMessage
|
||||
import com.tangem.core.ui.message.EventMessageAction
|
||||
import com.tangem.core.ui.message.SnackbarMessage
|
||||
|
|
@ -205,24 +206,7 @@ internal class WalletSettingsModel @Inject constructor(
|
|||
isNFTEnabled = isNFTEnabled,
|
||||
onCheckedNFTChange = ::onCheckedNFTChange,
|
||||
forgetWallet = {
|
||||
val message = DialogMessage(
|
||||
message = resourceReference(
|
||||
id = when (userWallet) {
|
||||
is UserWallet.Cold -> R.string.user_wallet_list_delete_prompt
|
||||
is UserWallet.Hot -> R.string.user_wallet_list_delete_hw_prompt
|
||||
},
|
||||
),
|
||||
firstActionBuilder = {
|
||||
EventMessageAction(
|
||||
title = resourceReference(R.string.common_delete),
|
||||
isWarning = true,
|
||||
onClick = ::forgetWallet,
|
||||
)
|
||||
},
|
||||
secondActionBuilder = { cancelAction() },
|
||||
)
|
||||
|
||||
messageSender.send(message)
|
||||
onForgetWalletClick(userWallet)
|
||||
},
|
||||
onLinkMoreCardsClick = {
|
||||
when (userWallet) {
|
||||
|
|
@ -403,4 +387,80 @@ internal class WalletSettingsModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO actualize strings [REDACTED_TASK_KEY] and remove MaximumLineLength
|
||||
@Suppress("LongMethod", "MaximumLineLength")
|
||||
private fun onForgetWalletClick(userWallet: UserWallet) {
|
||||
val message = when (userWallet) {
|
||||
is UserWallet.Cold -> {
|
||||
DialogMessage(
|
||||
message = resourceReference(
|
||||
id = R.string.user_wallet_list_delete_prompt,
|
||||
),
|
||||
firstActionBuilder = {
|
||||
EventMessageAction(
|
||||
title = resourceReference(R.string.common_delete),
|
||||
isWarning = true,
|
||||
onClick = ::forgetWallet,
|
||||
)
|
||||
},
|
||||
secondActionBuilder = { cancelAction() },
|
||||
)
|
||||
}
|
||||
is UserWallet.Hot -> {
|
||||
bottomSheetMessage {
|
||||
infoBlock {
|
||||
icon(R.drawable.ic_alert_circle_24) {
|
||||
type = MessageBottomSheetUMV2.Icon.Type.Warning
|
||||
backgroundType = MessageBottomSheetUMV2.Icon.BackgroundType.SameAsTint
|
||||
}
|
||||
title = stringReference("Forget this wallet?")
|
||||
body = if (userWallet.backedUp) {
|
||||
stringReference("A backup for this wallet exists. Review it before forgetting to make sure you can recover later.")
|
||||
} else {
|
||||
stringReference("If you forget this wallet without a backup, you’ll permanently lose access to your funds.")
|
||||
}
|
||||
}
|
||||
if (userWallet.backedUp) {
|
||||
secondaryButton {
|
||||
text = stringReference("Forget wallet")
|
||||
onClick {
|
||||
router.push(AppRoute.ForgetWallet(userWallet.walletId))
|
||||
closeBs()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
secondaryButton {
|
||||
text = stringReference("Forget Anyway")
|
||||
onClick {
|
||||
router.push(AppRoute.ForgetWallet(userWallet.walletId))
|
||||
closeBs()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (userWallet.backedUp) {
|
||||
primaryButton {
|
||||
text = stringReference("View backup")
|
||||
onClick {
|
||||
unlockWalletIfNeedAndProceed {
|
||||
router.push(AppRoute.ViewPhrase(userWallet.walletId))
|
||||
}
|
||||
closeBs()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
primaryButton {
|
||||
text = stringReference("Go to backup")
|
||||
onClick {
|
||||
router.push(AppRoute.CreateWalletBackup(userWallet.walletId))
|
||||
closeBs()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messageSender.send(message)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue