Updated on 2026-08-14

This commit is contained in:
Tangem 2026-04-30 18:02:28 +05:00
parent d718cf557d
commit 970312afd3
19 changed files with 260 additions and 10 deletions

View file

@ -489,4 +489,9 @@ sealed class AppRoute(val path: String) : Route {
@Serializable
data class NewsDetails(val newsId: Int) : AppRoute(path = "/news_details/$newsId")
@Serializable
data class News(
val categoryId: Int? = null,
) : AppRoute(path = "/news")
}

View file

@ -71,6 +71,10 @@ sealed class DeepLinkRoute {
data object PayApp : DeepLinkRoute() {
override val host: String = "tangem.com"
}
data object News : DeepLinkRoute() {
override val host: String = "news"
}
}
enum class DeepLinkScheme(val scheme: String) {

View file

@ -18,4 +18,6 @@ object DeeplinkConst {
const val ORDER_KEY = "order"
const val INTERVAL_KEY = "interval"
const val SECTION_KEY = "section"
const val CATEGORY_ID_KEY = "category_id"
const val NEWS_ID_KEY = "news_id"
}

View file

@ -88,6 +88,26 @@ internal class DeepLinkBuilderTest {
assertThat(result).isEqualTo("${DeeplinkConst.TANGEM_SCHEME}://$action?$key1=$value1&$key2=$value2")
}
@Test
fun `news host with categoryId produces expected uri`() {
val result = deepLinkBuilder
.setAction("news")
.addQueryParam(DeeplinkConst.CATEGORY_ID_KEY, "5")
.build()
assertThat(result).isEqualTo("${DeeplinkConst.TANGEM_SCHEME}://news?${DeeplinkConst.CATEGORY_ID_KEY}=5")
}
@Test
fun `news host with newsId produces expected uri`() {
val result = deepLinkBuilder
.setAction("news")
.addQueryParam(DeeplinkConst.NEWS_ID_KEY, "20533")
.build()
assertThat(result).isEqualTo("${DeeplinkConst.TANGEM_SCHEME}://news?${DeeplinkConst.NEWS_ID_KEY}=20533")
}
@Test
fun `GIVEN complex deep link WHEN build THEN should construct correct URI`() {
// GIVEN