Updated on 2026-08-14

This commit is contained in:
Tangem 2025-07-30 23:19:12 +04:00
parent aa54b0f842
commit 2cbfdb5c66
6 changed files with 36 additions and 23 deletions

View file

@ -52,7 +52,6 @@ import com.tangem.domain.tokens.GetPolkadotCheckHasImmortalUseCase
import com.tangem.domain.tokens.GetPolkadotCheckHasResetUseCase
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import com.tangem.feature.wallet.presentation.wallet.analytics.WalletScreenAnalyticsEvent
import com.tangem.features.pushnotifications.api.utils.PUSH_PERMISSION
import com.tangem.features.walletconnect.components.WalletConnectFeatureToggles
import com.tangem.google.GoogleServicesHelper
import com.tangem.operations.backup.BackupService
@ -464,12 +463,11 @@ class MainActivity : AppCompatActivity(), ActivityResultCallbackHolder {
} else {
lifecycleScope.launch {
val shouldShowTos = !cardRepository.isTangemTOSAccepted()
val shouldShowInitialPush = shouldInitiallyAskPermissionUseCase(PUSH_PERMISSION).getOrElse { false }
val route = when {
shouldShowTos -> AppRoute.Disclaimer(isTosAccepted = false)
shouldShowInitialPush -> AppRoute.PushNotification
else -> AppRoute.Home
val route = if (shouldShowTos) {
AppRoute.Disclaimer(isTosAccepted = false)
} else {
AppRoute.Home
}
store.dispatchNavigationAction { replaceAll(route) }

View file

@ -4,7 +4,7 @@ import com.tangem.utils.info.AppInfoProvider
import com.tangem.utils.notifications.PushNotificationsTokenProvider
import javax.inject.Inject
class ShouldShowHuaweiWarningUseCase @Inject constructor(
class GetIsHuaweiDeviceWithoutGoogleServicesUseCase @Inject constructor(
private val appInfoProvider: AppInfoProvider,
private val pushNotificationsTokenProvider: PushNotificationsTokenProvider,
) {

View file

@ -0,0 +1,11 @@
package com.tangem.domain.wallets.usecase
import com.tangem.domain.wallets.legacy.UserWalletsListManager
import javax.inject.Inject
class GetIsBiometricsEnabledUseCase @Inject constructor(
private val userWalletsListManager: UserWalletsListManager,
) {
operator fun invoke(): Boolean = userWalletsListManager as? UserWalletsListManager.Lockable != null
}

View file

@ -7,6 +7,7 @@ import com.tangem.core.decompose.model.ParamsContainer
import com.tangem.core.decompose.navigation.Router
import com.tangem.core.navigation.finisher.AppFinisher
import com.tangem.domain.card.repository.CardRepository
import com.tangem.domain.notifications.GetIsHuaweiDeviceWithoutGoogleServicesUseCase
import com.tangem.domain.notifications.repository.NotificationsRepository
import com.tangem.domain.settings.NeverRequestPermissionUseCase
import com.tangem.domain.settings.NeverToInitiallyAskPermissionUseCase
@ -28,6 +29,8 @@ internal class DisclaimerModel @Inject constructor(
private val neverRequestPermissionUseCase: NeverRequestPermissionUseCase,
private val appFinisher: AppFinisher,
private val notificationsRepository: NotificationsRepository,
private val getIsHuaweiDeviceWithoutGoogleServicesUseCase: GetIsHuaweiDeviceWithoutGoogleServicesUseCase,
paramsContainer: ParamsContainer,
) : Model() {
@ -48,7 +51,8 @@ internal class DisclaimerModel @Inject constructor(
} else {
cardRepository.acceptTangemTOS()
val shouldAskPushPermission = notificationsRepository.shouldShowSubscribeOnNotificationsAfterUpdate()
if (shouldAskPushPermission) {
val isHuaweiDevice = getIsHuaweiDeviceWithoutGoogleServicesUseCase()
if (shouldAskPushPermission && !isHuaweiDevice) {
router.push(AppRoute.PushNotification)
} else {
neverToInitiallyAskPermissionUseCase(PUSH_PERMISSION)

View file

@ -24,7 +24,7 @@ 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.ShouldShowHuaweiWarningUseCase
import com.tangem.domain.notifications.GetIsHuaweiDeviceWithoutGoogleServicesUseCase
import com.tangem.domain.notifications.repository.NotificationsRepository
import com.tangem.domain.notifications.toggles.NotificationsFeatureToggles
import com.tangem.domain.settings.repositories.PermissionRepository
@ -75,7 +75,7 @@ internal class WalletSettingsModel @Inject constructor(
private val settingsManager: SettingsManager,
private val permissionsRepository: PermissionRepository,
private val notificationsRepository: NotificationsRepository,
private val shouldShowHuaweiWarningUseCase: ShouldShowHuaweiWarningUseCase,
private val getIsHuaweiDeviceWithoutGoogleServicesUseCase: GetIsHuaweiDeviceWithoutGoogleServicesUseCase,
) : Model() {
val params: WalletSettingsComponent.Params = paramsContainer.require()
@ -99,6 +99,8 @@ internal class WalletSettingsModel @Inject constructor(
) { maybeWallet, nftEnabled, notificationsEnabled ->
val wallet = maybeWallet.getOrNull() ?: return@combine
val isRenameWalletAvailable = getShouldSaveUserWalletsSyncUseCase()
val isNeedShowNotifications = notificationsToggles.isNotificationsEnabled &&
!getIsHuaweiDeviceWithoutGoogleServicesUseCase()
state.update { value ->
value.copy(
items = buildItems(
@ -108,7 +110,7 @@ internal class WalletSettingsModel @Inject constructor(
isNFTFeatureEnabled = nftFeatureToggles.isNFTEnabled,
isNFTEnabled = nftEnabled,
isNotificationsEnabled = notificationsEnabled,
isNotificationsFeatureEnabled = notificationsToggles.isNotificationsEnabled,
isNotificationsFeatureEnabled = isNeedShowNotifications,
isNotificationsPermissionGranted = isNotificationsPermissionGranted(),
),
)
@ -232,7 +234,7 @@ internal class WalletSettingsModel @Inject constructor(
private fun onCheckedNotificationsChange(isChecked: Boolean) {
modelScope.launch {
if (isChecked) {
if (shouldShowHuaweiWarningUseCase()) {
if (getIsHuaweiDeviceWithoutGoogleServicesUseCase()) {
showHuaweiDialog()
return@launch
}

View file

@ -17,6 +17,7 @@ import com.tangem.core.deeplink.global.ReferralDeepLink
import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase
import com.tangem.domain.common.util.cardTypesResolver
import com.tangem.domain.nft.ObserveAndClearNFTCacheIfNeedUseCase
import com.tangem.domain.notifications.GetIsHuaweiDeviceWithoutGoogleServicesUseCase
import com.tangem.domain.notifications.repository.NotificationsRepository
import com.tangem.domain.notifications.toggles.NotificationsFeatureToggles
import com.tangem.domain.settings.*
@ -25,10 +26,7 @@ import com.tangem.domain.tokens.RefreshMultiCurrencyWalletQuotesUseCase
import com.tangem.domain.wallets.models.UserWallet
import com.tangem.domain.wallets.models.UserWalletId
import com.tangem.domain.wallets.models.isMultiCurrency
import com.tangem.domain.wallets.usecase.GetSelectedWalletUseCase
import com.tangem.domain.wallets.usecase.GetWalletsUseCase
import com.tangem.domain.wallets.usecase.GetWalletsForAutomaticallyPushEnablingUseCase
import com.tangem.domain.wallets.usecase.SetNotificationsEnabledUseCase
import com.tangem.domain.wallets.usecase.*
import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents
import com.tangem.feature.wallet.presentation.deeplink.WalletDeepLinksHandler
import com.tangem.feature.wallet.presentation.router.InnerWalletRouter
@ -50,7 +48,6 @@ import com.tangem.feature.wallet.presentation.wallet.utils.ScreenLifecycleProvid
import com.tangem.features.biometry.AskBiometryComponent
import com.tangem.features.pushnotifications.api.PushNotificationsModelCallbacks
import com.tangem.features.pushnotifications.api.utils.PUSH_PERMISSION
import com.tangem.features.pushnotifications.api.utils.getPushPermissionOrNull
import com.tangem.utils.Provider
import com.tangem.utils.coroutines.*
import kotlinx.coroutines.*
@ -94,6 +91,8 @@ internal class WalletModel @Inject constructor(
private val getWalletsListForEnablingUseCase: GetWalletsForAutomaticallyPushEnablingUseCase,
private val setNotificationsEnabledUseCase: SetNotificationsEnabledUseCase,
private val notificationsFeatureToggles: NotificationsFeatureToggles,
private val getIsBiometryIsEnabledUseCase: GetIsBiometricsEnabledUseCase,
private val getIsHuaweiDeviceWithoutGoogleServicesUseCase: GetIsHuaweiDeviceWithoutGoogleServicesUseCase,
val screenLifecycleProvider: ScreenLifecycleProvider,
val innerWalletRouter: InnerWalletRouter,
) : Model() {
@ -208,12 +207,11 @@ internal class WalletModel @Inject constructor(
modelScope.launch {
val shouldAskPermission = shouldAskPermissionUseCase(PUSH_PERMISSION)
val afterUpdate = notificationsRepository.shouldShowSubscribeOnNotificationsAfterUpdate()
val shouldShowBottomSheet = if (notificationsFeatureToggles.isNotificationsEnabled) {
(shouldAskPermission || afterUpdate) && !shouldShowSaveWalletScreenUseCase()
} else {
val isPushPermissionAvailable = getPushPermissionOrNull() != null
shouldAskPermission && isPushPermissionAvailable
}
val isBiometryIsEnabled = getIsBiometryIsEnabledUseCase()
val isHuaweiDevice = getIsHuaweiDeviceWithoutGoogleServicesUseCase()
val shouldShowBottomSheet = shouldAskPermission || afterUpdate
if (!isBiometryIsEnabled) return@launch
if (isHuaweiDevice) return@launch
if (!shouldShowBottomSheet) return@launch
delay(timeMillis = 1_800)