From 749918ff8213f12fb946a21ee82198be158b3c16 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 14 Apr 2025 14:45:34 +0300 Subject: [PATCH 1/6] Updated on 2026-08-14 --- gradle/tangem_dependencies.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/tangem_dependencies.toml b/gradle/tangem_dependencies.toml index 4a299587fa..f20e30bf6c 100644 --- a/gradle/tangem_dependencies.toml +++ b/gradle/tangem_dependencies.toml @@ -5,7 +5,7 @@ # https://github.com/tangem/tangem-sdk-android/ # https://github.com/tangem/vico -tangemBlockchainSdk = "releases-5.23-1015" +tangemBlockchainSdk = "releases-5.23-1021" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds tangemCardSdk = "releases-5.23-456" #tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^ From 83ef0e94c7a14270f2a2f9a6ab4360b8160cfe4f Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 14 Apr 2025 15:25:16 +0000 Subject: [PATCH 2/6] Updated on 2026-08-14 --- gradle/tangem_dependencies.toml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gradle/tangem_dependencies.toml b/gradle/tangem_dependencies.toml index 2f75185ea7..f20e30bf6c 100644 --- a/gradle/tangem_dependencies.toml +++ b/gradle/tangem_dependencies.toml @@ -1,9 +1,15 @@ [versions] -tangemBlockchainSdk = "releases-5.22-1011" +# Blockchain SDK, Card SDK and Vico artifacts are built in a private namespace and then published to a +# public Maven repository, so anyone can build the app from source +# https://github.com/tangem/blockchain-sdk-kotlin/packages/ +# https://github.com/tangem/tangem-sdk-android/ +# https://github.com/tangem/vico + +tangemBlockchainSdk = "releases-5.23-1021" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds -tangemCardSdk = "release-app_5.22-440" +tangemCardSdk = "releases-5.23-456" #tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^ -tangemVico = "2.0.0-alpha.25-tangem-developments8" +tangemVico = "2.0.0-alpha.25-tangem12" #tangemVico = "0.0.1" # Keep it! - used for local builds ^ From 32887fb26d2ec79dae0a8cfa1648368897620e4c Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 14 Apr 2025 17:17:49 +0400 Subject: [PATCH 3/6] Updated on 2026-08-14 --- .../kotlin/com/tangem/domain/core/lce/Lce.kt | 6 ++++ .../CachedCurrenciesStatusesOperations.kt | 35 ++++++++++++++----- .../organizetokens/OrganizeTokensComponent.kt | 4 +-- .../model/OrganizeTokensModel.kt | 26 ++++++-------- 4 files changed, 43 insertions(+), 28 deletions(-) diff --git a/domain/core/src/main/kotlin/com/tangem/domain/core/lce/Lce.kt b/domain/core/src/main/kotlin/com/tangem/domain/core/lce/Lce.kt index 2d6902a58a..2fef58e761 100644 --- a/domain/core/src/main/kotlin/com/tangem/domain/core/lce/Lce.kt +++ b/domain/core/src/main/kotlin/com/tangem/domain/core/lce/Lce.kt @@ -146,4 +146,10 @@ sealed class Lce { ifContent = { predicate(it) }, ifError = { false }, ) + + fun onError(action: (error: E) -> Unit): Lce { + if (this is Error) action(this.error) + + return this + } } \ No newline at end of file diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CachedCurrenciesStatusesOperations.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CachedCurrenciesStatusesOperations.kt index 3334482cf9..4fea4f5fbd 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CachedCurrenciesStatusesOperations.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CachedCurrenciesStatusesOperations.kt @@ -30,7 +30,7 @@ import com.tangem.utils.extensions.addOrReplace import kotlinx.coroutines.* import kotlinx.coroutines.flow.* -@Suppress("LongParameterList") +@Suppress("LongParameterList", "LargeClass") class CachedCurrenciesStatusesOperations( private val currenciesRepository: CurrenciesRepository, private val quotesRepository: QuotesRepository, @@ -67,8 +67,6 @@ class CachedCurrenciesStatusesOperations( ): LceFlow> = lceFlow { val prevStatuses = MutableStateFlow(value = emptyList()) - val isUpdating = MutableStateFlow(value = true) - val nonEmptyCurrencies = currenciesFlow.mapNotNull { it.getOrNull() }.firstOrNull()?.toNonEmptyListOrNull() if (!isFetchingStarted(userWalletId) && nonEmptyCurrencies != null) { @@ -78,7 +76,7 @@ class CachedCurrenciesStatusesOperations( val (networks, currenciesIds) = getIds(nonEmptyCurrencies) fetchComponents(userWalletId, networks, currenciesIds, nonEmptyCurrencies) } - .invokeOnCompletion { isUpdating.value = false } + .invokeOnCompletion { setFetchFinished(userWalletId) } } currenciesFlow.flatMapLatest { maybeCurrencies -> @@ -137,14 +135,18 @@ class CachedCurrenciesStatusesOperations( fetchComponents(userWalletId, networks, currenciesIds, currencies) } - .invokeOnCompletion { isUpdating.value = false } + .invokeOnCompletion { setFetchFinished(userWalletId) } } combine( flow = getQuotes(currenciesIds), flow2 = getNetworksStatuses(userWalletId, networks), flow3 = getYieldBalances(userWalletId, currencies), - flow4 = isUpdating, + flow4 = fetchingState.map { + val state = it[userWalletId] ?: return@map false + + !state.isFinished() + }, transform = ::createCurrenciesStatuses, ) .distinctUntilChanged() @@ -362,20 +364,35 @@ class CachedCurrenciesStatusesOperations( } private fun isFetchingStarted(userWalletId: UserWalletId): Boolean { - return fetchingState.value[userWalletId] ?: false + return fetchingState.value[userWalletId]?.let { it.isStarted() || it.isFinished() } ?: false } private fun setFetchStarted(userWalletId: UserWalletId) { fetchingState.update { it.toMutableMap().apply { - put(key = userWalletId, value = true) + put(key = userWalletId, value = FetchingState.STARTED) } } } + private fun setFetchFinished(userWalletId: UserWalletId) { + fetchingState.update { + it.toMutableMap().apply { + put(key = userWalletId, value = FetchingState.FINISHED) + } + } + } + + enum class FetchingState { + STARTED, FINISHED; + + fun isStarted() = this == STARTED + fun isFinished() = this == FINISHED + } + companion object { internal const val RETRY_DELAY = 2000L - private val fetchingState = MutableStateFlow(value = emptyMap()) + private val fetchingState = MutableStateFlow(value = emptyMap()) } } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/organizetokens/OrganizeTokensComponent.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/organizetokens/OrganizeTokensComponent.kt index 2763610e1f..495ea6f0ca 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/organizetokens/OrganizeTokensComponent.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/organizetokens/OrganizeTokensComponent.kt @@ -32,8 +32,6 @@ internal class OrganizeTokensComponent( override fun Content(modifier: Modifier) { val uiState by model.uiState.collectAsStateWithLifecycle() - OrganizeTokensScreen( - state = uiState, - ) + OrganizeTokensScreen(state = uiState) } } \ No newline at end of file diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/organizetokens/model/OrganizeTokensModel.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/organizetokens/model/OrganizeTokensModel.kt index 9d064cf565..0cc0cdffde 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/organizetokens/model/OrganizeTokensModel.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/child/organizetokens/model/OrganizeTokensModel.kt @@ -10,11 +10,12 @@ import com.tangem.core.decompose.model.ParamsContainer import com.tangem.domain.appcurrency.GetSelectedAppCurrencyUseCase import com.tangem.domain.appcurrency.model.AppCurrency import com.tangem.domain.balancehiding.GetBalanceHidingSettingsUseCase -import com.tangem.domain.core.utils.getOrElse +import com.tangem.domain.core.lce.Lce import com.tangem.domain.tokens.ApplyTokenListSortingUseCase import com.tangem.domain.tokens.GetTokenListUseCase import com.tangem.domain.tokens.ToggleTokenListGroupingUseCase import com.tangem.domain.tokens.ToggleTokenListSortingUseCase +import com.tangem.domain.tokens.error.TokenListError import com.tangem.domain.tokens.model.TokenList import com.tangem.feature.wallet.child.organizetokens.OrganizeTokensComponent import com.tangem.feature.wallet.presentation.organizetokens.OrganizeTokensIntents @@ -36,13 +37,13 @@ import javax.inject.Inject @ModelScoped internal class OrganizeTokensModel @Inject constructor( paramsContainer: ParamsContainer, + getBalanceHidingSettingsUseCase: GetBalanceHidingSettingsUseCase, override val dispatchers: CoroutineDispatcherProvider, private val getTokenListUseCase: GetTokenListUseCase, private val toggleTokenListGroupingUseCase: ToggleTokenListGroupingUseCase, private val toggleTokenListSortingUseCase: ToggleTokenListSortingUseCase, private val applyTokenListSortingUseCase: ApplyTokenListSortingUseCase, private val getSelectedAppCurrencyUseCase: GetSelectedAppCurrencyUseCase, - private val getBalanceHidingSettingsUseCase: GetBalanceHidingSettingsUseCase, private val analyticsEventsHandler: AnalyticsEventHandler, ) : Model(), OrganizeTokensIntents { @@ -167,21 +168,14 @@ internal class OrganizeTokensModel @Inject constructor( } private suspend fun getTokenList(): TokenList? { - val tokenList = getTokenListUseCase.launch(userWalletId) - .transform { maybeTokenList -> - val tokenList = maybeTokenList.getOrElse( - ifLoading = { return@transform }, - ifError = { error -> - stateHolder.updateStateWithError(error) + val maybeTokenList = getTokenListUseCase.launch(userWalletId) + .filterNot(Lce::isLoading) + .firstOrNull() + ?: return null - return@transform - }, - ) - - emit(tokenList) - } - - return tokenList.firstOrNull() + return maybeTokenList + .onError(stateHolder::updateStateWithError) + .getOrNull(isPartialContentAccepted = false) } private fun bootstrapDragAndDropUpdates() { From 0760d4e062f28f092d2a500dd956a6b340b73d99 Mon Sep 17 00:00:00 2001 From: Tangem Date: Mon, 14 Apr 2025 18:07:03 +0400 Subject: [PATCH 4/6] Updated on 2026-08-14 --- .../wallet/domain/GetMultiWalletWarningsFactory.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt index 6fe75e5285..5ca74067c5 100644 --- a/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt +++ b/features/wallet/impl/src/main/java/com/tangem/feature/wallet/presentation/wallet/domain/GetMultiWalletWarningsFactory.kt @@ -16,8 +16,8 @@ import com.tangem.domain.wallets.models.SeedPhraseNotificationsStatus import com.tangem.domain.wallets.models.UserWallet import com.tangem.domain.wallets.usecase.IsNeedToBackupUseCase import com.tangem.domain.wallets.usecase.SeedPhraseNotificationUseCase -import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotification import com.tangem.feature.wallet.child.wallet.model.intents.WalletClickIntents +import com.tangem.feature.wallet.presentation.wallet.state.model.WalletNotification import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.flow.Flow @@ -179,7 +179,7 @@ internal class GetMultiWalletWarningsFactory @Inject constructor( } private fun Lce.getMissingAddressCurrencies(): List { - val tokenList = getOrNull(isPartialContentAccepted = false) ?: return emptyList() + val tokenList = getOrNull(isPartialContentAccepted = true) ?: return emptyList() return tokenList .flattenCurrencies() From d7eb45859d20ca9d5aea35adda175aa771d2e611 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 15 Apr 2025 09:45:28 +0400 Subject: [PATCH 5/6] Updated on 2026-08-14 --- gradle/tangem_dependencies.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/tangem_dependencies.toml b/gradle/tangem_dependencies.toml index f20e30bf6c..c6bc2129f5 100644 --- a/gradle/tangem_dependencies.toml +++ b/gradle/tangem_dependencies.toml @@ -5,7 +5,7 @@ # https://github.com/tangem/tangem-sdk-android/ # https://github.com/tangem/vico -tangemBlockchainSdk = "releases-5.23-1021" +tangemBlockchainSdk = "releases-5.23-1026" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds tangemCardSdk = "releases-5.23-456" #tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^ @@ -21,4 +21,4 @@ card-core = { module = "com.tangem.tangem-sdk-kotlin:core", version.ref = "tange vico-compose = { group = "com.tangem.vico", name = "compose", version.ref = "tangemVico" } vico-compose-m3 = { group = "com.tangem.vico", name = "compose-m3", version.ref = "tangemVico" } -vico-core = { group = "com.tangem.vico", name = "core", version.ref = "tangemVico" } \ No newline at end of file +vico-core = { group = "com.tangem.vico", name = "core", version.ref = "tangemVico" } From 29c57b05882e957bdc041d281509ec46ec6f74c6 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 15 Apr 2025 09:19:18 +0000 Subject: [PATCH 6/6] Updated on 2026-08-14 --- gradle/tangem_dependencies.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/tangem_dependencies.toml b/gradle/tangem_dependencies.toml index c6bc2129f5..55d8cba764 100644 --- a/gradle/tangem_dependencies.toml +++ b/gradle/tangem_dependencies.toml @@ -5,9 +5,9 @@ # https://github.com/tangem/tangem-sdk-android/ # https://github.com/tangem/vico -tangemBlockchainSdk = "releases-5.23-1026" +tangemBlockchainSdk = "develop-1022" #tangemBlockchainSdk = "0.0.1" # Keep it! - used for local builds -tangemCardSdk = "releases-5.23-456" +tangemCardSdk = "develop-455" #tangemCardSdk = "0.0.1" # Keep it! - used for local builds ^ tangemVico = "2.0.0-alpha.25-tangem12" #tangemVico = "0.0.1" # Keep it! - used for local builds ^ @@ -21,4 +21,4 @@ card-core = { module = "com.tangem.tangem-sdk-kotlin:core", version.ref = "tange vico-compose = { group = "com.tangem.vico", name = "compose", version.ref = "tangemVico" } vico-compose-m3 = { group = "com.tangem.vico", name = "compose-m3", version.ref = "tangemVico" } -vico-core = { group = "com.tangem.vico", name = "core", version.ref = "tangemVico" } +vico-core = { group = "com.tangem.vico", name = "core", version.ref = "tangemVico" } \ No newline at end of file