Skip to content

Commit

Permalink
CBW-1601 pr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ramakser committed Mar 7, 2024
1 parent 1e94dc1 commit e7022ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Never>()

Expand Down Expand Up @@ -86,7 +86,7 @@ struct TokenLookupView: View {
.padding()
Spacer()
Button(action: {
displayContractTokens?(tokens, contractIndex)
displayContractTokens(tokens, contractIndex)
}) {
Text("Look for tokens")
.padding()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ final class CIS2TokenSelectViewModel: ObservableObject {
}

await MainActor.run {
isLoading = false
currentPage += 1
hasMore = !metadata.metadata.isEmpty

if currentPage == 1 {
tokens = representables
} else {
tokens += representables
}
currentPage += 1
isLoading = false
}
} catch {
await MainActor.run {
Expand Down

0 comments on commit e7022ab

Please sign in to comment.