From e7022abc7a99537f7b6b9a6688940be86e82eef8 Mon Sep 17 00:00:00 2001 From: Maksym Rachytskyy Date: Thu, 7 Mar 2024 13:41:20 +0200 Subject: [PATCH] CBW-1601 pr fixes --- .../TokenLookup/CIS2TokensCoordinator.swift | 10 ++++++---- .../AccountDetails/TokenLookup/TokenLookupView.swift | 4 ++-- .../TokenSelectionView/CIS2TokenSelectViewModel.swift | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ConcordiumWallet/Views/AccountsView/AccountDetails/TokenLookup/CIS2TokensCoordinator.swift b/ConcordiumWallet/Views/AccountsView/AccountDetails/TokenLookup/CIS2TokensCoordinator.swift index 0c93152a..eea35591 100644 --- a/ConcordiumWallet/Views/AccountsView/AccountDetails/TokenLookup/CIS2TokensCoordinator.swift +++ b/ConcordiumWallet/Views/AccountsView/AccountDetails/TokenLookup/CIS2TokensCoordinator.swift @@ -23,10 +23,12 @@ class CIS2TokensCoordinator: Coordinator, AccountAddressQRCoordinatorDelegate { } func start() { - var view = TokenLookupView(service: dependencyProvider.cis2Service(), account: account) - view.displayContractTokens = { [weak self] tokens, contractIndex in - self?.showTokenSelectionView(with: tokens, contractIndex: contractIndex) - } + var view = TokenLookupView( + service: dependencyProvider.cis2Service(), + account: account, + displayContractTokens: { [weak self] tokens, contractIndex in + self?.showTokenSelectionView(with: tokens, contractIndex: contractIndex) + }) navigationController.setNavigationBarHidden(true, animated: false) navigationController.setViewControllers([UIHostingController(rootView: view)], animated: false) } diff --git a/ConcordiumWallet/Views/AccountsView/AccountDetails/TokenLookup/TokenLookupView.swift b/ConcordiumWallet/Views/AccountsView/AccountDetails/TokenLookup/TokenLookupView.swift index 5574be4b..677d8b9a 100644 --- a/ConcordiumWallet/Views/AccountsView/AccountDetails/TokenLookup/TokenLookupView.swift +++ b/ConcordiumWallet/Views/AccountsView/AccountDetails/TokenLookup/TokenLookupView.swift @@ -30,7 +30,7 @@ struct TokenLookupView: View { var service: CIS2ServiceProtocol var account: AccountDataType - var displayContractTokens: ((_ tokens: [CIS2Token], _ contractIndex: String) -> Void)? + var displayContractTokens: ((_ tokens: [CIS2Token], _ contractIndex: String) -> Void) private let tokenIndexPublisher = PassthroughSubject() @@ -86,7 +86,7 @@ struct TokenLookupView: View { .padding() Spacer() Button(action: { - displayContractTokens?(tokens, contractIndex) + displayContractTokens(tokens, contractIndex) }) { Text("Look for tokens") .padding() diff --git a/ConcordiumWallet/Views/AccountsView/AccountDetails/TokenSelectionView/CIS2TokenSelectViewModel.swift b/ConcordiumWallet/Views/AccountsView/AccountDetails/TokenSelectionView/CIS2TokenSelectViewModel.swift index 64ede349..e22a15f0 100644 --- a/ConcordiumWallet/Views/AccountsView/AccountDetails/TokenSelectionView/CIS2TokenSelectViewModel.swift +++ b/ConcordiumWallet/Views/AccountsView/AccountDetails/TokenSelectionView/CIS2TokenSelectViewModel.swift @@ -72,8 +72,6 @@ final class CIS2TokenSelectViewModel: ObservableObject { } await MainActor.run { - isLoading = false - currentPage += 1 hasMore = !metadata.metadata.isEmpty if currentPage == 1 { @@ -81,6 +79,8 @@ final class CIS2TokenSelectViewModel: ObservableObject { } else { tokens += representables } + currentPage += 1 + isLoading = false } } catch { await MainActor.run {