Updated on 2026-08-14

This commit is contained in:
Tangem 2024-12-10 10:19:20 +04:00
commit 67a56390f1
4 changed files with 44 additions and 4 deletions

View file

@ -61,6 +61,7 @@ import com.tangem.features.send.api.navigation.SendRouter
import com.tangem.features.staking.api.navigation.StakingRouter
import com.tangem.features.tokendetails.navigation.TokenDetailsRouter
import com.tangem.features.wallet.navigation.WalletRouter
import com.tangem.google.GoogleServicesHelper
import com.tangem.operations.backup.BackupService
import com.tangem.sdk.api.BackupServiceHolder
import com.tangem.sdk.api.TangemSdkManager
@ -72,7 +73,6 @@ import com.tangem.tap.common.SnackbarHandler
import com.tangem.tap.common.apptheme.MutableAppThemeModeHolder
import com.tangem.tap.common.extensions.dispatchNavigationAction
import com.tangem.tap.common.extensions.showFragmentAllowingStateLoss
import com.tangem.google.GoogleServicesHelper
import com.tangem.tap.common.redux.NotificationsHandler
import com.tangem.tap.domain.walletconnect2.domain.WalletConnectInteractor
import com.tangem.tap.features.intentHandler.IntentProcessor
@ -86,6 +86,7 @@ import com.tangem.tap.proxy.AppStateHolder
import com.tangem.tap.proxy.redux.DaggerGraphAction
import com.tangem.tap.routing.RoutingComponent
import com.tangem.tap.routing.configurator.AppRouterConfig
import com.tangem.tap.routing.toggle.RoutingFeatureToggles
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
import com.tangem.utils.coroutines.FeatureCoroutineExceptionHandler
import com.tangem.wallet.R
@ -208,6 +209,9 @@ class MainActivity : AppCompatActivity(), SnackbarHandler, ActivityResultCallbac
@Inject
lateinit var dispatchers: CoroutineDispatcherProvider
@Inject
internal lateinit var routingFeatureToggles: RoutingFeatureToggles
internal val viewModel: MainViewModel by viewModels()
private lateinit var appThemeModeFlow: SharedFlow<AppThemeMode>
@ -250,8 +254,16 @@ class MainActivity : AppCompatActivity(), SnackbarHandler, ActivityResultCallbac
installActivityDependencies()
observeAppThemeModeUpdates()
setContentView(R.layout.activity_main)
installRouting()
if (routingFeatureToggles.isNavigationRefactoringEnabled) {
TODO(
"Will be implemented in [REDACTED_JIRA] " +
"and in [REDACTED_JIRA]",
)
} else {
setContentView(R.layout.activity_main)
installRouting()
}
initContent()
observeStateUpdates()

View file

@ -0,0 +1,14 @@
package com.tangem.tap.routing.toggle
import com.tangem.core.configtoggle.feature.FeatureTogglesManager
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
internal class RoutingFeatureToggles @Inject constructor(
private val featureTogglesManager: FeatureTogglesManager,
) {
val isNavigationRefactoringEnabled: Boolean
get() = featureTogglesManager.isFeatureEnabled(name = "NAVIGATION_REFACTORING")
}

View file

@ -35,6 +35,7 @@ import com.tangem.tap.features.onboarding.products.wallet.ui.OnboardingWalletFra
import com.tangem.tap.features.saveWallet.ui.SaveWalletBottomSheetFragment
import com.tangem.tap.features.welcome.ui.WelcomeFragment
import com.tangem.tap.routing.RoutingComponent.Child
import com.tangem.tap.routing.toggle.RoutingFeatureToggles
import com.tangem.utils.Provider
import dagger.hilt.android.scopes.ActivityScoped
import java.util.WeakHashMap
@ -61,10 +62,19 @@ internal class ChildFactory @Inject constructor(
private val stakingRouter: StakingRouter,
private val testerRouter: TesterRouter,
private val pushNotificationRouter: PushNotificationsRouter,
private val routingFeatureToggles: RoutingFeatureToggles,
) {
@Suppress("LongMethod", "CyclomaticComplexMethod")
fun createChild(route: AppRoute, contextFactory: (route: AppRoute) -> AppComponentContext): Child {
return if (routingFeatureToggles.isNavigationRefactoringEnabled) {
TODO("Will be implemented in [REDACTED_JIRA]")
} else {
createChildLegacy(route, contextFactory)
}
}
@Suppress("LongMethod", "CyclomaticComplexMethod")
private fun createChildLegacy(route: AppRoute, contextFactory: (route: AppRoute) -> AppComponentContext): Child {
componentContexts[route] = contextFactory(route)
return when (route) {

View file

@ -26,5 +26,9 @@
{
"name": "ONBOARDING_CODE_REFACTORING_ENABLED",
"version": "undefined"
},
{
"name": "NAVIGATION_REFACTORING",
"version": "undefined"
}
]