Updated on 2026-08-14

This commit is contained in:
Tangem 2022-10-26 10:29:56 +05:00
parent f472f69f37
commit 26ca147cf1
6 changed files with 68 additions and 25 deletions

View file

@ -1,6 +1,8 @@
package com.tangem.tap.features.onboarding.products.wallet.redux
import android.graphics.Bitmap
import com.tangem.tap.backupService
import com.tangem.tap.common.extensions.primaryCardIsSaltPay
import org.rekotlin.Action
sealed class OnboardingWalletAction : Action {
@ -69,4 +71,10 @@ sealed class BackupAction : Action {
object DiscardBackup : BackupAction()
object DiscardSavedBackup : BackupAction()
object ResumeFoundUnfinishedBackup : BackupAction()
companion object {
fun hasSaltPayUnfinishedBackup(): Boolean {
return backupService.hasIncompletedBackup && backupService.primaryCardIsSaltPay()
}
}
}

View file

@ -4,13 +4,13 @@ import com.tangem.blockchain.common.Blockchain
import com.tangem.common.CompletionResult
import com.tangem.common.card.Card
import com.tangem.common.extensions.ifNotNull
import com.tangem.domain.common.SaltPayWorkaround
import com.tangem.domain.common.ScanResponse
import com.tangem.domain.common.extensions.withMainContext
import com.tangem.operations.backup.BackupService
import com.tangem.tap.backupService
import com.tangem.tap.common.extensions.dispatchDialogShow
import com.tangem.tap.common.extensions.dispatchOnMain
import com.tangem.tap.common.extensions.primaryCardIsSaltPay
import com.tangem.tap.common.redux.AppState
import com.tangem.tap.common.redux.global.GlobalAction
import com.tangem.tap.common.redux.navigation.AppScreen
@ -344,12 +344,6 @@ private fun handleBackupAction(appState: () -> AppState?, action: BackupAction)
}
}
private fun BackupService.primaryCardIsSaltPay(): Boolean {
return primaryCardId?.slice(0..3)?.let {
SaltPayWorkaround.isVisaBatchId(it)
} ?: false
}
/**
* SaltPay state maybe not initialized if backup resumed from ResumeFoundUnfinishedBackup action
*/
@ -358,7 +352,6 @@ private fun initSaltPayOnBackupFinishedIfNeeded(
onboardingWalletState: OnboardingWalletState,
) {
if (onboardingWalletState.isSaltPay && onboardingWalletState.onboardingSaltPayState == null) {
//TODO: SaltPay: scanResponse
if (scanResponse == null) throw IllegalArgumentException()
val (manager, config) = OnboardingSaltPayState.initDependency(scanResponse)