mirror of
https://github.com/lil-org/tokenary.git
synced 2025-01-05 20:16:25 +03:00
Add menu item for enabling Safari extension. Remove WC instructions
This commit is contained in:
parent
5c1e918009
commit
9e13e2186e
@ -2,6 +2,7 @@
|
||||
|
||||
import Cocoa
|
||||
import WalletConnect
|
||||
import SafariServices
|
||||
import LocalAuthentication
|
||||
|
||||
class Agent: NSObject {
|
||||
@ -134,7 +135,7 @@ class Agent: NSObject {
|
||||
let menu = NSMenu(title: Strings.encryptedInk)
|
||||
|
||||
let showItem = NSMenuItem(title: Strings.showEncryptedInk, action: #selector(didSelectShowMenuItem), keyEquivalent: "")
|
||||
let howToItem = NSMenuItem(title: Strings.howToWalletConnect, action: #selector(showInstructionsAlert), keyEquivalent: "")
|
||||
let safariItem = NSMenuItem(title: Strings.enableSafariExtension, action: #selector(enableSafariExtension), keyEquivalent: "")
|
||||
let mailItem = NSMenuItem(title: Strings.dropUsALine, action: #selector(didSelectMailMenuItem), keyEquivalent: "")
|
||||
let githubItem = NSMenuItem(title: Strings.viewOnGithub, action: #selector(didSelectGitHubMenuItem), keyEquivalent: "")
|
||||
let twitterItem = NSMenuItem(title: Strings.viewOnTwitter, action: #selector(didSelectTwitterMenuItem), keyEquivalent: "")
|
||||
@ -142,7 +143,7 @@ class Agent: NSObject {
|
||||
showItem.attributedTitle = NSAttributedString(string: "👀 " + Strings.showEncryptedInk, attributes: [.font: NSFont.systemFont(ofSize: 15, weight: .semibold)])
|
||||
|
||||
showItem.target = self
|
||||
howToItem.target = self
|
||||
safariItem.target = self
|
||||
githubItem.target = self
|
||||
twitterItem.target = self
|
||||
mailItem.target = self
|
||||
@ -151,7 +152,7 @@ class Agent: NSObject {
|
||||
menu.delegate = self
|
||||
menu.addItem(showItem)
|
||||
menu.addItem(NSMenuItem.separator())
|
||||
menu.addItem(howToItem)
|
||||
menu.addItem(safariItem)
|
||||
menu.addItem(NSMenuItem.separator())
|
||||
menu.addItem(twitterItem)
|
||||
menu.addItem(githubItem)
|
||||
@ -189,9 +190,8 @@ class Agent: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func showInstructionsAlert() {
|
||||
Window.activateWindow(nil)
|
||||
Alert.showWalletConnectInstructions()
|
||||
@objc private func enableSafariExtension() {
|
||||
SFSafariApplication.showPreferencesForExtension(withIdentifier: "ink.encrypted.macos.Safari")
|
||||
}
|
||||
|
||||
@objc private func didSelectMailMenuItem() {
|
||||
|
@ -85,8 +85,6 @@ class AccountsListViewController: NSViewController {
|
||||
menu.addItem(.separator())
|
||||
menu.addItem(NSMenuItem(title: Strings.showAccountKey, action: #selector(didClickExportAccount(_:)), keyEquivalent: ""))
|
||||
menu.addItem(NSMenuItem(title: Strings.removeAccount, action: #selector(didClickRemoveAccount(_:)), keyEquivalent: ""))
|
||||
menu.addItem(.separator())
|
||||
menu.addItem(NSMenuItem(title: Strings.howToWalletConnect, action: #selector(showInstructionsAlert), keyEquivalent: ""))
|
||||
tableView.menu = menu
|
||||
}
|
||||
|
||||
@ -280,10 +278,6 @@ class AccountsListViewController: NSViewController {
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func showInstructionsAlert() {
|
||||
Alert.showWalletConnectInstructions()
|
||||
}
|
||||
|
||||
private func removeAccountAtIndex(_ index: Int) {
|
||||
let wallet = wallets[index]
|
||||
try? walletsManager.delete(wallet: wallet)
|
||||
|
@ -19,7 +19,7 @@ struct Strings {
|
||||
static let quit = "Quit"
|
||||
static let quitEncryptedInk = "Quit Encrypted Ink?"
|
||||
static let youWontBeAbleToSignRequests = "You won't be able to sign requests."
|
||||
static let howToWalletConnect = "How to WalletConnect?"
|
||||
static let enableSafariExtension = "Enable Safari extension…"
|
||||
static let dropUsALine = "Drop us a line…"
|
||||
static let viewOnGithub = "View on GitHub…"
|
||||
static let viewOnTwitter = "View on Twitter…"
|
||||
|
@ -12,10 +12,6 @@ class Alert: NSAlert {
|
||||
return super.runModal()
|
||||
}
|
||||
|
||||
static func showWalletConnectInstructions() {
|
||||
Alert.showWithMessage("1 — Open dapp website\n\n2 — Click “Copy to clipboard”\nunder WalletConnect QR code\n\n3 — Open Encrypted Ink", style: .informational)
|
||||
}
|
||||
|
||||
static func showWithMessage(_ message: String, style: NSAlert.Style) {
|
||||
let alert = Alert()
|
||||
alert.messageText = message
|
||||
|
Loading…
Reference in New Issue
Block a user