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

@ -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
}