From a07161aa9f001d343b082a485ca75610e67e6144 Mon Sep 17 00:00:00 2001 From: Ivan Grachyov Date: Thu, 26 Aug 2021 21:17:23 +0300 Subject: [PATCH] Update Strings --- Encrypted Ink/Agent.swift | 6 +++--- Encrypted Ink/Screens/AccountsListViewController.swift | 10 +++++----- Encrypted Ink/Screens/ImportViewController.swift | 4 ++-- Encrypted Ink/Strings.swift | 2 ++ Encrypted Ink/Views/Alert.swift | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Encrypted Ink/Agent.swift b/Encrypted Ink/Agent.swift index 905aa1ab..aaf0c3f9 100644 --- a/Encrypted Ink/Agent.swift +++ b/Encrypted Ink/Agent.swift @@ -161,8 +161,8 @@ class Agent: NSObject { alert.messageText = "Quit Encrypted Ink?" alert.informativeText = "You won't be able to sign requests." alert.alertStyle = .warning - alert.addButton(withTitle: "OK") - alert.addButton(withTitle: "Cancel") + alert.addButton(withTitle: Strings.ok) + alert.addButton(withTitle: Strings.cancel) if alert.runModal() == .alertFirstButtonReturn { NSApp.terminate(nil) } @@ -268,7 +268,7 @@ class Agent: NSObject { } if canDoLocalAuthentication { - context.localizedCancelTitle = "Cancel" + context.localizedCancelTitle = Strings.cancel didStartInitialLAEvaluation = true context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: reason.title) { [weak self] success, _ in DispatchQueue.main.async { diff --git a/Encrypted Ink/Screens/AccountsListViewController.swift b/Encrypted Ink/Screens/AccountsListViewController.swift index f5a7b1f0..d706c553 100644 --- a/Encrypted Ink/Screens/AccountsListViewController.swift +++ b/Encrypted Ink/Screens/AccountsListViewController.swift @@ -162,8 +162,8 @@ class AccountsListViewController: NSViewController { alert.messageText = "Back up new account." alert.informativeText = "You will see 12 secret words." alert.alertStyle = .critical - alert.addButton(withTitle: "OK") - alert.addButton(withTitle: "Cancel") + alert.addButton(withTitle: Strings.ok) + alert.addButton(withTitle: Strings.cancel) if alert.runModal() == .alertFirstButtonReturn { createNewAccountAndShowSecretWords() } @@ -214,7 +214,7 @@ class AccountsListViewController: NSViewController { alert.messageText = "Removed accounts can't be recovered." alert.alertStyle = .critical alert.addButton(withTitle: "Remove anyway") - alert.addButton(withTitle: "Cancel") + alert.addButton(withTitle: Strings.cancel) if alert.runModal() == .alertFirstButtonReturn { agent.askAuthentication(on: view.window, getBackTo: self, onStart: false, reason: .removeAccount) { [weak self] allowed in Window.activateWindow(self?.view.window) @@ -234,7 +234,7 @@ class AccountsListViewController: NSViewController { alert.messageText = "\(isMnemonic ? "Secret words give" : "Private key gives") full access to your funds." alert.alertStyle = .critical alert.addButton(withTitle: "I understand the risks") - alert.addButton(withTitle: "Cancel") + alert.addButton(withTitle: Strings.cancel) if alert.runModal() == .alertFirstButtonReturn { let reason: AuthenticationReason = isMnemonic ? .showSecretWords : .showPrivateKey agent.askAuthentication(on: view.window, getBackTo: self, onStart: false, reason: reason) { [weak self] allowed in @@ -264,7 +264,7 @@ class AccountsListViewController: NSViewController { alert.messageText = mnemonic ? "Secret words" : "Private key" alert.informativeText = secret alert.alertStyle = .informational - alert.addButton(withTitle: "OK") + alert.addButton(withTitle: Strings.ok) alert.addButton(withTitle: "Copy") if alert.runModal() != .alertFirstButtonReturn { NSPasteboard.general.clearAndSetString(secret) diff --git a/Encrypted Ink/Screens/ImportViewController.swift b/Encrypted Ink/Screens/ImportViewController.swift index 03edca7c..ebda6439 100644 --- a/Encrypted Ink/Screens/ImportViewController.swift +++ b/Encrypted Ink/Screens/ImportViewController.swift @@ -32,8 +32,8 @@ class ImportViewController: NSViewController { let alert = Alert() alert.messageText = "Enter keystore password." alert.alertStyle = .informational - alert.addButton(withTitle: "OK") - alert.addButton(withTitle: "Cancel") + alert.addButton(withTitle: Strings.ok) + alert.addButton(withTitle: Strings.cancel) let passwordTextField = NSSecureTextField(frame: NSRect(x: 0, y: 0, width: 160, height: 20)) passwordTextField.bezelStyle = .roundedBezel diff --git a/Encrypted Ink/Strings.swift b/Encrypted Ink/Strings.swift index 48d44abf..eccbf92f 100644 --- a/Encrypted Ink/Strings.swift +++ b/Encrypted Ink/Strings.swift @@ -8,5 +8,7 @@ struct Strings { static let signMessage = "Sign Message" static let signPersonalMessage = "Sign Personal Message" static let signTypedData = "Sign Typed Data" + static let cancel = "Cancel" + static let ok = "OK" } diff --git a/Encrypted Ink/Views/Alert.swift b/Encrypted Ink/Views/Alert.swift index e81d7168..2472098b 100644 --- a/Encrypted Ink/Views/Alert.swift +++ b/Encrypted Ink/Views/Alert.swift @@ -20,7 +20,7 @@ class Alert: NSAlert { let alert = Alert() alert.messageText = message alert.alertStyle = style - alert.addButton(withTitle: "OK") + alert.addButton(withTitle: Strings.ok) _ = alert.runModal() }