Updated on 2026-08-14

This commit is contained in:
Tangem 2025-05-30 18:22:42 +05:00
parent c55274f40f
commit efcb0dea79
20 changed files with 477 additions and 17 deletions

View file

@ -10,6 +10,9 @@ android {
}
dependencies {
// region sdk
implementation(tangemDeps.blockchain)
// endregion
// region AndroidX libraries
implementation(deps.androidx.datastore)
@ -28,6 +31,8 @@ dependencies {
// region Core modules
implementation(projects.core.datasource)
implementation(projects.core.utils)
implementation(projects.core.ui)
implementation(projects.libs.blockchainSdk)
// endregion
// region Domain modules

View file

@ -73,7 +73,7 @@ internal class DefaultNotificationsRepository @Inject constructor(
}
override suspend fun getEligibleNetworks(): List<NotificationsEligibleNetwork> = withContext(dispatchers.io) {
tangemTechApi.getEligibleNetworksForPushNotifications().getOrThrow().map {
tangemTechApi.getEligibleNetworksForPushNotifications().getOrThrow().mapNotNull {
NotificationsEligibleNetworkConverter.convert(it)
}
}

View file

@ -1,15 +1,19 @@
package com.tangem.data.notifications.converters
import com.tangem.blockchain.common.Blockchain
import com.tangem.blockchainsdk.utils.fromNetworkId
import com.tangem.core.ui.extensions.getActiveIconRes
import com.tangem.datasource.api.tangemTech.models.CryptoNetworkResponse
import com.tangem.domain.notifications.models.NotificationsEligibleNetwork
import com.tangem.utils.converter.Converter
internal object NotificationsEligibleNetworkConverter : Converter<CryptoNetworkResponse, NotificationsEligibleNetwork> {
override fun convert(value: CryptoNetworkResponse): NotificationsEligibleNetwork {
internal object NotificationsEligibleNetworkConverter {
fun convert(value: CryptoNetworkResponse): NotificationsEligibleNetwork? {
val blockchain: Blockchain = Blockchain.fromNetworkId(value.networkId) ?: return null
return NotificationsEligibleNetwork(
id = value.id.toString(),
networkId = value.networkId,
name = value.name,
id = value.networkId,
name = blockchain.fullName,
symbol = blockchain.currency,
icon = getActiveIconRes(blockchain.id),
)
}
}

View file

@ -149,7 +149,7 @@ class DefaultNotificationsRepositoryTest {
CryptoNetworkResponse(
id = 1,
name = "Ethereum",
networkId = "Ethereum",
networkId = "ethereum",
),
CryptoNetworkResponse(
id = 2,