Updated on 2026-08-14
This commit is contained in:
parent
2bb8415d4d
commit
cf5a5896d0
7 changed files with 18 additions and 32 deletions
|
|
@ -91,5 +91,5 @@ sealed class BackupAction : Action {
|
|||
object DiscardSavedBackup : BackupAction()
|
||||
object ResumeFoundUnfinishedBackup : BackupAction()
|
||||
|
||||
object ResetBackupCard : BackupAction()
|
||||
data class ResetBackupCard(val cardId: String) : BackupAction()
|
||||
}
|
||||
|
|
@ -362,12 +362,13 @@ private fun handleBackupAction(appState: () -> AppState?, action: BackupAction)
|
|||
}
|
||||
|
||||
is CompletionResult.Failure -> {
|
||||
if (result.error is TangemSdkError.BackupFailedNotEmptyWallets &&
|
||||
val error = result.error
|
||||
if (error is TangemSdkError.BackupFailedNotEmptyWallets &&
|
||||
onboardingWalletState.wallet2State != null
|
||||
) {
|
||||
store.dispatchOnMain(
|
||||
GlobalAction.ShowDialog(
|
||||
BackupDialog.ResetBackupCard,
|
||||
BackupDialog.ResetBackupCard(error.cardId),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -478,7 +479,7 @@ private fun handleBackupAction(appState: () -> AppState?, action: BackupAction)
|
|||
}
|
||||
|
||||
is BackupAction.ResetBackupCard -> {
|
||||
scope.launch { tangemSdkManager.resetToFactorySettings() }
|
||||
scope.launch { tangemSdkManager.resetToFactorySettings(action.cardId) }
|
||||
}
|
||||
|
||||
else -> Unit
|
||||
|
|
|
|||
|
|
@ -122,5 +122,5 @@ sealed class BackupDialog : StateDialog {
|
|||
object BackupInProgress : BackupDialog()
|
||||
object UnfinishedBackupFound : BackupDialog()
|
||||
object ConfirmDiscardingBackup : BackupDialog()
|
||||
object ResetBackupCard : BackupDialog()
|
||||
data class ResetBackupCard(val cardId: String) : BackupDialog()
|
||||
}
|
||||
|
|
@ -8,12 +8,12 @@ import com.tangem.tap.store
|
|||
import com.tangem.wallet.R
|
||||
|
||||
object ResetBackupCardDialog {
|
||||
fun create(context: Context): AlertDialog {
|
||||
fun create(context: Context, cardId: String): AlertDialog {
|
||||
return AlertDialog.Builder(context).apply {
|
||||
setTitle(R.string.common_warning)
|
||||
setMessage(R.string.onboarding_linking_error_card_with_wallets)
|
||||
setPositiveButton(R.string.common_continue) { _, _ ->
|
||||
store.dispatch(BackupAction.ResetBackupCard)
|
||||
store.dispatch(BackupAction.ResetBackupCard(cardId))
|
||||
}
|
||||
setNegativeButton(R.string.common_cancel) { _, _ ->
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue