handle wrong GPG passphrase

This commit is contained in:
Bob Sun 2017-02-06 14:28:57 +08:00
parent c50cf8e0a7
commit fd8cb300d7
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
3 changed files with 46 additions and 31 deletions

View file

@ -10,6 +10,7 @@ import UIKit
class PasswordDetailTableViewController: UITableViewController, UIGestureRecognizerDelegate {
var passwordEntity: PasswordEntity?
var password = Password()
struct TableCell {
var title: String
@ -26,7 +27,15 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(UINib(nibName: "LabelTableViewCell", bundle: nil), forCellReuseIdentifier: "labelCell")
let password = passwordEntity!.decrypt()!
do {
password = try passwordEntity!.decrypt()!
} catch {
let alert = UIAlertController(title: "Cannot Show Password", message: error.localizedDescription, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: {(UIAlertAction) -> Void in
self.navigationController!.popViewController(animated: true)
}))
self.present(alert, animated: true, completion: nil)
}
var tableDataIndex = 0
tableData.append(TableSection(title: "", item: []))