Updated on 2026-08-14
This commit is contained in:
parent
e074377533
commit
21997b5e9b
29 changed files with 262 additions and 119 deletions
|
|
@ -2,6 +2,7 @@ package com.tangem.tap.features.onboarding
|
|||
|
||||
import com.tangem.domain.common.ProductType
|
||||
import com.tangem.domain.common.ScanResponse
|
||||
import com.tangem.domain.common.TapWorkarounds.isSaltPay
|
||||
import com.tangem.tap.common.redux.navigation.AppScreen
|
||||
import com.tangem.tap.domain.extensions.hasWallets
|
||||
import com.tangem.tap.preferencesStorage
|
||||
|
|
@ -15,6 +16,10 @@ class OnboardingHelper {
|
|||
fun isOnboardingCase(response: ScanResponse): Boolean {
|
||||
val cardInfoStorage = preferencesStorage.usedCardsPrefStorage
|
||||
return when {
|
||||
response.card.isSaltPay -> {
|
||||
// response.card.backupStatus?.isActive != true //TODO: restore after presentation
|
||||
false
|
||||
}
|
||||
response.productType == ProductType.Twins -> {
|
||||
if (!response.twinsIsTwinned()) {
|
||||
true
|
||||
|
|
@ -38,6 +43,7 @@ class OnboardingHelper {
|
|||
AppScreen.OnboardingOther
|
||||
}
|
||||
ProductType.Twins -> AppScreen.OnboardingTwins
|
||||
ProductType.SaltPay -> AppScreen.OnboardingWallet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ sealed class OnboardingWalletAction : Action {
|
|||
object Done : OnboardingWalletAction()
|
||||
object FinishOnboarding : OnboardingWalletAction()
|
||||
|
||||
object ProceedBackup : OnboardingWalletAction()
|
||||
data class ProceedBackup(val isSaltPay: Boolean = false) : OnboardingWalletAction()
|
||||
|
||||
object LoadArtwork : OnboardingWalletAction()
|
||||
class SetArtworkUrl(val artworkUrl: String?) : OnboardingWalletAction()
|
||||
|
|
@ -21,7 +21,7 @@ sealed class OnboardingWalletAction : Action {
|
|||
sealed class BackupAction : Action {
|
||||
|
||||
object DetermineBackupStep : BackupAction()
|
||||
object IntroduceBackup : BackupAction()
|
||||
data class IntroduceBackup(val isSaltPay: Boolean = false) : BackupAction()
|
||||
object StartBackup : BackupAction()
|
||||
object DismissBackup : BackupAction()
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.tangem.blockchain.common.Blockchain
|
|||
import com.tangem.common.CompletionResult
|
||||
import com.tangem.common.card.Card
|
||||
import com.tangem.domain.common.ScanResponse
|
||||
import com.tangem.domain.common.TapWorkarounds.isSaltPay
|
||||
import com.tangem.domain.common.extensions.withMainContext
|
||||
import com.tangem.operations.backup.BackupService
|
||||
import com.tangem.tap.*
|
||||
|
|
@ -51,10 +52,10 @@ private fun handleWalletAction(action: Action) {
|
|||
OnboardingWalletAction.Init -> {
|
||||
val action = when {
|
||||
card == null -> {
|
||||
OnboardingWalletAction.ProceedBackup
|
||||
OnboardingWalletAction.ProceedBackup()
|
||||
}
|
||||
card.hasWallets() && card.backupStatus == Card.BackupStatus.NoBackup ->
|
||||
OnboardingWalletAction.ProceedBackup
|
||||
OnboardingWalletAction.ProceedBackup(card.isSaltPay)
|
||||
card.hasWallets() && card.backupStatus?.isActive == true ->
|
||||
BackupAction.FinishBackup
|
||||
else -> OnboardingWalletAction.GetToCreateWalletStep
|
||||
|
|
@ -98,7 +99,7 @@ private fun handleWalletAction(action: Action) {
|
|||
)
|
||||
)
|
||||
onboardingManager.activationStarted(updatedResponse.card.cardId)
|
||||
store.dispatch(OnboardingWalletAction.ProceedBackup)
|
||||
store.dispatch(OnboardingWalletAction.ProceedBackup())
|
||||
}
|
||||
is CompletionResult.Failure -> {
|
||||
// do nothing
|
||||
|
|
@ -120,7 +121,7 @@ private fun handleWalletAction(action: Action) {
|
|||
store.dispatchOnMain(NavigationAction.NavigateTo(AppScreen.Wallet))
|
||||
}
|
||||
}
|
||||
OnboardingWalletAction.ProceedBackup -> {
|
||||
is OnboardingWalletAction.ProceedBackup -> {
|
||||
val newAction = when (val backupState = backupService.currentState) {
|
||||
BackupService.State.FinalizingPrimaryCard -> BackupAction.PrepareToWritePrimaryCard
|
||||
is BackupService.State.FinalizingBackupCard -> BackupAction.PrepareToWriteBackupCard(backupState.index)
|
||||
|
|
@ -128,7 +129,7 @@ private fun handleWalletAction(action: Action) {
|
|||
if (walletState.backupState.backupStep == BackupStep.InitBackup ||
|
||||
walletState.backupState.backupStep == BackupStep.Finished
|
||||
) {
|
||||
BackupAction.IntroduceBackup
|
||||
BackupAction.IntroduceBackup(action.isSaltPay)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
|
@ -319,7 +320,7 @@ private fun handleBackupAction(appState: () -> AppState?, action: BackupAction)
|
|||
}
|
||||
is BackupAction.ResumeBackup -> {
|
||||
store.dispatch(GlobalAction.Onboarding.Start(null, true))
|
||||
store.dispatch(OnboardingWalletAction.ProceedBackup)
|
||||
store.dispatch(OnboardingWalletAction.ProceedBackup())
|
||||
store.dispatch(NavigationAction.NavigateTo(AppScreen.OnboardingWallet))
|
||||
}
|
||||
is BackupAction.DismissBackup -> {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class BackupReducer {
|
|||
is BackupAction.IntroduceBackup -> BackupState(
|
||||
backupStep = BackupStep.InitBackup,
|
||||
canSkipBackup = state.canSkipBackup,
|
||||
isSaltPay = action.isSaltPay,
|
||||
)
|
||||
BackupAction.StartAddingPrimaryCard -> state.copy(backupStep = BackupStep.ScanOriginCard)
|
||||
BackupAction.StartAddingBackupCards -> {
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ data class BackupState(
|
|||
val backupStep: BackupStep = BackupStep.InitBackup,
|
||||
val maxBackupCards: Int = 2,
|
||||
val canSkipBackup: Boolean = true,
|
||||
val isSaltPay: Boolean = false,
|
||||
)
|
||||
|
||||
enum class AccessCodeError {
|
||||
|
|
|
|||
|
|
@ -181,6 +181,8 @@ class OnboardingWalletFragment : Fragment(R.layout.fragment_onboarding_wallet),
|
|||
btnAlternativeAction.show(state.canSkipBackup)
|
||||
btnMainAction.setOnClickListener { store.dispatch(BackupAction.StartBackup) }
|
||||
btnAlternativeAction.setOnClickListener { store.dispatch(BackupAction.DismissBackup) }
|
||||
|
||||
btnAlternativeAction.show(!state.isSaltPay)
|
||||
}
|
||||
|
||||
startPostponedEnterTransition()
|
||||
|
|
@ -232,9 +234,9 @@ class OnboardingWalletFragment : Fragment(R.layout.fragment_onboarding_wallet),
|
|||
|
||||
when (state.backupCardsNumber) {
|
||||
0 -> {
|
||||
cardsWidget.toFan() {
|
||||
cardsWidget.getFirstBackupCardView().animate().alpha(0.6f).setDuration(200)
|
||||
cardsWidget.getSecondBackupCardView().animate().alpha(0.2f).setDuration(200)
|
||||
cardsWidget.toFan {
|
||||
cardsWidget.getFirstBackupCardView().animate().alpha(0.6f).duration = 200
|
||||
cardsWidget.getSecondBackupCardView().animate().alpha(0.2f).duration = 200
|
||||
}
|
||||
tvHeader.text = getText(R.string.onboarding_title_no_backup_cards)
|
||||
tvBody.text = getText(R.string.onboarding_subtitle_no_backup_cards)
|
||||
|
|
@ -244,7 +246,7 @@ class OnboardingWalletFragment : Fragment(R.layout.fragment_onboarding_wallet),
|
|||
tvBody.text = getText(R.string.onboarding_subtitle_one_backup_card)
|
||||
|
||||
cardsWidget.toFan(false)
|
||||
cardsWidget.getFirstBackupCardView().animate().alpha(1f).setDuration(400)
|
||||
cardsWidget.getFirstBackupCardView().animate().alpha(1f).duration = 400
|
||||
cardsWidget.getSecondBackupCardView().alpha = 0.2f
|
||||
}
|
||||
2 -> {
|
||||
|
|
@ -253,7 +255,7 @@ class OnboardingWalletFragment : Fragment(R.layout.fragment_onboarding_wallet),
|
|||
|
||||
cardsWidget.toFan(false)
|
||||
cardsWidget.getFirstBackupCardView().alpha = 1f
|
||||
cardsWidget.getSecondBackupCardView().animate().alpha(1f).setDuration(400)
|
||||
cardsWidget.getSecondBackupCardView().animate().alpha(1f).duration = 400
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -296,7 +298,7 @@ class OnboardingWalletFragment : Fragment(R.layout.fragment_onboarding_wallet),
|
|||
prepareViewForFinalizeStep()
|
||||
cardsWidget.getSecondBackupCardView().show(state.backupCardsNumber == 2)
|
||||
|
||||
cardsWidget.toLeapfrog() {
|
||||
cardsWidget.toLeapfrog {
|
||||
cardsWidget.getFirstBackupCardView().alpha = 0.6f
|
||||
cardsWidget.getSecondBackupCardView().alpha = 0.2f
|
||||
}
|
||||
|
|
@ -335,12 +337,12 @@ class OnboardingWalletFragment : Fragment(R.layout.fragment_onboarding_wallet),
|
|||
|
||||
val cardNumber = (state.backupStep as? BackupStep.WriteBackupCard)?.cardNumber ?: 1
|
||||
when (cardNumber) {
|
||||
1 -> cardsWidget.leapfrogWidget.leap() {
|
||||
1 -> cardsWidget.leapfrogWidget.leap {
|
||||
cardsWidget.getOriginCardView().alpha = 0.4f
|
||||
cardsWidget.getFirstBackupCardView().alpha = 0.2f
|
||||
cardsWidget.getSecondBackupCardView().alpha = 1f
|
||||
}
|
||||
2 -> cardsWidget.leapfrogWidget.leap() {
|
||||
2 -> cardsWidget.leapfrogWidget.leap {
|
||||
cardsWidget.getOriginCardView().alpha = 0.4f
|
||||
cardsWidget.getFirstBackupCardView().alpha = 0.2f
|
||||
cardsWidget.getSecondBackupCardView().alpha = 1f
|
||||
|
|
@ -389,8 +391,7 @@ class OnboardingWalletFragment : Fragment(R.layout.fragment_onboarding_wallet),
|
|||
imvSuccess.show()
|
||||
|
||||
imvSuccess.animate()
|
||||
?.alpha(1f)
|
||||
?.setDuration(400)
|
||||
?.alpha(1f)?.duration = 400
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue