mirror of
https://github.com/lil-org/tokenary.git
synced 2025-01-05 20:16:25 +03:00
Add more menu content
This commit is contained in:
parent
f734e658a7
commit
1594412b13
@ -113,12 +113,14 @@ class Agent: NSObject {
|
||||
let menu = NSMenu(title: "Encrypted Ink")
|
||||
|
||||
let showItem = NSMenuItem(title: "Show Encrypted Ink", action: #selector(didSelectShowMenuItem), keyEquivalent: "")
|
||||
let howToItem = NSMenuItem(title: "How to WalletConnect?", action: #selector(showInstructionsAlert), keyEquivalent: "")
|
||||
let mailItem = NSMenuItem(title: "Drop us a line…", action: #selector(didSelectMailMenuItem), keyEquivalent: "")
|
||||
let githubItem = NSMenuItem(title: "View on GitHub…", action: #selector(didSelectGitHubMenuItem), keyEquivalent: "")
|
||||
let quitItem = NSMenuItem(title: "Quit", action: #selector(didSelectQuitMenuItem), keyEquivalent: "q")
|
||||
showItem.attributedTitle = NSAttributedString(string: "👀 Show Encrypted Ink", attributes: [.font: NSFont.systemFont(ofSize: 21, weight: .bold)])
|
||||
|
||||
showItem.target = self
|
||||
howToItem.target = self
|
||||
githubItem.target = self
|
||||
mailItem.target = self
|
||||
quitItem.target = self
|
||||
@ -126,6 +128,8 @@ class Agent: NSObject {
|
||||
menu.delegate = self
|
||||
menu.addItem(showItem)
|
||||
menu.addItem(NSMenuItem.separator())
|
||||
menu.addItem(howToItem)
|
||||
menu.addItem(NSMenuItem.separator())
|
||||
menu.addItem(githubItem)
|
||||
menu.addItem(mailItem)
|
||||
menu.addItem(NSMenuItem.separator())
|
||||
@ -155,6 +159,11 @@ class Agent: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func showInstructionsAlert() {
|
||||
Window.activateWindow(nil)
|
||||
Alert.showWalletConnectInstructions()
|
||||
}
|
||||
|
||||
@objc private func didSelectMailMenuItem() {
|
||||
if let url = URL(string: "mailto:support@encrypted.ink") {
|
||||
NSWorkspace.shared.open(url)
|
||||
|
@ -48,9 +48,12 @@ class AccountsListViewController: NSViewController {
|
||||
let menu = NSMenu()
|
||||
menu.delegate = self
|
||||
menu.addItem(NSMenuItem(title: "Copy address", action: #selector(didClickCopyAddress(_:)), keyEquivalent: ""))
|
||||
menu.addItem(NSMenuItem(title: "View on Zerion", action: #selector(didClickViewOnZerion(_:)), keyEquivalent: ""))
|
||||
menu.addItem(.separator())
|
||||
menu.addItem(NSMenuItem(title: "Show private key", action: #selector(didClickExportAccount(_:)), keyEquivalent: "")) // TODO: show different texts for secret words export
|
||||
menu.addItem(NSMenuItem(title: "Remove account", action: #selector(didClickRemoveAccount(_:)), keyEquivalent: ""))
|
||||
menu.addItem(.separator())
|
||||
menu.addItem(NSMenuItem(title: "How to WalletConnect?", action: #selector(showInstructionsAlert), keyEquivalent: ""))
|
||||
tableView.menu = menu
|
||||
}
|
||||
|
||||
@ -104,6 +107,15 @@ class AccountsListViewController: NSViewController {
|
||||
view.window?.contentViewController = importViewController
|
||||
}
|
||||
|
||||
@objc private func didClickViewOnZerion(_ sender: AnyObject) {
|
||||
let row = tableView.deselectedRow
|
||||
guard row >= 0 else { return }
|
||||
let address = accounts[row].address
|
||||
if let url = URL(string: "https://app.zerion.io/\(address)/overview") {
|
||||
NSWorkspace.shared.open(url)
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func didClickCopyAddress(_ sender: AnyObject) {
|
||||
let row = tableView.deselectedRow
|
||||
guard row >= 0 else { return }
|
||||
@ -160,16 +172,8 @@ class AccountsListViewController: NSViewController {
|
||||
}
|
||||
}
|
||||
|
||||
private func showInstructionsAlert() {
|
||||
let alert = Alert()
|
||||
alert.messageText = "How to start?"
|
||||
alert.informativeText = "1. Open your favourite dapp.\n\n2. Press “Copy to clipboard”\nunder WalletConnect QR code.\n\n3. Launch Encrypted Ink."
|
||||
alert.alertStyle = .informational
|
||||
alert.addButton(withTitle: "OK")
|
||||
alert.addButton(withTitle: "Open Zerion")
|
||||
if alert.runModal() != .alertFirstButtonReturn, let url = URL(string: "https://app.zerion.io") {
|
||||
NSWorkspace.shared.open(url)
|
||||
}
|
||||
@objc private func showInstructionsAlert() {
|
||||
Alert.showWalletConnectInstructions()
|
||||
}
|
||||
|
||||
private func removeAccountAtIndex(_ index: Int) {
|
||||
|
@ -12,4 +12,12 @@ class Alert: NSAlert {
|
||||
return super.runModal()
|
||||
}
|
||||
|
||||
static func showWalletConnectInstructions() {
|
||||
let alert = Alert()
|
||||
alert.messageText = "1 — Open dapp website\n\n2 — Click “Copy to clipboard”\nunder WalletConnect QR code\n\n3 — Open Encrypted Ink"
|
||||
alert.alertStyle = .informational
|
||||
alert.addButton(withTitle: "OK")
|
||||
_ = alert.runModal()
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user