From 488ec01a89abb46111d53334e6463ebf8514a5e4 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 27 Jun 2024 16:05:04 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../presentation/wallet/viewmodels/WalletViewModel.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt index 5a63ee153a..c5aa3e94ac 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/viewmodels/WalletViewModel.kt @@ -27,6 +27,7 @@ import com.tangem.feature.wallet.presentation.wallet.state.transformers.* import com.tangem.feature.wallet.presentation.wallet.state.utils.WalletEventSender import com.tangem.feature.wallet.presentation.wallet.utils.ScreenLifecycleProvider import com.tangem.feature.wallet.presentation.wallet.viewmodels.intents.WalletClickIntents +import com.tangem.features.pushnotifications.api.featuretoggles.PushNotificationsFeatureToggles import com.tangem.features.pushnotifications.api.utils.PUSH_PERMISSION import com.tangem.utils.Provider import com.tangem.utils.coroutines.CoroutineDispatcherProvider @@ -63,6 +64,7 @@ internal class WalletViewModel @Inject constructor( private val shouldInitiallyAskPermissionUseCase: ShouldInitiallyAskPermissionUseCase, private val isFirstTimeAskingPermissionUseCase: IsFirstTimeAskingPermissionUseCase, private val shouldAskPermissionUseCase: ShouldAskPermissionUseCase, + private val pushNotificationsFeatureToggles: PushNotificationsFeatureToggles, private val settingsManager: SettingsManager, analyticsEventsHandler: AnalyticsEventHandler, ) : ViewModel() { @@ -146,7 +148,9 @@ internal class WalletViewModel @Inject constructor( private fun subscribeOnPushNotificationsPermission() { viewModelScope.launch { - if (!shouldAskPermissionUseCase(PUSH_PERMISSION)) return@launch + val isPushToggled = pushNotificationsFeatureToggles.isPushNotificationsEnabled + val shouldRequestPush = shouldAskPermissionUseCase(PUSH_PERMISSION) + if (!isPushToggled || !shouldRequestPush) return@launch delay(timeMillis = 1_800)