Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AND-8690 Delete InitBackup step #3528

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,14 @@ private fun handleWalletAction(action: Action) {
BackupService.State.FinalizingPrimaryCard -> BackupAction.PrepareToWritePrimaryCard
is BackupService.State.FinalizingBackupCard -> BackupAction.PrepareToWriteBackupCard(backupState.index)
else -> {
if (onboardingWalletState.backupState.backupStep == BackupStep.InitBackup ||
if (onboardingWalletState.backupState.backupStep == null ||
onboardingWalletState.backupState.backupStep == BackupStep.InitBackup ||
onboardingWalletState.backupState.backupStep == BackupStep.Finished
) {
Analytics.send(Onboarding.Backup.ScreenOpened())
BackupAction.IntroduceBackup

val isWallet2 = scanResponse?.cardTypesResolver?.isWallet2() ?: false
if (isWallet2) BackupAction.StartBackup else BackupAction.IntroduceBackup
} else {
null
}
Expand Down Expand Up @@ -520,8 +523,8 @@ private fun handleBackupAction(appState: () -> AppState?, action: BackupAction)
}
is CompletionResult.Failure -> Unit
}
tangemSdkManager.clearProductType()
}
tangemSdkManager.clearProductType()
}
is BackupAction.WriteBackupCard -> {
val cardIndex = if (action.cardNumber > 0) action.cardNumber - 1 else action.cardNumber
Expand Down Expand Up @@ -557,8 +560,9 @@ private fun handleBackupAction(appState: () -> AppState?, action: BackupAction)
}
}
}

