Updated on 2026-08-14

This commit is contained in:
Tangem 2026-04-13 16:38:04 +05:00
parent 9ef791c432
commit 1afa4a5d0e
5 changed files with 31 additions and 7 deletions

View file

@ -19,7 +19,9 @@ import com.tangem.datasource.local.appsflyer.AppsFlyerStore
import com.tangem.domain.common.wallets.error.SaveWalletError
import com.tangem.domain.assetsdiscovery.usecase.StartAssetsDiscoveryUseCase
import com.tangem.domain.wallets.builder.HotUserWalletBuilder
import com.tangem.domain.wallets.models.WalletSyncResult
import com.tangem.domain.wallets.usecase.SaveWalletUseCase
import com.tangem.domain.wallets.usecase.SyncWalletWithRemoteUseCase
import com.tangem.features.hotwallet.HotWalletFeatureToggles
import com.tangem.features.hotwallet.MnemonicRepository
import com.tangem.features.hotwallet.addexistingwallet.im.port.AddExistingWalletImportComponent
@ -27,6 +29,7 @@ import com.tangem.features.hotwallet.addexistingwallet.im.port.entity.AddExistin
import com.tangem.hot.sdk.TangemHotSdk
import com.tangem.hot.sdk.model.HotAuth
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.update
@ -42,6 +45,7 @@ internal class AddExistingWalletImportModel @Inject constructor(
private val tangemHotSdk: TangemHotSdk,
private val hotUserWalletBuilderFactory: HotUserWalletBuilder.Factory,
private val saveUserWalletUseCase: SaveWalletUseCase,
private val syncWalletWithRemoteUseCase: SyncWalletWithRemoteUseCase,
private val startAssetsDiscoveryUseCase: StartAssetsDiscoveryUseCase,
private val hotWalletFeatureToggles: HotWalletFeatureToggles,
@GlobalUiMessageSender private val uiMessageSender: UiMessageSender,
@ -114,8 +118,13 @@ internal class AddExistingWalletImportModel @Inject constructor(
.onRight {
setImportProgress(false)
if (hotWalletFeatureToggles.isAssetsDiscoveryEnabled) {
startAssetsDiscoveryUseCase(userWallet.walletId)
launch(dispatchers.main + NonCancellable) {
val syncResult = syncWalletWithRemoteUseCase(userWallet.walletId)
if (hotWalletFeatureToggles.isAssetsDiscoveryEnabled &&
syncResult == WalletSyncResult.Created
) {
startAssetsDiscoveryUseCase(userWallet.walletId)
}
}
analyticsEventHandler.send(