Updated on 2026-08-14

This commit is contained in:
Tangem 2025-08-04 19:09:13 +03:00
commit 7c7f07080e
1413 changed files with 24740 additions and 8757 deletions

View file

@ -75,6 +75,7 @@ internal class ProxyAppRouter(
try {
block()
} catch (e: Throwable) {
Timber.e(e)
onComplete(false)
}
}

View file

@ -34,6 +34,7 @@ import com.tangem.core.ui.res.TangemTheme
import com.tangem.tap.routing.component.RoutingComponent
import com.tangem.tap.routing.transitions.RoutingTransitionAnimationFactory
@Suppress("LongParameterList")
@OptIn(ExperimentalDecomposeApi::class)
@Composable
internal fun RootContent(
@ -41,6 +42,7 @@ internal fun RootContent(
backHandler: BackHandler,
uiDependencies: UiDependencies,
wcContent: @Composable (modifier: Modifier) -> Unit,
hotAccessCodeContent: @Composable (modifier: Modifier) -> Unit,
onBack: () -> Unit,
modifier: Modifier = Modifier,
) {
@ -74,6 +76,8 @@ internal fun RootContent(
wcContent(Modifier.fillMaxSize())
hotAccessCodeContent(Modifier.fillMaxSize())
TangemSnackbarHost(
modifier = Modifier
.align(Alignment.BottomCenter)

View file

@ -6,17 +6,24 @@ import com.arkivanov.decompose.router.stack.ChildStack
import com.arkivanov.decompose.router.stack.childStack
import com.arkivanov.decompose.value.Value
import com.arkivanov.decompose.value.subscribe
import com.arkivanov.essenty.lifecycle.subscribe
import com.google.android.material.snackbar.Snackbar
import com.tangem.common.routing.AppRoute
import com.tangem.core.decompose.context.AppComponentContext
import com.tangem.core.decompose.context.child
import com.tangem.core.decompose.context.childByContext
import com.tangem.core.decompose.navigation.getOrCreateTyped
import com.tangem.core.ui.UiDependencies
import com.tangem.core.ui.extensions.TextReference
import com.tangem.core.ui.extensions.resourceReference
import com.tangem.core.ui.message.SnackbarMessage
import com.tangem.features.hotwallet.HotAccessCodeRequestComponent
import com.tangem.features.hotwallet.accesscoderequest.proxy.HotWalletPasswordRequesterProxy
import com.tangem.features.walletconnect.components.WcRoutingComponent
import com.tangem.hot.sdk.TangemHotSdk
import com.tangem.hot.sdk.android.create
import com.tangem.tap.common.SnackbarHandler
import com.tangem.tap.features.hot.TangemHotSDKProxy
import com.tangem.tap.routing.RootContent
import com.tangem.tap.routing.component.RoutingComponent
import com.tangem.tap.routing.component.RoutingComponent.Child
@ -36,13 +43,21 @@ internal class DefaultRoutingComponent @AssistedInject constructor(
private val uiDependencies: UiDependencies,
private val wcRoutingComponentFactory: WcRoutingComponent.Factory,
private val deeplinkFactory: DeepLinkFactory,
private val tangemHotSDKProxy: TangemHotSDKProxy,
private val hotAccessCodeRequestComponentFactory: HotAccessCodeRequestComponent.Factory,
private val hotAccessCodeRequesterProxy: HotWalletPasswordRequesterProxy,
) : RoutingComponent,
AppComponentContext by context,
SnackbarHandler {
private val wcRoutingComponent: WcRoutingComponent by lazy {
wcRoutingComponentFactory
.create(childByContext(componentContext = this), params = Unit)
.create(child("wcRoutingComponent"), params = Unit)
}
private val hotAccessCodeRequestComponent: HotAccessCodeRequestComponent by lazy {
hotAccessCodeRequestComponentFactory
.create(child("hotAccessCodeRequestComponent"), Unit)
}
private val stack: Value<ChildStack<AppRoute, Child>> = childStack(
@ -70,6 +85,8 @@ internal class DefaultRoutingComponent @AssistedInject constructor(
appRouterConfig.stack = stackItems
}
}
configureProxies()
}
@Composable
@ -79,6 +96,7 @@ internal class DefaultRoutingComponent @AssistedInject constructor(
stack = stack,
uiDependencies = uiDependencies,
wcContent = { wcRoutingComponent.Content(it) },
hotAccessCodeContent = { hotAccessCodeRequestComponent.Content(it) },
backHandler = backHandler,
onBack = router::pop,
)
@ -120,6 +138,19 @@ internal class DefaultRoutingComponent @AssistedInject constructor(
initialStack
}
private fun configureProxies() {
lifecycle.subscribe(
onCreate = {
tangemHotSDKProxy.sdkState.value = TangemHotSdk.create(activity)
hotAccessCodeRequesterProxy.componentRequester.value = hotAccessCodeRequestComponent
},
onDestroy = {
tangemHotSDKProxy.sdkState.value = null
hotAccessCodeRequesterProxy.componentRequester.value = null
},
)
}
@AssistedFactory
interface Factory : RoutingComponent.Factory {
override fun create(context: AppComponentContext, initialStack: List<AppRoute>?): DefaultRoutingComponent

View file

@ -8,6 +8,7 @@ import com.tangem.feature.referral.api.ReferralComponent
import com.tangem.feature.stories.api.StoriesComponent
import com.tangem.feature.usedesk.api.UsedeskComponent
import com.tangem.feature.walletsettings.component.WalletSettingsComponent
import com.tangem.features.hotwallet.WalletBackupComponent
import com.tangem.features.createwalletselection.CreateWalletSelectionComponent
import com.tangem.features.details.component.DetailsComponent
import com.tangem.features.disclaimer.api.components.DisclaimerComponent
@ -26,9 +27,10 @@ import com.tangem.features.pushnotifications.api.PushNotificationsModelCallbacks
import com.tangem.features.pushnotifications.api.PushNotificationsParams
import com.tangem.features.send.v2.api.NFTSendComponent
import com.tangem.features.send.v2.api.SendComponent
import com.tangem.features.send.v2.api.SendEntryPointComponent
import com.tangem.features.staking.api.StakingComponent
import com.tangem.features.swap.SwapComponent
import com.tangem.features.tester.api.TesterRouter
import com.tangem.features.swap.v2.api.SendWithSwapComponent
import com.tangem.features.tokendetails.TokenDetailsComponent
import com.tangem.features.wallet.WalletEntryComponent
import com.tangem.features.walletconnect.components.WalletConnectEntryComponent
@ -52,6 +54,7 @@ import com.tangem.features.walletconnect.components.WalletConnectEntryComponent
internal class ChildFactory @Inject constructor(
private val detailsComponentFactory: DetailsComponent.Factory,
private val walletSettingsComponentFactory: WalletSettingsComponent.Factory,
private val walletBackupComponentFactory: WalletBackupComponent.Factory,
private val disclaimerComponentFactory: DisclaimerComponent.Factory,
private val manageTokensComponentFactory: ManageTokensComponent.Factory,
private val marketsTokenDetailsComponentFactory: MarketsTokenDetailsComponent.Factory,
@ -88,7 +91,8 @@ internal class ChildFactory @Inject constructor(
private val createWalletSelectionComponentFactory: CreateWalletSelectionComponent.Factory,
private val createMobileWalletComponentFactory: CreateMobileWalletComponent.Factory,
private val addExistingWalletComponentFactory: AddExistingWalletComponent.Factory,
private val testerRouter: TesterRouter,
private val sendWithSwapComponentFactory: SendWithSwapComponent.Factory,
private val sendEntryPointComponentFactory: SendEntryPointComponent.Factory,
private val walletConnectFeatureToggles: WalletConnectFeatureToggles,
) {
@ -134,9 +138,6 @@ internal class ChildFactory @Inject constructor(
componentFactory = welcomeComponentFactory,
)
}
is AppRoute.TesterMenu -> {
Child.LegacyIntent(testerRouter.getEntryIntent())
}
is AppRoute.WalletSettings -> {
createComponentChild(
context = context,
@ -144,6 +145,15 @@ internal class ChildFactory @Inject constructor(
componentFactory = walletSettingsComponentFactory,
)
}
is AppRoute.WalletBackup -> {
createComponentChild(
context = context,
params = WalletBackupComponent.Params(
userWalletId = route.userWalletId,
),
componentFactory = walletBackupComponentFactory,
)
}
is AppRoute.MarketsTokenDetails -> {
createComponentChild(
context = context,
@ -425,6 +435,7 @@ internal class ChildFactory @Inject constructor(
params = ChooseManagedTokensComponent.Params(
userWalletId = route.userWalletId,
initialCurrency = route.initialCurrency,
selectedCurrency = route.selectedCurrency,
source = ChooseManagedTokensComponent.Source.valueOf(route.source.name),
),
componentFactory = chooseManagedTokensComponentFactory,
@ -451,6 +462,26 @@ internal class ChildFactory @Inject constructor(
componentFactory = addExistingWalletComponentFactory,
)
}
is AppRoute.SendEntryPoint -> {
createComponentChild(
context = context,
params = SendEntryPointComponent.Params(
userWalletId = route.userWalletId,
cryptoCurrency = route.currency,
),
componentFactory = sendEntryPointComponentFactory,
)
}
is AppRoute.SendWithSwap -> {
createComponentChild(
context = context,
params = SendWithSwapComponent.Params(
userWalletId = route.userWalletId,
currency = route.currency,
),
componentFactory = sendWithSwapComponentFactory,
)
}
}
}
}

View file

@ -8,7 +8,10 @@ import com.tangem.data.card.sdk.CardSdkProvider
import com.tangem.feature.referral.api.deeplink.ReferralDeepLinkHandler
import com.tangem.features.markets.deeplink.MarketsDeepLinkHandler
import com.tangem.features.markets.deeplink.MarketsTokenDetailDeepLinkHandler
import com.tangem.features.onramp.deeplink.*
import com.tangem.features.onramp.deeplink.BuyDeepLinkHandler
import com.tangem.features.onramp.deeplink.OnrampDeepLinkHandler
import com.tangem.features.onramp.deeplink.SellDeepLinkHandler
import com.tangem.features.onramp.deeplink.SwapDeepLinkHandler
import com.tangem.features.send.v2.api.deeplink.SellRedirectDeepLinkHandler
import com.tangem.features.staking.api.deeplink.StakingDeepLinkHandler
import com.tangem.features.tokendetails.deeplink.TokenDetailsDeepLinkHandler
@ -33,7 +36,6 @@ internal class DeepLinkFactory @Inject constructor(
private val cardSdkProvider: CardSdkProvider,
private val onrampDeepLink: OnrampDeepLinkHandler.Factory,
private val sellRedirectDeepLink: SellRedirectDeepLinkHandler.Factory,
private val buyRedirectDeepLink: BuyRedirectDeepLinkHandler.Factory,
private val referralDeepLink: ReferralDeepLinkHandler.Factory,
private val walletConnectDeepLink: WalletConnectDeepLinkHandler.Factory,
private val walletDeepLink: WalletDeepLinkHandler.Factory,
@ -114,7 +116,7 @@ internal class DeepLinkFactory @Inject constructor(
when (deeplinkUri.host) {
DeepLinkRoute.Onramp.host -> onrampDeepLink.create(coroutineScope, queryParams)
DeepLinkRoute.SellRedirect.host -> sellRedirectDeepLink.create(coroutineScope, queryParams)
DeepLinkRoute.BuyRedirect.host -> buyRedirectDeepLink.create(coroutineScope)
DeepLinkRoute.BuyRedirect.host -> Unit
DeepLinkRoute.Referral.host -> referralDeepLink.create()
DeepLinkRoute.Wallet.host -> walletDeepLink.create()
DeepLinkRoute.TokenDetails.host -> tokenDetailsDeepLink.create(