Updated on 2026-08-14

This commit is contained in:
Tangem 2024-12-31 20:27:55 +03:00
parent 504a49949a
commit 31326ebe59
9 changed files with 66 additions and 19 deletions

View file

@ -28,6 +28,8 @@ internal sealed interface WalletAlertState {
abstract val errorTextProvider: (String) -> TextReference?
}
data class SimpleOkAlert(val message: TextReference, val onOkClick: () -> Unit) : WalletAlertState
data class DefaultAlert(
override val title: TextReference?,
override val message: TextReference,

View file

@ -16,6 +16,19 @@ internal fun WalletAlert(state: WalletAlertState, onDismiss: () -> Unit) {
when (state) {
is WalletAlertState.Basic -> BasicAlert(state, onDismiss)
is WalletAlertState.TextInput -> TextInputAlert(state, onDismiss)
is WalletAlertState.SimpleOkAlert -> {
BasicDialog(
message = state.message.resolveReference(),
confirmButton = DialogButtonUM(
onClick = {
state.onOkClick()
onDismiss()
},
),
onDismissDialog = onDismiss,
isDismissable = false,
)
}
}
}

View file

@ -293,11 +293,22 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
analyticsEventHandler.send(MainScreen.NoticeSeedPhraseSupportButtonYes)
viewModelScope.launch {
seedPhraseNotificationUseCase.confirm(userWalletId = userWallet.walletId)
walletEventSender.send(
event = WalletEvent.ShowAlert(
state = WalletAlertState.SimpleOkAlert(
message = resourceReference(R.string.warning_seedphrase_issue_answer_yes),
onOkClick = {
viewModelScope.launch {
seedPhraseNotificationUseCase.confirm(userWalletId = userWallet.walletId)
urlOpener.openUrl(url = TangemBlogUrlBuilder.build(post = TangemBlogUrlBuilder.Post.SeedNotify))
}
urlOpener.openUrl(
url = TangemBlogUrlBuilder.build(post = TangemBlogUrlBuilder.Post.SeedNotify),
)
}
},
),
),
)
}
override fun onSeedPhraseNotificationDecline() {
@ -305,9 +316,18 @@ internal class WalletWarningsClickIntentsImplementor @Inject constructor(
analyticsEventHandler.send(MainScreen.NoticeSeedPhraseSupportButtonNo)
viewModelScope.launch {
seedPhraseNotificationUseCase.decline(userWalletId = userWallet.walletId)
}
walletEventSender.send(
event = WalletEvent.ShowAlert(
state = WalletAlertState.SimpleOkAlert(
message = resourceReference(R.string.warning_seedphrase_issue_answer_no),
onOkClick = {
viewModelScope.launch {
seedPhraseNotificationUseCase.decline(userWalletId = userWallet.walletId)
}
},
),
),
)
}
private fun getSelectedUserWallet(): UserWallet? {