From 865d4a1ed5efd4e2cb8d7d760ecf9fdcd85a67cf Mon Sep 17 00:00:00 2001 From: Tangem Date: Wed, 27 May 2026 19:44:31 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../component/impl/DefaultRoutingComponent.kt | 24 +++++++++++++++---- .../tangem/tap/routing/utils/ChildFactory.kt | 2 +- .../com/tangem/common/routing/AppRoute.kt | 1 + .../configs/feature_toggles_config.json | 4 ++++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/routing/component/impl/DefaultRoutingComponent.kt b/app/src/main/java/com/tangem/tap/routing/component/impl/DefaultRoutingComponent.kt index 58d3c9e7fb..6a7f07951e 100644 --- a/app/src/main/java/com/tangem/tap/routing/component/impl/DefaultRoutingComponent.kt +++ b/app/src/main/java/com/tangem/tap/routing/component/impl/DefaultRoutingComponent.kt @@ -44,6 +44,7 @@ import com.tangem.domain.onboarding.repository.OnboardingRepository import com.tangem.domain.settings.NeverRequestPermissionUseCase import com.tangem.domain.settings.NeverToInitiallyAskPermissionUseCase import com.tangem.domain.settings.ShouldInitiallyAskPermissionUseCase +import com.tangem.feature.referral.domain.ShouldShowMobileWalletPromoUseCase import com.tangem.features.hotwallet.HotAccessCodeRequestComponent import com.tangem.features.hotwallet.accesscoderequest.proxy.HotWalletPasswordRequesterProxy import com.tangem.features.onboarding.v2.common.analytics.OnboardingEvent @@ -70,7 +71,7 @@ import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import kotlinx.coroutines.launch -@Suppress("LongParameterList") +@Suppress("LongParameterList", "LargeClass") internal class DefaultRoutingComponent @AssistedInject constructor( @Assisted context: AppComponentContext, @Assisted val initialStack: List?, @@ -99,6 +100,7 @@ internal class DefaultRoutingComponent @AssistedInject constructor( private val shouldInitiallyAskPermissionUseCase: ShouldInitiallyAskPermissionUseCase, private val neverRequestPermissionUseCase: NeverRequestPermissionUseCase, private val featureTogglesManager: FeatureTogglesManager, + private val shouldShowMobileWalletPromoUseCase: ShouldShowMobileWalletPromoUseCase, ) : RoutingComponent, AppComponentContext by context, SnackbarHandler { @@ -229,18 +231,32 @@ internal class DefaultRoutingComponent @AssistedInject constructor( } } + val isHideStoriesForReferralEnabled = featureTogglesManager.isFeatureEnabled( + FeatureToggles.TWI_1512_HIDE_STORIES_FOR_REFERRAL_ENABLED, + ) + // Referral users skip the Home stories screen and land directly on the + // mobile wallet creation flow. + val afterEmptyRoute: AppRoute = if (isHideStoriesForReferralEnabled && shouldShowMobileWalletPromoUseCase()) { + AppRoute.CreateWalletStart(mode = AppRoute.CreateWalletStart.Mode.HotWallet) + } else { + AppRoute.Home(launchMode = launchMode) + } + val shouldAskPushPermission = shouldInitiallyAskPermissionUseCase(PUSH_PERMISSION).getOrNull() - ?: return AppRoute.Home(launchMode = launchMode) + ?: return afterEmptyRoute return if (shouldAskPushPermission) { notificationsRepository.setShouldShowNotifications( key = NotificationId.EnablePushesReminderNotification.key, value = false, ) - AppRoute.PushNotification(AppRoute.PushNotification.Source.Stories) + AppRoute.PushNotification( + source = AppRoute.PushNotification.Source.Stories, + nextRoute = afterEmptyRoute, + ) } else { neverToInitiallyAskPermissionUseCase(PUSH_PERMISSION) neverRequestPermissionUseCase(PUSH_PERMISSION) - AppRoute.Home(launchMode = launchMode) + afterEmptyRoute } } diff --git a/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt b/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt index da1aaddef4..3be7df1c1f 100644 --- a/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt +++ b/app/src/main/java/com/tangem/tap/routing/utils/ChildFactory.kt @@ -448,7 +448,7 @@ internal class ChildFactory @Inject constructor( params = PushNotificationsParams( modelCallbacks = PushNotificationsModelCallbacksStub(), source = route.source, - nextRoute = AppRoute.Home(), + nextRoute = route.nextRoute ?: AppRoute.Home(), ), componentFactory = pushNotificationsComponentFactory, ) diff --git a/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt b/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt index fd1fd59c15..4854b69392 100644 --- a/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt +++ b/common/routing/src/main/kotlin/com/tangem/common/routing/AppRoute.kt @@ -243,6 +243,7 @@ sealed class AppRoute(val path: String) : Route { @Serializable data class PushNotification( val source: Source, + val nextRoute: AppRoute? = null, ) : AppRoute(path = "/push_notification") { enum class Source { Stories, diff --git a/core/config-toggles/src/main/assets/configs/feature_toggles_config.json b/core/config-toggles/src/main/assets/configs/feature_toggles_config.json index e86e9ffe5a..45a73be769 100644 --- a/core/config-toggles/src/main/assets/configs/feature_toggles_config.json +++ b/core/config-toggles/src/main/assets/configs/feature_toggles_config.json @@ -102,5 +102,9 @@ { "name": "AND_15154_YIELD_PROMO_ENABLED", "version": "undefined" + }, + { + "name": "TWI_1512_HIDE_STORIES_FOR_REFERRAL_ENABLED", + "version": "5.39" } ]