Updated on 2026-08-14

This commit is contained in:
Tangem 2025-07-17 14:47:18 +05:00
parent fd4b5a3011
commit 8e824ed490
10 changed files with 171 additions and 105 deletions

View file

@ -24,7 +24,6 @@ import com.tangem.domain.models.scan.ScanResponse
import com.tangem.domain.nft.DisableWalletNFTUseCase
import com.tangem.domain.nft.EnableWalletNFTUseCase
import com.tangem.domain.nft.GetWalletNFTEnabledUseCase
import com.tangem.domain.notifications.GetApplicationIdUseCase
import com.tangem.domain.notifications.toggles.NotificationsFeatureToggles
import com.tangem.domain.settings.repositories.PermissionRepository
import com.tangem.domain.wallets.models.UserWallet
@ -45,7 +44,6 @@ import com.tangem.features.pushnotifications.api.analytics.PushNotificationAnaly
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.NonCancellable
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import timber.log.Timber
@ -74,8 +72,6 @@ internal class WalletSettingsModel @Inject constructor(
private val setNotificationsEnabledUseCase: SetNotificationsEnabledUseCase,
private val settingsManager: SettingsManager,
private val permissionsRepository: PermissionRepository,
private val getApplicationIdUseCase: GetApplicationIdUseCase,
private val associateWalletsWithApplicationIdUseCase: AssociateWalletsWithApplicationIdUseCase,
) : Model() {
val params: WalletSettingsComponent.Params = paramsContainer.require()
@ -198,20 +194,10 @@ internal class WalletSettingsModel @Inject constructor(
if (hasUserWallets) {
router.pop()
} else {
clearWalletsAssociatedWithApplicationId()
router.replaceAll(AppRoute.Home)
}
}
private fun clearWalletsAssociatedWithApplicationId() = modelScope.launch(NonCancellable) {
getApplicationIdUseCase().onRight { applicationId ->
associateWalletsWithApplicationIdUseCase(applicationId, emptyList())
.onLeft {
Timber.e("Unable to associate empty wallets with application ID: $it")
}
}
}
private fun onLinkMoreCardsClick(scanResponse: ScanResponse) {
analyticsEventHandler.send(Settings.ButtonCreateBackup)
analyticsContextProxy.addContext(scanResponse)