Updated on 2026-08-14
This commit is contained in:
parent
d82474324b
commit
c0fbd241f4
10 changed files with 91 additions and 4 deletions
|
|
@ -14,6 +14,7 @@ dependencies {
|
|||
|
||||
/** Feature */
|
||||
implementation(projects.features.yieldSupply.api)
|
||||
implementation(projects.features.marketing.api)
|
||||
|
||||
/** Core */
|
||||
implementation(projects.core.configToggles)
|
||||
|
|
@ -59,6 +60,7 @@ dependencies {
|
|||
implementation(projects.domain.feedback)
|
||||
implementation(projects.domain.balanceHiding.models)
|
||||
implementation(projects.domain.balanceHiding)
|
||||
implementation(projects.domain.marketing.models)
|
||||
implementation(projects.libs.crypto)
|
||||
|
||||
/** Compose */
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.tangem.core.ui.decompose.ComposableBottomSheetComponent
|
|||
import com.tangem.core.ui.extensions.stringResourceSafe
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.features.marketing.api.MarketingBannerComponent
|
||||
import com.tangem.features.yield.supply.api.YieldSupplyActiveComponent
|
||||
import com.tangem.features.yield.supply.impl.R
|
||||
import com.tangem.features.yield.supply.impl.active.model.YieldSupplyActiveModel
|
||||
|
|
@ -38,6 +39,7 @@ internal class DefaultYieldSupplyActiveComponent @AssistedInject constructor(
|
|||
@Assisted private val appComponentContext: AppComponentContext,
|
||||
@Assisted private val params: YieldSupplyActiveComponent.Params,
|
||||
private val appRouter: AppRouter,
|
||||
private val marketingBannerComponentFactory: MarketingBannerComponent.Factory,
|
||||
) : YieldSupplyActiveComponent, AppComponentContext by appComponentContext {
|
||||
|
||||
private val model: YieldSupplyActiveModel = getOrCreateModel(params = params)
|
||||
|
|
@ -49,6 +51,14 @@ internal class DefaultYieldSupplyActiveComponent @AssistedInject constructor(
|
|||
),
|
||||
)
|
||||
|
||||
private val marketingBannerComponent = marketingBannerComponentFactory.create(
|
||||
context = child("marketingBanner"),
|
||||
params = MarketingBannerComponent.Params.Standalone(
|
||||
requestFlow = model.marketingRequest,
|
||||
onDeeplinkClick = model::onMarketingBannerDeeplink,
|
||||
),
|
||||
)
|
||||
|
||||
private val bottomSheetSlot = childSlot(
|
||||
key = "yieldSupplyActiveStack",
|
||||
source = model.slotNavigation,
|
||||
|
|
@ -83,6 +93,7 @@ internal class DefaultYieldSupplyActiveComponent @AssistedInject constructor(
|
|||
state = state,
|
||||
isBalanceHidden = isBalanceHidden,
|
||||
chartComponent = chartComponent,
|
||||
marketingBannerComponent = marketingBannerComponent,
|
||||
onReadMoreClick = model::onReadMoreClick,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,15 @@ import com.tangem.domain.models.currency.CryptoCurrencyStatus
|
|||
import com.tangem.domain.models.wallet.UserWallet
|
||||
import com.tangem.domain.wallets.usecase.GetUserWalletUseCase
|
||||
import com.tangem.common.routing.AppRoute
|
||||
import com.tangem.common.routing.deeplink.resolveMarketingDeeplink
|
||||
import com.tangem.common.routing.deeplink.toContextualRoute
|
||||
import com.tangem.core.analytics.models.AnalyticsParam
|
||||
import com.tangem.domain.marketing.models.MarketingScreen
|
||||
import com.tangem.domain.stories.models.StoryContentIds
|
||||
import com.tangem.domain.yield.supply.models.YieldBoostStatus
|
||||
import com.tangem.domain.yield.supply.promo.usecase.GetYieldBoostStatusUseCase
|
||||
import com.tangem.domain.yield.supply.usecase.*
|
||||
import com.tangem.features.marketing.api.MarketingBannerRequest
|
||||
import com.tangem.features.yield.supply.api.YieldSupplyActiveComponent
|
||||
import com.tangem.features.yield.supply.api.YieldSupplyFeatureToggles
|
||||
import com.tangem.features.yield.supply.api.analytics.YieldSupplyAnalytics
|
||||
|
|
@ -98,6 +103,15 @@ internal class YieldSupplyActiveModel @Inject constructor(
|
|||
private val cryptoCurrency = cryptoCurrencyStatusFlow.value.currency
|
||||
private var appCurrency = AppCurrency.Default
|
||||
|
||||
val marketingRequest: Flow<MarketingBannerRequest?> = flowOf(
|
||||
MarketingBannerRequest(
|
||||
screen = MarketingScreen.Yield(
|
||||
networkId = params.cryptoCurrency.network.rawId,
|
||||
contractAddress = (params.cryptoCurrency as? CryptoCurrency.Token)?.contractAddress.orEmpty(),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
val uiState: StateFlow<YieldSupplyActiveContentUM>
|
||||
field = MutableStateFlow(
|
||||
YieldSupplyActiveContentUM(
|
||||
|
|
@ -147,6 +161,16 @@ internal class YieldSupplyActiveModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
fun onMarketingBannerDeeplink(deeplink: String): Boolean {
|
||||
val route = resolveMarketingDeeplink(deeplink).toContextualRoute(
|
||||
userWalletId = userWalletId,
|
||||
currency = cryptoCurrency,
|
||||
screenSource = AnalyticsParam.ScreensSources.Token,
|
||||
) ?: return false
|
||||
appRouter.push(route)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onDismissClick() {
|
||||
if (!transactionInProgressFlow.value) {
|
||||
slotNavigation.dismiss()
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import com.tangem.core.ui.decompose.ComposableContentComponent
|
|||
import com.tangem.core.ui.extensions.*
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.core.ui.res.TangemThemeRedesign
|
||||
import com.tangem.features.yield.supply.impl.R
|
||||
import com.tangem.features.yield.supply.impl.active.entity.YieldSupplyActiveContentUM
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
|
@ -51,6 +52,7 @@ internal fun YieldSupplyActiveContent(
|
|||
isBalanceHidden: Boolean,
|
||||
onReadMoreClick: () -> Unit,
|
||||
chartComponent: ComposableContentComponent,
|
||||
marketingBannerComponent: ComposableContentComponent,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Column(
|
||||
|
|
@ -88,6 +90,10 @@ internal fun YieldSupplyActiveContent(
|
|||
}
|
||||
}
|
||||
|
||||
TangemThemeRedesign {
|
||||
marketingBannerComponent.Content(Modifier.fillMaxWidth())
|
||||
}
|
||||
|
||||
AnimatedVisibility(state.notifications.isNotEmpty()) {
|
||||
val notifications = remember(state.notifications) { state.notifications }
|
||||
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
|
|
@ -418,6 +424,7 @@ private fun YieldSupplyActiveBottomSheet_Preview(
|
|||
state = params,
|
||||
isBalanceHidden = true,
|
||||
chartComponent = ComposableContentComponent.EMPTY,
|
||||
marketingBannerComponent = ComposableContentComponent.EMPTY,
|
||||
onReadMoreClick = {},
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue