Skip to content

Commit

Permalink
Merge branch 'releases/5.16' into bugfix/IOS-8081_make_fix_analytics_…
Browse files Browse the repository at this point in the history
…manage_tokens
  • Loading branch information
skibinalexander authored Sep 28, 2024
2 parents 3c5a9ad + 46ec5f0 commit 02673a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Tangem/Modules/SingleTokenBase/SingleTokenBaseViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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
}
Expand Down
16 changes: 5 additions & 11 deletions TangemExpress/Manager/ExpressManager/CommonExpressManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private extension CommonExpressManager {

try Task.checkCancellation()

try await updateSelectedProviderIfNeeded()
await updateSelectedProvider()

return try await selectedProviderState()
}
Expand Down Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 02673a0

Please sign in to comment.