mirror of
https://github.com/lil-org/tokenary.git
synced 2024-12-03 06:25:10 +03:00
Show alert with a network name when there are no other networks to select from on macOS
This commit is contained in:
parent
924fc986a6
commit
bb05355a6d
@ -11,7 +11,7 @@ extension CoinType {
|
||||
case .ethereum:
|
||||
return "Ethereum & L2s"
|
||||
case .near:
|
||||
return "Near"
|
||||
return "NEAR"
|
||||
default:
|
||||
fatalError(Strings.somethingWentWrong)
|
||||
}
|
||||
|
@ -163,8 +163,7 @@ class AccountsListViewController: NSViewController {
|
||||
websiteNameStackView.isHidden = true
|
||||
}
|
||||
|
||||
let canSelectNetworkForCurrentProvider = selectAccountAction?.coinType == .ethereum || selectAccountAction?.coinType == nil
|
||||
if canSelectAccount, networkButton.isHidden, canSelectNetworkForCurrentProvider {
|
||||
if canSelectAccount, networkButton.isHidden {
|
||||
networkButton.isHidden = false
|
||||
let menu = NSMenu()
|
||||
let titleItem = NSMenuItem(title: Strings.selectNetworkOptionally, action: nil, keyEquivalent: "")
|
||||
@ -193,7 +192,7 @@ class AccountsListViewController: NSViewController {
|
||||
if let network = selectAccountAction?.initialNetwork, network != self.network {
|
||||
selectNetwork(network)
|
||||
}
|
||||
} else if !(canSelectAccount && canSelectNetworkForCurrentProvider), !networkButton.isHidden {
|
||||
} else if !canSelectAccount, !networkButton.isHidden {
|
||||
networkButton.isHidden = true
|
||||
}
|
||||
}
|
||||
@ -216,6 +215,11 @@ class AccountsListViewController: NSViewController {
|
||||
}
|
||||
|
||||
@IBAction func networkButtonTapped(_ sender: NSButton) {
|
||||
guard selectAccountAction?.coinType == nil || selectAccountAction?.coinType == .ethereum else {
|
||||
Alert.showWithMessage(selectAccountAction?.coinType?.name ?? Strings.unknownNetwork, style: .informational)
|
||||
return
|
||||
}
|
||||
|
||||
var origin = sender.frame.origin
|
||||
origin.x += sender.frame.width
|
||||
origin.y += sender.frame.height
|
||||
|
Loading…
Reference in New Issue
Block a user