From c0cfc976e457a25707fc82076cd5e3a2f8d4f1cf Mon Sep 17 00:00:00 2001 From: Ivan Grachev Date: Thu, 25 Aug 2022 19:40:42 +0300 Subject: [PATCH] Do not show Ethereum networks list on Solana and NEAR account requests on iOS --- Shared/Strings.swift | 1 + .../Screens/Accounts/AccountsListViewController.swift | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Shared/Strings.swift b/Shared/Strings.swift index ce31aab2..5d8694f4 100644 --- a/Shared/Strings.swift +++ b/Shared/Strings.swift @@ -91,5 +91,6 @@ struct Strings { static let disconnect = "Disconnect" static let switchAccount = "Switch Account" static let switchAccountTwoLines = "Switch\nAccount" + static let unknownNetwork = "Unknown network ⚠️" } diff --git a/Tokenary iOS/Screens/Accounts/AccountsListViewController.swift b/Tokenary iOS/Screens/Accounts/AccountsListViewController.swift index 379f3f73..5636c8d9 100644 --- a/Tokenary iOS/Screens/Accounts/AccountsListViewController.swift +++ b/Tokenary iOS/Screens/Accounts/AccountsListViewController.swift @@ -110,7 +110,7 @@ class AccountsListViewController: UIViewController, DataStateContainer { } updatePrimaryButton() - if let network = selectAccountAction.network, self.network != network { + if let network = selectAccountAction.initialNetwork, self.network != network { selectNetwork(network) } @@ -261,6 +261,15 @@ class AccountsListViewController: UIViewController, DataStateContainer { } @IBAction func networkButtonTapped(_ sender: Any) { + guard selectAccountAction?.coinType == nil || selectAccountAction?.coinType == .ethereum else { + let networkName = selectAccountAction?.coinType?.name ?? Strings.unknownNetwork + let alert = UIAlertController(title: networkName, message: nil, preferredStyle: .alert) + let okAction = UIAlertAction(title: Strings.ok, style: .default) + alert.addAction(okAction) + present(alert, animated: true) + return + } + let actionSheet = UIAlertController(title: Strings.selectNetwork, message: nil, preferredStyle: .actionSheet) actionSheet.popoverPresentationController?.sourceView = networkButton for network in EthereumChain.allMainnets {