Updated on 2026-08-14
This commit is contained in:
parent
7355e24baa
commit
d0c4d92a8c
12 changed files with 346 additions and 0 deletions
|
|
@ -0,0 +1,33 @@
|
|||
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.feedback.SupportInfo
|
||||
import com.tangem.tap.common.redux.global.GlobalAction
|
||||
import com.tangem.tap.store
|
||||
import com.tangem.wallet.R
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
class NoFundsForActivationDialog {
|
||||
companion object {
|
||||
fun create(context: Context): Dialog {
|
||||
return AlertDialog.Builder(context).apply {
|
||||
setTitle(R.string.saltpay_error_no_gas_title)
|
||||
setMessage(R.string.saltpay_error_no_gas_message)
|
||||
//TODO: SaltPay: change onboarding_supplement_button_kyc_waiting -> to appropriate string
|
||||
setPositiveButton(R.string.onboarding_supplement_button_kyc_waiting) { _, _ ->
|
||||
store.dispatch(GlobalAction.OpenChat(SupportInfo()))
|
||||
}
|
||||
setNegativeButton(R.string.common_cancel) { _, _ ->
|
||||
}
|
||||
setOnDismissListener {
|
||||
store.dispatch(GlobalAction.HideDialog)
|
||||
}
|
||||
setCancelable(false)
|
||||
}.create()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
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.domain.moduleMessage.ConvertedDialogMessage
|
||||
import com.tangem.tap.domain.moduleMessage.saltPay.SaltPayErrorConverter
|
||||
import com.tangem.tap.store
|
||||
import com.tangem.wallet.R
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
class RegistrationErrorDialog {
|
||||
companion object {
|
||||
fun create(context: Context, dialog: SaltPayDialog.RegistrationError): Dialog {
|
||||
val convertedMessage = SaltPayErrorConverter(context).convert(dialog.error) as ConvertedDialogMessage
|
||||
|
||||
return AlertDialog.Builder(context).apply {
|
||||
setTitle(convertedMessage.title)
|
||||
setMessage(convertedMessage.message)
|
||||
setPositiveButton(R.string.common_ok) { _, _ ->
|
||||
store.dispatch(GlobalAction.HideDialog)
|
||||
}
|
||||
setOnDismissListener {
|
||||
store.dispatch(GlobalAction.HideDialog)
|
||||
}
|
||||
setCancelable(false)
|
||||
}.create()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.tangem.tap.features.onboarding.products.wallet.saltPay.dialog
|
||||
|
||||
import com.tangem.tap.common.redux.StateDialog
|
||||
import com.tangem.tap.features.onboarding.products.wallet.saltPay.message.SaltPayRegistrationError
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
sealed class SaltPayDialog : StateDialog {
|
||||
object NoFundsForActivation : SaltPayDialog()
|
||||
data class RegistrationError(val error: SaltPayRegistrationError) : SaltPayDialog()
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.tangem.tap.features.onboarding.products.wallet.saltPay.message
|
||||
|
||||
import com.tangem.common.module.ModuleError
|
||||
import com.tangem.common.module.ModuleErrorCode
|
||||
import com.tangem.common.module.ModuleMessage
|
||||
|
||||
sealed interface SaltPayModuleMessage : ModuleMessage
|
||||
|
||||
sealed class SaltPayModuleError(
|
||||
subCode: Int,
|
||||
override val message: String,
|
||||
override val data: Any? = null,
|
||||
) : SaltPayModuleMessage, ModuleError() {
|
||||
override val code: Int = ModuleErrorCode.SALT_PAY + subCode
|
||||
|
||||
companion object {
|
||||
// base code used for all errors in the module
|
||||
internal const val ERROR_CODE_REGISTRATION = 100
|
||||
// const val CODE_ANY_OTHER = 200..299, 300..399 etc
|
||||
}
|
||||
}
|
||||
|
||||
sealed class SaltPayRegistrationError(
|
||||
subCode: Int,
|
||||
message: String? = null,
|
||||
override val data: Any? = null,
|
||||
) : SaltPayModuleError(
|
||||
subCode = ERROR_CODE_REGISTRATION + subCode,
|
||||
message = message ?: this::class.java.simpleName,
|
||||
) {
|
||||
object Unknown : SaltPayRegistrationError(4)
|
||||
object Empty : SaltPayRegistrationError(4)
|
||||
object FailedToMakeTxData : SaltPayRegistrationError(1)
|
||||
object FailedToSendTx : SaltPayRegistrationError(2)
|
||||
object NeedPin : SaltPayRegistrationError(3)
|
||||
object NoGas : SaltPayRegistrationError(5)
|
||||
object EmptyResponse : SaltPayRegistrationError(6)
|
||||
object Card : SaltPayRegistrationError(7)
|
||||
object CardNotFound : SaltPayRegistrationError(8)
|
||||
object CardDisabled : SaltPayRegistrationError(9)
|
||||
object CardNotPassed : SaltPayRegistrationError(10)
|
||||
object EmptyDynamicAttestResponse : SaltPayRegistrationError(11)
|
||||
object EmptyBackupCardScanned : SaltPayRegistrationError(12)
|
||||
object WeakPin : SaltPayRegistrationError(13)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue