Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS-7680 Swap / Show best provider if client change amount to swap #3964

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading