Updated on 2026-08-14
This commit is contained in:
parent
d718cf557d
commit
970312afd3
19 changed files with 260 additions and 10 deletions
|
|
@ -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")
|
||||
}
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue