Add hints about how to download keys (fix #215)

This commit is contained in:
Yishi Lin 2018-09-30 23:11:48 +08:00
parent 51680c3ddd
commit 15e90198fe
6 changed files with 250 additions and 57 deletions

View file

@ -16,8 +16,6 @@ class GitSSHKeyArmorSettingTableViewController: UITableViewController, UITextVie
var gitSSHPrivateKeyPassphrase: String?
let passwordStore = PasswordStore.shared
private var recentPastedText = ""
class ScannedSSHKey {
static let maxNumberOfGif = 100
var numberOfSegments = 0
@ -95,14 +93,8 @@ class GitSSHKeyArmorSettingTableViewController: UITableViewController, UITextVie
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
if text == UIPasteboard.general.string {
// user pastes something, get ready to clear in 10s
recentPastedText = text
DispatchQueue.global(qos: .background).asyncAfter(deadline: DispatchTime.now() + 10) { [weak weakSelf = self] in
if let pasteboardString = UIPasteboard.general.string,
pasteboardString == weakSelf?.recentPastedText {
UIPasteboard.general.string = ""
}
}
// user pastes something, do the copy here again and clear the pasteboard in 45s
SecurePasteboard.shared.copy(textToCopy: text)
}
return true
}

View file

@ -240,7 +240,7 @@ class GitServerSettingTableViewController: UITableViewController {
fileActionTitle.append(" (Tips)")
let fileAction = UIAlertAction(title: fileActionTitle, style: .default) { _ in
let title = "Tips"
let message = "Copy your private key to Pass with the name \"ssh_key\" (without quotes) via iTunes. Then come back and click \"iTunes File Sharing\" to finish."
let message = "Copy your ASCII-armored private key to Pass with the name \"ssh_key\" (without quotes) via iTunes. Then come back and click \"iTunes File Sharing\" to finish."
Utils.alert(title: title, message: message, controller: self)
}
optionMenu.addAction(fileAction)

View file

@ -18,8 +18,6 @@ class PGPKeyArmorSettingTableViewController: UITableViewController, UITextViewDe
var pgpPassphrase: String?
let passwordStore = PasswordStore.shared
private var recentPastedText = ""
class ScannedPGPKey {
static let maxNumberOfGif = 100
enum KeyType {
@ -143,14 +141,8 @@ class PGPKeyArmorSettingTableViewController: UITableViewController, UITextViewDe
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
if text == UIPasteboard.general.string {
// user pastes something, get ready to clear in 10s
recentPastedText = text
DispatchQueue.global(qos: .background).asyncAfter(deadline: DispatchTime.now() + 10) { [weak weakSelf = self] in
if let pasteboardString = UIPasteboard.general.string,
pasteboardString == weakSelf?.recentPastedText {
UIPasteboard.general.string = ""
}
}
// user pastes something, do the copy here again and clear the pasteboard in 45s
SecurePasteboard.shared.copy(textToCopy: text)
}
return true
}

View file

@ -65,4 +65,6 @@ class PGPKeySettingTableViewController: UITableViewController {
})
self.present(savePassphraseAlert, animated: true, completion: nil)
}
}

View file

@ -230,7 +230,7 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
fileActionTitle.append(" (Tips)")
let fileAction = UIAlertAction(title: fileActionTitle, style: .default) { _ in
let title = "Tips"
let message = "Copy your public and private keys to Pass with names \"gpg_key.pub\" and \"gpg_key\" (without quotes) via iTunes. Then come back and click \"iTunes File Sharing\" to finish."
let message = "Copy your ASCII-armored public and private keys to Pass with names \"gpg_key.pub\" and \"gpg_key\" (without quotes) via iTunes. Then come back and click \"iTunes File Sharing\" to finish."
Utils.alert(title: title, message: message, controller: self)
}
optionMenu.addAction(fileAction)