Updated on 2026-08-14
This commit is contained in:
parent
e18ac0b8fa
commit
9359c75f42
2 changed files with 33 additions and 2 deletions
|
|
@ -0,0 +1,31 @@
|
|||
package com.tangem.common
|
||||
|
||||
import com.tangem.utils.SupportedLanguages.CHINESE
|
||||
import com.tangem.utils.SupportedLanguages.ENGLISH
|
||||
import com.tangem.utils.SupportedLanguages.FRANCH
|
||||
import com.tangem.utils.SupportedLanguages.GERMAN
|
||||
import com.tangem.utils.SupportedLanguages.JAPANESE
|
||||
import java.util.Locale
|
||||
|
||||
object TangemSiteShareUrlBuilder {
|
||||
|
||||
private const val BASE_URL = "https://tangem.com"
|
||||
private const val CRYPTOCURRENCIES_PATH = "cryptocurrencies"
|
||||
|
||||
@Deprecated("Should use CHINESE from SupportedLanguages, but the site expects zh-Hans in the URL path")
|
||||
private const val CHINESE_SITE_LOCALE = "zh-Hans"
|
||||
|
||||
@Deprecated("Should rely on SupportedLanguages instead of maintaining a separate list")
|
||||
private val siteLocales = mapOf(
|
||||
ENGLISH to ENGLISH,
|
||||
FRANCH to FRANCH,
|
||||
GERMAN to GERMAN,
|
||||
JAPANESE to JAPANESE,
|
||||
CHINESE to CHINESE_SITE_LOCALE,
|
||||
)
|
||||
|
||||
fun shareUrl(tokenId: String): String {
|
||||
val locale = siteLocales[Locale.getDefault().language] ?: ENGLISH
|
||||
return "$BASE_URL/$locale/$CRYPTOCURRENCIES_PATH/$tokenId"
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import androidx.compose.runtime.Stable
|
|||
import arrow.core.Either
|
||||
import arrow.core.getOrElse
|
||||
import com.tangem.blockchainsdk.utils.ExcludedBlockchains
|
||||
import com.tangem.common.TangemSiteShareUrlBuilder
|
||||
import com.tangem.common.ui.charts.state.MarketChartData
|
||||
import com.tangem.common.ui.charts.state.MarketChartDataProducer
|
||||
import com.tangem.common.ui.charts.state.sorted
|
||||
|
|
@ -667,7 +668,7 @@ internal class MarketsTokenDetailsModel @Inject constructor(
|
|||
|
||||
private fun onShareClick() {
|
||||
val tokenId = params.token.id.value
|
||||
val shareUrl = "$CRYPTOCURRENCIES_BASE_URL$tokenId"
|
||||
val shareUrl = TangemSiteShareUrlBuilder.shareUrl(tokenId)
|
||||
shareManager.shareText(shareUrl)
|
||||
analyticsEventHandler.send(analyticsEventBuilder.shareClicked())
|
||||
}
|
||||
|
|
@ -735,6 +736,5 @@ 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/"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue