Updated on 2026-08-14

This commit is contained in:
Tangem 2026-05-20 12:19:43 +03:00
parent 4578bb824e
commit 0979d1b71b
22 changed files with 565 additions and 0 deletions

View file

@ -119,6 +119,7 @@ dependencies {
implementation(projects.domain.wallets)
implementation(projects.domain.wallets.models)
implementation(projects.domain.notifications)
implementation(projects.domain.pushNotificationPreferences)
implementation(projects.domain.transaction)
implementation(projects.domain.yieldSupply)
implementation(projects.domain.yieldSupply.models)
@ -136,6 +137,7 @@ dependencies {
implementation(projects.features.onboardingV2.api)
implementation(projects.features.onramp.api)
implementation(projects.features.pushNotifications.api)
implementation(projects.features.pushNotificationSettings.api)
implementation(projects.features.swap.api)
implementation(projects.features.tester.api)
implementation(projects.features.tokendetails.api)

View file

@ -47,6 +47,7 @@ import com.tangem.feature.wallet.presentation.wallet.analytics.utils.SelectedWal
import com.tangem.feature.wallet.presentation.wallet.domain.OnrampStatusFactory
import com.tangem.feature.wallet.presentation.wallet.domain.WalletContentFetcher
import com.tangem.feature.wallet.presentation.wallet.domain.WalletImageResolver
import com.tangem.domain.pushnotificationpreferences.PreloadWalletPushNotificationPreferencesUseCase
import com.tangem.feature.wallet.presentation.wallet.domain.WalletNameMigrationUseCase
import com.tangem.feature.wallet.presentation.wallet.loaders.WalletScreenContentLoader
import com.tangem.feature.wallet.presentation.wallet.state.WalletStateController
@ -61,6 +62,7 @@ import com.tangem.feature.wallet.presentation.wallet.ui.components.visa.KycRejec
import com.tangem.feature.wallet.presentation.wallet.utils.ScreenLifecycleProvider
import com.tangem.features.biometry.AskBiometryComponent
import com.tangem.features.hotwallet.HotWalletFeatureToggles
import com.tangem.features.pushnotificationsettings.PushNotificationSettingsFeatureToggles
import com.tangem.features.pushnotifications.api.PushNotificationsModelCallbacks
import com.tangem.features.wallet.deeplink.WalletDeepLinkActionListener
import com.tangem.features.wallet.featuretoggles.WalletFeatureToggles
@ -94,6 +96,7 @@ internal class WalletModel @Inject constructor(
private val getBalanceHidingSettingsUseCase: GetBalanceHidingSettingsUseCase,
private val selectedWalletAnalyticsSender: SelectedWalletAnalyticsSender,
private val walletNameMigrationUseCase: WalletNameMigrationUseCase,
private val preloadWalletPushNotificationPreferencesUseCase: PreloadWalletPushNotificationPreferencesUseCase,
private val refreshMultiCurrencyWalletQuotesUseCase: RefreshMultiCurrencyWalletQuotesUseCase,
private val walletImageResolver: WalletImageResolver,
private val onrampStatusFactory: OnrampStatusFactory,
@ -122,6 +125,7 @@ internal class WalletModel @Inject constructor(
private val uiMessageSender: UiMessageSender,
private val hotWalletFeatureToggles: HotWalletFeatureToggles,
private val walletFeatureToggles: WalletFeatureToggles,
private val pushNotificationSettingsFeatureToggles: PushNotificationSettingsFeatureToggles,
private val startAssetsDiscoveryUseCase: StartAssetsDiscoveryUseCase,
val screenLifecycleProvider: ScreenLifecycleProvider,
val innerWalletRouter: InnerWalletRouter,
@ -146,6 +150,7 @@ internal class WalletModel @Inject constructor(
maybeMigrateNames()
maybeSetWalletFirstTimeUsage()
preloadPushNotificationPreferences()
updateYieldSupplyApy()
subscribeToUserWalletsUpdates()
subscribeOnBalanceHiding()
@ -192,6 +197,19 @@ internal class WalletModel @Inject constructor(
}
}
private fun preloadPushNotificationPreferences() {
if (!pushNotificationSettingsFeatureToggles.isPushNotificationSettingsEnabled) return
getWalletsUseCase()
.map { wallets -> wallets.map(UserWallet::walletId) }
.distinctUntilChanged()
.onEach { walletIds ->
walletIds.forEach { walletId ->
modelScope.launch { preloadWalletPushNotificationPreferencesUseCase(walletId) }
}
}
.launchIn(modelScope)
}
private fun maybeSetWalletFirstTimeUsage() {
modelScope.launch {
setWalletFirstTimeUsageUseCase()