From f6ae749f73d9dd064f89511495536d533b310a3e Mon Sep 17 00:00:00 2001 From: Ivan Grachev Date: Wed, 24 Aug 2022 17:39:03 +0300 Subject: [PATCH] Setup connect button on iOS --- .../Screens/Accounts/AccountsListViewController.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Tokenary iOS/Screens/Accounts/AccountsListViewController.swift b/Tokenary iOS/Screens/Accounts/AccountsListViewController.swift index a695bbde..795a5381 100644 --- a/Tokenary iOS/Screens/Accounts/AccountsListViewController.swift +++ b/Tokenary iOS/Screens/Accounts/AccountsListViewController.swift @@ -96,6 +96,10 @@ class AccountsListViewController: UIViewController, DataStateContainer { tableView.contentInset.top += 70 tableView.verticalScrollIndicatorInsets.bottom += bottomOverlayHeight + // TODO: select all correct initiall cells +// tableView.selectRow(at: IndexPath(row: 0, section: 0), animated: true, scrollPosition: .none) + updatePrimaryButton() + if let peer = selectAccountAction?.peer { websiteNameLabel.text = peer.name if let urlString = peer.iconURLString, let url = URL(string: urlString) { @@ -136,6 +140,10 @@ class AccountsListViewController: UIViewController, DataStateContainer { } } + private func updatePrimaryButton() { + primaryButton.isEnabled = selectAccountAction?.selectedAccounts.isEmpty == false + } + private func updateCellModels() { sections = [] var privateKeyAccountCellModels = [CellModel]() @@ -523,10 +531,12 @@ extension AccountsListViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) { // TODO: implement deselect + updatePrimaryButton() } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { // TODO: implement new account selection logic + updatePrimaryButton() return tableView.deselectRow(at: indexPath, animated: true)