Updated on 2026-08-14

This commit is contained in:
Tangem 2024-12-03 12:16:15 +03:00
commit ab3ea0b32f
2 changed files with 20 additions and 1 deletions

View file

@ -50,7 +50,9 @@ class GetCryptoCurrencyActionsUseCase(
userWalletId = userWallet.walletId,
)
val networkId = cryptoCurrencyStatus.currency.network.id
val requirements = walletManagersFacade.getAssetRequirements(userWallet.walletId, cryptoCurrencyStatus.currency)
val requirements = withTimeoutOrNull(REQUEST_EXCHANGE_DATA_TIMEOUT) {
walletManagersFacade.getAssetRequirements(userWallet.walletId, cryptoCurrencyStatus.currency)
}
return flow {
val networkFlow = if (userWallet.scanResponse.cardTypesResolver.isSingleWalletWithToken()) {
operations.getNetworkCoinForSingleWalletWithTokenFlow(networkId)

View file

@ -124,6 +124,7 @@ internal class TokenDetailsViewModel @Inject constructor(
private val analyticsEventsHandler: AnalyticsEventHandler,
private val vibratorHapticManager: VibratorHapticManager,
private val clipboardManager: ClipboardManager,
private val getCryptoCurrencySyncUseCase: GetCryptoCurrencyStatusSyncUseCase,
getUserWalletUseCase: GetUserWalletUseCase,
getStakingIntegrationIdUseCase: GetStakingIntegrationIdUseCase,
deepLinksRegistry: DeepLinksRegistry,
@ -223,6 +224,7 @@ internal class TokenDetailsViewModel @Inject constructor(
event = TokenScreenAnalyticsEvent.DetailsScreenOpened(token = cryptoCurrency.symbol),
)
updateTopBarMenu()
initButtons()
updateContent()
handleBalanceHiding(owner)
}
@ -232,6 +234,21 @@ internal class TokenDetailsViewModel @Inject constructor(
super.onCleared()
}
private fun initButtons() {
// we need also init buttons before start all loading to avoid buttons blocking
viewModelScope.launch {
val currentCryptoCurrencyStatus = getCryptoCurrencySyncUseCase.invoke(
userWalletId = userWalletId,
cryptoCurrencyId = cryptoCurrency.id,
isSingleWalletWithTokens = false,
).getOrNull()
currentCryptoCurrencyStatus?.let {
cryptoCurrencyStatus = it
updateButtons(it)
}
}
}
private fun updateContent() {
subscribeOnCurrencyStatusUpdates()
subscribeOnExchangeTransactionsUpdates()