Updated on 2026-08-14
This commit is contained in:
parent
81562fc4f9
commit
20d40e1861
1 changed files with 14 additions and 3 deletions
|
|
@ -4,7 +4,6 @@ import arrow.core.Either
|
|||
import com.tangem.blockchain.common.Blockchain
|
||||
import com.tangem.blockchain.common.Token
|
||||
import com.tangem.common.routing.AppRoute
|
||||
import com.tangem.common.routing.utils.popTo
|
||||
import com.tangem.data.tokens.utils.CryptoCurrencyFactory
|
||||
import com.tangem.domain.card.DerivePublicKeysUseCase
|
||||
import com.tangem.domain.common.util.derivationStyleProvider
|
||||
|
|
@ -126,7 +125,7 @@ internal class TokensListMigration(
|
|||
val isNothingToDoWithBlockchain = blockchainsToAdd.isEmpty() && blockchainsToRemove.isEmpty()
|
||||
if (isNothingToDoWithTokens && isNothingToDoWithBlockchain) {
|
||||
store.dispatchDebugErrorNotification(message = "Nothing to save")
|
||||
store.dispatchNavigationAction { popTo<AppRoute.Wallet>() }
|
||||
navigateToWallet()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -135,11 +134,23 @@ internal class TokensListMigration(
|
|||
derivePublicKeysUseCase(userWalletId = currentUserWallet.walletId, currencies = currencyList)
|
||||
.onRight {
|
||||
addCryptoCurrenciesUseCase(userWalletId = currentUserWallet.walletId, currencies = currencyList)
|
||||
store.dispatchNavigationAction { popTo<AppRoute.Wallet>() }
|
||||
navigateToWallet()
|
||||
}
|
||||
.onLeft { Timber.e(it, "Failed to derive public keys") }
|
||||
}
|
||||
|
||||
private fun navigateToWallet() {
|
||||
store.dispatchNavigationAction {
|
||||
val route = AppRoute.Wallet
|
||||
|
||||
if (route in stack) {
|
||||
popTo(route)
|
||||
} else {
|
||||
replaceAll(route)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun removeCurrenciesIfNeeded(userWalletId: UserWalletId, currencies: List<CryptoCurrency>) {
|
||||
if (currencies.isEmpty()) return
|
||||
val currenciesRepository = store.inject(DaggerGraphState::currenciesRepository)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue