Updated on 2026-08-14
This commit is contained in:
parent
0905bb1ad9
commit
29d94db06d
8 changed files with 65 additions and 25 deletions
|
|
@ -18,6 +18,7 @@ class SaltPayExceptionHandler {
|
|||
is SaltPayActivationError -> {
|
||||
val dialog = when (throwable) {
|
||||
is SaltPayActivationError.NoGas -> SaltPayDialog.Activation.NoGas
|
||||
is SaltPayActivationError.PutVisaCard -> SaltPayDialog.Activation.PutVisaCard
|
||||
else -> SaltPayDialog.Activation.OnError(throwable)
|
||||
}
|
||||
store.dispatchDialogShow(dialog)
|
||||
|
|
@ -28,9 +29,7 @@ class SaltPayExceptionHandler {
|
|||
val message = (throwable).customMessage
|
||||
store.dispatchDialogShow(AppDialog.SimpleOkErrorDialog(message))
|
||||
}
|
||||
else -> {
|
||||
// do nothing
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
is BlockchainSdkError -> {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.tangem.tap.features.onboarding.products.wallet.saltPay.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.tangem.tap.common.redux.global.GlobalAction
|
||||
import com.tangem.tap.store
|
||||
import com.tangem.wallet.R
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
class PutVisaCardDialog {
|
||||
companion object {
|
||||
fun create(context: Context): Dialog {
|
||||
return AlertDialog.Builder(context).apply {
|
||||
setTitle(R.string.saltpay_error_empty_backup_title)
|
||||
setMessage(R.string.saltpay_error_empty_backup_message)
|
||||
setPositiveButton(R.string.common_ok) { _, _ -> }
|
||||
setOnDismissListener {
|
||||
store.dispatch(GlobalAction.HideDialog)
|
||||
}
|
||||
setCancelable(false)
|
||||
}.create()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ import com.tangem.tap.features.onboarding.products.wallet.saltPay.message.SaltPa
|
|||
sealed class SaltPayDialog : StateDialog {
|
||||
sealed class Activation : SaltPayDialog() {
|
||||
object NoGas : SaltPayDialog()
|
||||
object PutVisaCard : SaltPayDialog()
|
||||
data class OnError(val error: SaltPayActivationError) : SaltPayDialog()
|
||||
}
|
||||
}
|
||||
|
|
@ -50,6 +50,8 @@ sealed class SaltPayActivationError(
|
|||
object ClaimTransactionFailed : SaltPayActivationError(16)
|
||||
object NotClaimed : SaltPayActivationError(17)
|
||||
|
||||
object PutVisaCard : SaltPayActivationError(18)
|
||||
|
||||
companion object {
|
||||
const val EMPTY_MESSAGE = ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.tangem.tap.domain.model.UserWallet
|
|||
import com.tangem.tap.domain.model.WalletStoreModel
|
||||
import com.tangem.tap.domain.model.builders.UserWalletBuilder
|
||||
import com.tangem.tap.domain.scanCard.ScanCardProcessor
|
||||
import com.tangem.tap.features.onboarding.products.wallet.saltPay.message.SaltPayActivationError
|
||||
import com.tangem.tap.preferencesStorage
|
||||
import com.tangem.tap.scope
|
||||
import com.tangem.tap.store
|
||||
|
|
@ -155,7 +156,15 @@ internal class WalletSelectorMiddleware {
|
|||
onFailure = { error ->
|
||||
// Rollback policy if card scanning was failed
|
||||
tangemSdkManager.setAccessCodeRequestPolicy(prevUseBiometricsForAccessCode)
|
||||
store.dispatchOnMain(WalletSelectorAction.AddWallet.Error(error))
|
||||
when {
|
||||
error is TangemSdkError.ExceptionError && error.cause is SaltPayActivationError -> {
|
||||
store.dispatchOnMain(WalletSelectorAction.AddWallet.Success)
|
||||
store.dispatchOnMain(NavigationAction.PopBackTo())
|
||||
}
|
||||
else -> {
|
||||
store.dispatchOnMain(WalletSelectorAction.AddWallet.Error(error))
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.tangem.tap.features.welcome.redux
|
||||
|
||||
import android.content.Intent
|
||||
import com.tangem.common.core.TangemSdkError
|
||||
import com.tangem.common.doOnFailure
|
||||
import com.tangem.common.doOnSuccess
|
||||
import com.tangem.domain.common.ScanResponse
|
||||
|
|
@ -12,6 +13,7 @@ import com.tangem.tap.common.redux.navigation.AppScreen
|
|||
import com.tangem.tap.common.redux.navigation.NavigationAction
|
||||
import com.tangem.tap.domain.model.builders.UserWalletBuilder
|
||||
import com.tangem.tap.domain.scanCard.ScanCardProcessor
|
||||
import com.tangem.tap.features.onboarding.products.wallet.saltPay.message.SaltPayActivationError
|
||||
import com.tangem.tap.intentHandler
|
||||
import com.tangem.tap.preferencesStorage
|
||||
import com.tangem.tap.scope
|
||||
|
|
@ -104,7 +106,14 @@ internal class WelcomeMiddleware {
|
|||
scope.launch { onCardScanned(scanResponse) }
|
||||
},
|
||||
onFailure = {
|
||||
store.dispatchOnMain(WelcomeAction.ProceedWithCard.Error(it))
|
||||
when {
|
||||
it is TangemSdkError.ExceptionError && it.cause is SaltPayActivationError -> {
|
||||
store.dispatchOnMain(WelcomeAction.ProceedWithCard.Success)
|
||||
}
|
||||
else -> {
|
||||
store.dispatchOnMain(WelcomeAction.ProceedWithCard.Error(it))
|
||||
}
|
||||
}
|
||||
},
|
||||
onWalletNotCreated = {
|
||||
store.dispatchOnMain(WelcomeAction.ProceedWithCard.Success)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue