Updated on 2026-08-14

This commit is contained in:
Tangem 2022-10-27 22:03:16 +05:00
parent aae93d6613
commit c1b37e1cc5
3 changed files with 20 additions and 17 deletions

View file

@ -6,6 +6,7 @@ import android.webkit.WebView
[REDACTED_AUTHOR]
*/
fun WebView.configureSettings() {
resumeTimers()
settings.apply {
javaScriptEnabled = true
domStorageEnabled = true
@ -15,5 +16,4 @@ fun WebView.configureSettings() {
fun WebView.stop() {
stopLoading()
pauseTimers()
destroy()
}

View file

@ -7,6 +7,7 @@ import com.tangem.tap.features.onboarding.products.wallet.saltPay.SaltPayActivat
import com.tangem.tap.features.onboarding.products.wallet.saltPay.message.SaltPayActivationError
import com.tangem.tap.features.onboarding.products.wallet.saltPay.redux.SaltPayActivationStep
import com.tangem.tap.features.onboarding.products.wallet.saltPay.redux.update
import com.tangem.tap.preferencesStorage
/**
[REDACTED_AUTHOR]
@ -19,10 +20,16 @@ class OnboardingSaltPayHelper {
manager: SaltPayActivationManager,
): Result<Boolean> {
return try {
val updatedStep = manager.update(SaltPayActivationStep.None, null).successOr { return it }
val isRegistrationCase = updatedStep != SaltPayActivationStep.Finished
var updatedStep = manager.update(SaltPayActivationStep.None, null).successOr { return it }
val cardStorage = preferencesStorage.usedCardsPrefStorage
val activationIsFinished = cardStorage.isActivationFinished(scanResponse.card.cardId)
if (updatedStep == SaltPayActivationStep.Success && activationIsFinished) {
updatedStep = SaltPayActivationStep.Finished
}
val isActivationCase = updatedStep != SaltPayActivationStep.Finished
val isBackupCase = scanResponse.card.backupStatus?.isActive == false
Result.Success(isRegistrationCase || isBackupCase)
Result.Success(isActivationCase || isBackupCase)
} catch (ex: Exception) {
Result.Failure(ex)
} catch (error: SaltPayActivationError) {

View file

@ -276,12 +276,17 @@ private fun determineStep(
amountToClaim: Amount?,
response: RegistrationResponse.Item,
): SaltPayActivationStep {
fun getStepBaseOnAmountToClaim(amount: Amount?): SaltPayActivationStep = when (amount) {
null -> SaltPayActivationStep.Success
else -> SaltPayActivationStep.Claim
}
return when {
response.passed != true -> throw SaltPayActivationError.CardNotPassed(response.error)
response.disabledByAdmin == true -> throw SaltPayActivationError.CardDisabled(response.error)
// go to claim screen
response.active == true -> SaltPayActivationStep.Claim
response.active == true -> getStepBaseOnAmountToClaim(amountToClaim)
// pinSet is false, go toPin screen
response.pinSet == false -> SaltPayActivationStep.NeedPin
@ -292,10 +297,7 @@ private fun determineStep(
KYCStatus.NOT_STARTED, KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
KYCStatus.CORRECTION_REQUESTED, KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
KYCStatus.APPROVED -> when (amountToClaim) {
null -> SaltPayActivationStep.Success
else -> SaltPayActivationStep.Claim
}
KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
else -> SaltPayActivationStep.KycIntro
}
SaltPayActivationStep.KycReject -> when (response.kycStatus) {
@ -303,20 +305,14 @@ private fun determineStep(
KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
KYCStatus.CORRECTION_REQUESTED -> SaltPayActivationStep.KycStart
KYCStatus.REJECTED -> SaltPayActivationStep.KycStart
KYCStatus.APPROVED -> when (amountToClaim) {
null -> SaltPayActivationStep.Success
else -> SaltPayActivationStep.Claim
}
KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
else -> SaltPayActivationStep.KycIntro
}
else -> when (response.kycStatus) {
KYCStatus.NOT_STARTED, KYCStatus.STARTED -> SaltPayActivationStep.KycIntro
KYCStatus.WAITING_FOR_APPROVAL -> SaltPayActivationStep.KycWaiting
KYCStatus.CORRECTION_REQUESTED, KYCStatus.REJECTED -> SaltPayActivationStep.KycReject
KYCStatus.APPROVED -> when (amountToClaim) {
null -> SaltPayActivationStep.Finished
else -> SaltPayActivationStep.Claim
}
KYCStatus.APPROVED -> getStepBaseOnAmountToClaim(amountToClaim)
else -> SaltPayActivationStep.KycIntro
}
}