tangemSdkManager.clearProductType()
}
tangemSdkManager.clearProductType()
}
is BackupAction.DiscardBackup -> {
backupService.discardSavedBackup()
Expand Down Expand Up @@ -679,7 +683,7 @@ internal fun gatherCardIds(backupState: BackupState, card: CardDTO?): List<Strin

private fun handleOnBackPressed(state: OnboardingWalletState) {
when (state.backupState.backupStep) {
BackupStep.InitBackup, BackupStep.ScanOriginCard, BackupStep.AddBackupCards, BackupStep.EnterAccessCode,
null, BackupStep.InitBackup, BackupStep.ScanOriginCard, BackupStep.AddBackupCards, BackupStep.EnterAccessCode,
BackupStep.ReenterAccessCode, BackupStep.SetAccessCode, BackupStep.WritePrimaryCard,
-> {
showInterruptOnboardingDialog()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,28 @@ private object OnboardingWallet2Reducer {
}

private object BackupReducer {
@Suppress("ComplexMethod")
@Suppress("ComplexMethod", "LongMethod")
fun reduce(action: BackupAction, state: BackupState): BackupState {
return when (action) {
is BackupAction.IntroduceBackup -> BackupState(
backupStep = BackupStep.InitBackup,
maxBackupCards = 2,
canSkipBackup = state.canSkipBackup,
)
BackupAction.StartAddingPrimaryCard -> state.copy(backupStep = BackupStep.ScanOriginCard)
BackupAction.StartAddingBackupCards -> state.copy(backupStep = BackupStep.AddBackupCards)
BackupAction.StartAddingPrimaryCard -> {
state.copy(
backupStep = BackupStep.ScanOriginCard,
maxBackupCards = 2,
canSkipBackup = state.canSkipBackup,
)
}
BackupAction.StartAddingBackupCards -> {
state.copy(
backupStep = BackupStep.AddBackupCards,
maxBackupCards = 2,
canSkipBackup = state.canSkipBackup,
)
}
is BackupAction.AddBackupCard.Success -> {
state.copy(
backupCards = state.backupCards + action.card,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ data class OnboardingWalletState(
OnboardingWalletStep.CreateWallet -> 1
OnboardingWalletStep.Backup -> {
when (backupState.backupStep) {
null -> 2
BackupStep.InitBackup -> 2
BackupStep.ScanOriginCard -> 3
BackupStep.AddBackupCards -> 4
Expand Down Expand Up @@ -74,7 +75,7 @@ data class BackupState(
val backupCardsArtworks: Map<CardId, Bitmap> = emptyMap(),
val accessCode: String = "",
val accessCodeError: AccessCodeError? = null,
val backupStep: BackupStep = BackupStep.InitBackup,
val backupStep: BackupStep? = null,
val maxBackupCards: Int = 2,
val canSkipBackup: Boolean = true,
val isInterruptedBackup: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ class OnboardingWalletFragment :

private fun setBackupState(state: BackupState) {
when (state.backupStep) {
null -> Unit
BackupStep.InitBackup -> showBackupIntro(state)
BackupStep.ScanOriginCard -> showScanOriginCard()
BackupStep.AddBackupCards -> showAddBackupCards(state)
Expand Down Expand Up @@ -454,7 +455,7 @@ class OnboardingWalletFragment :
} else {
val cardIdFormatter = CardIdFormatter(CardIdDisplayFormat.LastMasked(4))
getString(
R.string.onboarding_subtitle_scan_primary_card_format,
R.string.onboarding_subtitle_scan_backup_card_format,
state.primaryCardId?.let { cardIdFormatter.getFormattedCardId(it) },
)
}
Expand Down
2 changes: 1 addition & 1 deletion core/res/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@
<string name="reset_card_to_factory_condition_2">Je comprends que je ne peux pas utiliser cette carte pour récupérer mon code d\'accès sur les autres cartes du portefeuille actuel</string>
<string name="reset_card_with_backup_to_factory_message">La réinitialisation aux paramètres d\'usine supprimera complètement le portefeuille de la carte sélectionnée. Vous ne pourrez pas restaurer le portefeuille actuel ni utiliser la carte pour récupérer le code d\'accès.</string>
<string name="reset_card_without_backup_to_factory_message">La réinitialisation aux paramètres d\'usine supprimera complètement le portefeuille de la carte sélectionnée et le supprimera de l\'application. Vous ne pourrez pas restaurer le portefeuille actuel.</string>
<string name="ring_promo_text">Les propriétaires du Tangem Ring bénéficient de 3 échanges sans commission sur Changelly jusqu\'au 15/11 !</string>
<string name="ring_promo_text">Les propriétaires du Tangem Ring ont droit à 3 swap gratis sur Changelly jusqu\'au 15/11 !</string>
<string name="ring_promo_title">Échangez avec 0 %% de frais maintenant!</string>
<string name="russian_bank_card_warning_subtitle">Avez-vous une carte bancaire d\'un autre pays et un permis de séjour ou une inscription en dehors de la Fédération de Russie ?</string>
<string name="russian_bank_card_warning_title">Les cartes bancaires russes ne sont actuellement pas acceptées</string>
Expand Down
6 changes: 3 additions & 3 deletions core/res/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<string name="card_settings_action_sheet_reset">Сбросить</string>
<string name="card_settings_action_sheet_title">Вы уверены, что хотите это сделать?</string>
<string name="card_settings_change_access_code">Смена кода доступа</string>
<string name="card_settings_change_access_code_footer">Код доступа будет изменен только на данной карте</string>
<string name="card_settings_change_access_code_footer">Код доступа будет изменен только на данной карте или кольце</string>
<string name="card_settings_completed_reset_alert_message">Все устройства Tangem выбранного кошелька сброшены до заводских настроек, вы можете создать новый кошелек</string>
<string name="card_settings_completed_reset_alert_title">Сброс завершён</string>
<string name="card_settings_continue_reset_alert_message">Хотите сбросить следующее устройство от этого кошелька?</string>
Expand All @@ -61,7 +61,7 @@
<string name="card_settings_interrupted_reset_alert_title">Вы сбросили не все Tangem устройства</string>
<string name="card_settings_reset_card_to_factory">Заводские настройки</string>
<string name="card_settings_security_mode">Тип безопасности</string>
<string name="card_settings_title">Настройки карты</string>
<string name="card_settings_title">Настройки устройства</string>
<string name="cardano_coin_will_be_send_with_token_description">Помимо сетевой комиссий, сеть Cardano взимает %1$s ADA при транзакции с токеном %2$s</string>
<string name="cardano_coin_will_be_send_with_token_title">Требования к транзакции Cardano</string>
<string name="cardano_insufficient_balance_to_send_token_description">Чтобы совершить транзакцию %1$s, внесите некоторую сумму ADA для покрытия сетевой комиссии и минимального значения ADA (рекомендуется 5 ADA)</string>
Expand Down Expand Up @@ -223,7 +223,7 @@
<string name="details_referral_title">Реферальная программа</string>
<string name="details_row_description_flip_to_hide">Переверните экран вашего устройства вниз, чтобы быстро скрыть и отобразить балансы</string>
<string name="details_row_subtitle_signed_hashes_format">%s хэшей</string>
<string name="details_row_title_cid">Номер карты</string>
<string name="details_row_title_cid">Номер устройства</string>
<string name="details_row_title_contact_to_support">Обратиться в поддержку</string>
<string name="details_row_title_create_backup">Добавить еще карты</string>
<string name="details_row_title_currency">Валюта приложения</string>
Expand Down
6 changes: 3 additions & 3 deletions core/res/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<string name="card_settings_action_sheet_reset">Reset</string>
<string name="card_settings_action_sheet_title">Are you sure you want to do this?</string>
<string name="card_settings_change_access_code">Change Access Code</string>
<string name="card_settings_change_access_code_footer">Access code will be changed on this card only</string>
<string name="card_settings_change_access_code_footer">Access code will be changed on this card or ring only</string>
<string name="card_settings_completed_reset_alert_message">All Tangem devices in the selected wallet have been reset to factory settings. You can now create a new wallet.</string>
<string name="card_settings_completed_reset_alert_title">Reset complete</string>
<string name="card_settings_continue_reset_alert_message">Do you want to reset the next device in this wallet?</string>
Expand All @@ -59,7 +59,7 @@
<string name="card_settings_interrupted_reset_alert_title">You haven\'t reset all your Tangem devices</string>
<string name="card_settings_reset_card_to_factory">Reset to Factory Settings</string>
<string name="card_settings_security_mode">Security Mode</string>
<string name="card_settings_title">Card settings</string>
<string name="card_settings_title">Device settings</string>
<string name="cardano_coin_will_be_send_with_token_description">In addition to network fee, the Cardano network charges %1$s ADA when transacting with the %2$s token</string>
<string name="cardano_coin_will_be_send_with_token_title">Cardano transaction requirements</string>
<string name="cardano_insufficient_balance_to_send_token_description">To make a %1$s transaction, you must deposit some ADA to cover the network fee and minimum ADA value (5 ADA recommended)</string>
Expand Down Expand Up @@ -219,7 +219,7 @@
<string name="details_referral_title">Referral program</string>
<string name="details_row_description_flip_to_hide">Flip your device screen down to quickly hide and show balances</string>
<string name="details_row_subtitle_signed_hashes_format">%s hashes</string>
<string name="details_row_title_cid">Card ID</string>
<string name="details_row_title_cid">Device ID</string>
<string name="details_row_title_contact_to_support">Contact support</string>
<string name="details_row_title_create_backup">Link More Cards</string>
<string name="details_row_title_currency">App Currency</string>
Expand Down
2 changes: 1 addition & 1 deletion gradle/dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ markdownComposeView = "0.5.4"
# region Tangem
tangemBlockchainSdk = "release-app_5.16-813"
#tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds
tangemCardSdk = "release-app_5.16-389"
tangemCardSdk = "release-app_5.16-390"
#tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^
tangemVico = "2.0.0-alpha.25-tangem17"
#tangemVico = "0.0.1" # Keep it! - used for local builds ^
Expand Down
Loading