Updated on 2026-08-14
This commit is contained in:
parent
7f2f051415
commit
3d5a8654a5
23 changed files with 783 additions and 35 deletions
|
|
@ -17,6 +17,7 @@ import com.tangem.domain.markets.TokenMarketParams
|
|||
import com.tangem.domain.models.account.Account
|
||||
import com.tangem.domain.models.account.AccountId
|
||||
import com.tangem.domain.models.currency.CryptoCurrency
|
||||
import com.tangem.domain.models.earn.PreselectedEarnType
|
||||
import com.tangem.domain.models.scan.ScanResponse
|
||||
import com.tangem.domain.models.serialization.SerializedBigDecimal
|
||||
import com.tangem.domain.models.wallet.UserWalletId
|
||||
|
|
@ -494,4 +495,10 @@ sealed class AppRoute(val path: String) : Route {
|
|||
data class News(
|
||||
val categoryId: Int? = null,
|
||||
) : AppRoute(path = "/news")
|
||||
|
||||
@Serializable
|
||||
data class Earn(
|
||||
val preselectedEarnType: PreselectedEarnType? = null,
|
||||
val preselectedNetworkId: String? = null,
|
||||
) : AppRoute(path = "/earn")
|
||||
}
|
||||
|
|
@ -75,6 +75,14 @@ sealed class DeepLinkRoute {
|
|||
data object News : DeepLinkRoute() {
|
||||
override val host: String = "news"
|
||||
}
|
||||
|
||||
data object Earn : DeepLinkRoute() {
|
||||
override val host: String = "earn"
|
||||
}
|
||||
|
||||
data object Yield : DeepLinkRoute() {
|
||||
override val host: String = "yield"
|
||||
}
|
||||
}
|
||||
|
||||
enum class DeepLinkScheme(val scheme: String) {
|
||||
|
|
|
|||
|
|
@ -20,4 +20,5 @@ object DeeplinkConst {
|
|||
const val SECTION_KEY = "section"
|
||||
const val CATEGORY_ID_KEY = "category_id"
|
||||
const val NEWS_ID_KEY = "news_id"
|
||||
const val EARN_TYPE_KEY = "earn_type"
|
||||
}
|
||||
|
|
@ -108,6 +108,31 @@ internal class DeepLinkBuilderTest {
|
|||
assertThat(result).isEqualTo("${DeeplinkConst.TANGEM_SCHEME}://news?${DeeplinkConst.NEWS_ID_KEY}=20533")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `earn host with filters produces expected uri`() {
|
||||
val result = deepLinkBuilder
|
||||
.setAction("earn")
|
||||
.addQueryParam(DeeplinkConst.EARN_TYPE_KEY, "yield")
|
||||
.addQueryParam(DeeplinkConst.NETWORK_ID_KEY, "base")
|
||||
.build()
|
||||
|
||||
assertThat(result).isEqualTo(
|
||||
"${DeeplinkConst.TANGEM_SCHEME}://earn?${DeeplinkConst.EARN_TYPE_KEY}=yield" +
|
||||
"&${DeeplinkConst.NETWORK_ID_KEY}=base",
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `yield host with token and network produces expected uri`() {
|
||||
val result = deepLinkBuilder
|
||||
.setAction("yield")
|
||||
.addQueryParam(DeeplinkConst.TOKEN_ID_KEY, "usd-coin")
|
||||
.addQueryParam(DeeplinkConst.NETWORK_ID_KEY, "base")
|
||||
.build()
|
||||
|
||||
assertThat(result).isEqualTo("${DeeplinkConst.TANGEM_SCHEME}://yield?token_id=usd-coin&network_id=base")
|
||||
}
|
||||
|
||||
@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