Updated on 2026-08-14

This commit is contained in:
Tangem 2022-12-11 10:26:15 +03:00
parent 351671604a
commit 51ed623916
11 changed files with 48 additions and 56 deletions

View file

@ -246,7 +246,7 @@ class DetailsMiddleware {
Timber.e(error, "Wallet saving failed")
}
.doOnSuccess {
preferencesStorage.shouldShowSaveWallet = false
preferencesStorage.shouldShowSaveUserWalletScreen = false
preferencesStorage.shouldSaveUserWallets = true
store.dispatchOnMain(
DetailsAction.AppSettings.SwitchPrivacySetting.Success(

View file

@ -11,7 +11,6 @@ import com.tangem.tap.preferencesStorage
import com.tangem.tap.scope
import com.tangem.tap.store
import com.tangem.tap.tangemSdkManager
import com.tangem.tap.userWalletsListManager
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
@ -56,8 +55,7 @@ class OnboardingHelper {
backupCardsIds: List<String>? = null,
) {
when {
userWalletsListManager.hasSavedUserWallets -> scope.launch {
delay(timeMillis = 1_200)
preferencesStorage.shouldSaveUserWallets -> scope.launch {
store.dispatchOnMain(
SaveWalletAction.ProvideBackupInfo(
scanResponse = scanResponse,
@ -68,7 +66,7 @@ class OnboardingHelper {
store.dispatchOnMain(SaveWalletAction.Save)
}
tangemSdkManager.canUseBiometry &&
preferencesStorage.shouldShowSaveWallet -> scope.launch {
preferencesStorage.shouldShowSaveUserWalletScreen -> scope.launch {
delay(timeMillis = 1_200)
store.dispatchOnMain(
SaveWalletAction.ProvideBackupInfo(

View file

@ -82,7 +82,7 @@ internal class SaveWalletMiddleware {
val isFirstSavedWallet = !userWalletsListManager.hasSavedUserWallets
saveAccessCodeIfNeeded(state.backupInfo?.accessCode, userWallet.cardsInWallet)
.flatMap { userWalletsListManager.save(userWallet) }
.flatMap { userWalletsListManager.save(userWallet, canOverride = true) }
.doOnFailure { error ->
store.dispatchOnMain(SaveWalletAction.Save.Error(error))
}
@ -109,7 +109,7 @@ internal class SaveWalletMiddleware {
}
private fun saveWalletWasShown() {
preferencesStorage.shouldShowSaveWallet = false
preferencesStorage.shouldShowSaveUserWalletScreen = false
}
private suspend fun saveAccessCodeIfNeeded(

View file

@ -286,7 +286,7 @@ class TokensMiddleware {
)
scope.launch {
userWalletsListManager.update(updatedUserWallet)
userWalletsListManager.save(updatedUserWallet, canOverride = true)
.flatMap {
walletCurrenciesManager.addCurrencies(
userWallet = updatedUserWallet,

View file

@ -189,7 +189,7 @@ class MultiWalletMiddleware {
scanResponse = scanResponse,
)
userWalletsListManager.update(userWallet)
userWalletsListManager.save(userWallet, canOverride = true)
.doOnSuccess {
store.state.globalState.tapWalletManager.loadData(userWallet, refresh = true)
}

View file

@ -338,7 +338,7 @@ class WalletMiddleware {
}
private fun showSaveWalletIfNeeded() {
if (preferencesStorage.shouldShowSaveWallet
if (preferencesStorage.shouldShowSaveUserWalletScreen
&& tangemSdkManager.canUseBiometry
&& store.state.navigationState.backStack.lastOrNull() == AppScreen.Wallet
) {

View file

@ -168,7 +168,7 @@ internal class WalletSelectorMiddleware {
scope.launch {
userWalletsListManager.get(walletId = UserWalletId(walletId))
.map { it.copy(name = newName) }
.flatMap { userWalletsListManager.update(it) }
.flatMap { userWalletsListManager.save(it, canOverride = true) }
.doOnFailure { error ->
store.dispatchOnMain(WalletSelectorAction.HandleError(error))
}