From 76894a77a75625ff5c914493ff9ebb1beba06ddd Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 3 Feb 2026 13:40:04 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../details/DefaultMarketsTokenDetailsComponent.kt | 1 + .../model/market/details/MarketsTokenDetailsModel.kt | 11 +++++++++++ .../details/analytics/MarketDetailsAnalyticsEvent.kt | 5 +++++ .../ui/market/detailed/MarketsTokenDetailsContent.kt | 6 ++++++ .../detailed/preview/MarketsTokenDetailsPreview.kt | 2 ++ .../ui/market/detailed/state/MarketsTokenDetailsUM.kt | 1 + 6 files changed, 26 insertions(+) diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/DefaultMarketsTokenDetailsComponent.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/DefaultMarketsTokenDetailsComponent.kt index 2a561c6ba5..c3fc430041 100644 --- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/DefaultMarketsTokenDetailsComponent.kt +++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/components/market/details/DefaultMarketsTokenDetailsComponent.kt @@ -95,6 +95,7 @@ internal class DefaultMarketsTokenDetailsComponent( tokenName = state.tokenName, tokenPrice = state.priceText, backgroundColor = background, + onShareClick = state.onShareClick, ) } diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/model/market/details/MarketsTokenDetailsModel.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/model/market/details/MarketsTokenDetailsModel.kt index 9d3d1ecd4b..257c93ed3b 100644 --- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/model/market/details/MarketsTokenDetailsModel.kt +++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/model/market/details/MarketsTokenDetailsModel.kt @@ -11,6 +11,7 @@ import com.tangem.core.analytics.api.AnalyticsEventHandler import com.tangem.core.decompose.di.ModelScoped import com.tangem.core.decompose.model.Model import com.tangem.core.decompose.model.ParamsContainer +import com.tangem.core.navigation.share.ShareManager import com.tangem.core.navigation.url.UrlOpener import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfig import com.tangem.core.ui.components.bottomsheets.TangemBottomSheetConfigContent @@ -83,6 +84,7 @@ internal class MarketsTokenDetailsModel @Inject constructor( private val excludedBlockchains: ExcludedBlockchains, private val urlOpener: UrlOpener, private val getNewsUseCase: GetNewsUseCase, + private val shareManager: ShareManager, ) : Model() { private val quotesJob = JobHolder() @@ -247,6 +249,7 @@ internal class MarketsTokenDetailsModel @Inject constructor( onFirstVisible = {}, onScroll = {}, ), + onShareClick = ::onShareClick, ), ) @@ -662,6 +665,13 @@ internal class MarketsTokenDetailsModel @Inject constructor( } } + private fun onShareClick() { + val tokenId = params.token.id.value + val shareUrl = "$CRYPTOCURRENCIES_BASE_URL$tokenId" + shareManager.shareText(shareUrl) + analyticsEventHandler.send(analyticsEventBuilder.shareClicked()) + } + private fun onListedOnClick(exchangesCount: Int) { modelScope.launch { analyticsEventHandler.send(analyticsEventBuilder.exchangesScreenOpened()) @@ -725,5 +735,6 @@ internal class MarketsTokenDetailsModel @Inject constructor( private companion object { const val QUOTES_UPDATE_INTERVAL_MILLIS = 60000L const val RELATED_NEWS_LIMIT = 10 + const val CRYPTOCURRENCIES_BASE_URL = "https://tangem.com/en/cryptocurrencies/" } } \ No newline at end of file diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/model/market/details/analytics/MarketDetailsAnalyticsEvent.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/model/market/details/analytics/MarketDetailsAnalyticsEvent.kt index 05b527c4ff..1ae3f86fab 100644 --- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/model/market/details/analytics/MarketDetailsAnalyticsEvent.kt +++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/model/market/details/analytics/MarketDetailsAnalyticsEvent.kt @@ -65,6 +65,11 @@ internal class MarketDetailsAnalyticsEvent( "Provider" to provider, ), ) + + fun shareClicked() = MarketDetailsAnalyticsEvent( + event = "Button - Share", + params = mapOf("Token" to token.symbol), + ) } enum class IntervalType(val source: String) { diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/detailed/MarketsTokenDetailsContent.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/detailed/MarketsTokenDetailsContent.kt index 60ea3e9f82..77c6da0b24 100644 --- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/detailed/MarketsTokenDetailsContent.kt +++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/detailed/MarketsTokenDetailsContent.kt @@ -42,6 +42,7 @@ import com.tangem.core.ui.res.TangemThemePreview import com.tangem.domain.markets.PriceChangeInterval import com.tangem.features.feed.impl.R import com.tangem.features.feed.ui.market.detailed.components.* +import com.tangem.core.ui.R as CoreR import com.tangem.features.feed.ui.market.detailed.preview.MarketsTokenDetailsPreview import com.tangem.features.feed.ui.market.detailed.state.ExchangesBottomSheetContent import com.tangem.features.feed.ui.market.detailed.state.InfoBottomSheetContent @@ -150,6 +151,7 @@ internal fun MarketsTokenDetailsTopBar( tokenPrice: String, isBackButtonEnabled: Boolean, onBackClick: () -> Unit, + onShareClick: () -> Unit, ) { TangemTopAppBar( modifier = Modifier.drawBehind { drawRect(backgroundColor) }, @@ -159,6 +161,10 @@ internal fun MarketsTokenDetailsTopBar( onBackClicked = onBackClick, enabled = isBackButtonEnabled, ), + endButton = TopAppBarButtonUM.Icon( + iconRes = CoreR.drawable.ic_share_24, + onClicked = onShareClick, + ), ) } diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/detailed/preview/MarketsTokenDetailsPreview.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/detailed/preview/MarketsTokenDetailsPreview.kt index 2c578fbe68..70c4db0103 100644 --- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/detailed/preview/MarketsTokenDetailsPreview.kt +++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/detailed/preview/MarketsTokenDetailsPreview.kt @@ -49,6 +49,7 @@ internal object MarketsTokenDetailsPreview { onFirstVisible = {}, onScroll = {}, ), + onShareClick = {}, ) val contentState = MarketsTokenDetailsUM( @@ -141,5 +142,6 @@ internal object MarketsTokenDetailsPreview { onFirstVisible = {}, onScroll = {}, ), + onShareClick = {}, ) } \ No newline at end of file diff --git a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/detailed/state/MarketsTokenDetailsUM.kt b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/detailed/state/MarketsTokenDetailsUM.kt index e150d95894..d0c4775d82 100644 --- a/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/detailed/state/MarketsTokenDetailsUM.kt +++ b/features/feed/impl/src/main/kotlin/com/tangem/features/feed/ui/market/detailed/state/MarketsTokenDetailsUM.kt @@ -28,6 +28,7 @@ internal data class MarketsTokenDetailsUM( val shouldShowPriceSubtitle: Boolean, val onShouldShowPriceSubtitleChange: (Boolean) -> Unit, val relatedNews: RelatedNews, + val onShareClick: () -> Unit, ) { data class ChartState(