diff --git a/Tangem/Modules/SingleTokenBase/SingleTokenBaseViewModel.swift b/Tangem/Modules/SingleTokenBase/SingleTokenBaseViewModel.swift index b3801a2d91..5fb2780a75 100644 --- a/Tangem/Modules/SingleTokenBase/SingleTokenBaseViewModel.swift +++ b/Tangem/Modules/SingleTokenBase/SingleTokenBaseViewModel.swift @@ -129,7 +129,7 @@ class SingleTokenBaseViewModel: NotificationTapDelegate { Analytics.log(.refreshed) - if let id = walletModel.tokenItem.id, miniChartsProvider.items.isEmpty { + if let id = walletModel.tokenItem.currencyId, miniChartsProvider.items.isEmpty { miniChartsProvider.fetch(for: [id], with: miniChartPriceIntervalType) } @@ -311,7 +311,7 @@ extension SingleTokenBaseViewModel { } private func setupMiniChart() { - guard let id = walletModel.tokenItem.id else { + guard let id = walletModel.tokenItem.currencyId else { miniChartData = .failedToLoad(error: "") return } diff --git a/TangemExpress/Manager/ExpressManager/CommonExpressManager.swift b/TangemExpress/Manager/ExpressManager/CommonExpressManager.swift index 99aadababa..b4f602f78b 100644 --- a/TangemExpress/Manager/ExpressManager/CommonExpressManager.swift +++ b/TangemExpress/Manager/ExpressManager/CommonExpressManager.swift @@ -143,7 +143,7 @@ private extension CommonExpressManager { try Task.checkCancellation() - try await updateSelectedProviderIfNeeded() + await updateSelectedProvider() return try await selectedProviderState() } @@ -195,17 +195,11 @@ private extension CommonExpressManager { } } - func updateSelectedProviderIfNeeded() async throws { - let selectedIsError = await selectedProvider?.getState().isError + func updateSelectedProvider() async { + selectedProvider = await bestProvider() - // If we don't have selectedProvider - // Or if selectedProvider has an error - // just update it - if selectedProvider == nil || selectedIsError == true { - selectedProvider = await bestProvider() - if let selectedProvider { - analyticsLogger.bestProviderSelected(selectedProvider) - } + if let selectedProvider { + analyticsLogger.bestProviderSelected(selectedProvider) } }