show error message if PGP key is not set (fix #1)
This commit is contained in:
parent
452316d909
commit
81b707266d
1 changed files with 18 additions and 1 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import Result
|
import Result
|
||||||
import SVProgressHUD
|
import SVProgressHUD
|
||||||
|
import SwiftyUserDefaults
|
||||||
|
|
||||||
class PasswordsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
|
class PasswordsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
|
||||||
private var passwordEntities: [PasswordEntity]?
|
private var passwordEntities: [PasswordEntity]?
|
||||||
|
|
@ -31,7 +32,6 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
}
|
}
|
||||||
|
|
||||||
func syncPasswords() {
|
func syncPasswords() {
|
||||||
SVProgressHUD.setDefaultMaskType(.black)
|
|
||||||
SVProgressHUD.show(withStatus: "Sync Password Store")
|
SVProgressHUD.show(withStatus: "Sync Password Store")
|
||||||
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in
|
DispatchQueue.global(qos: .userInitiated).async { [unowned self] in
|
||||||
do {
|
do {
|
||||||
|
|
@ -69,6 +69,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
searchBarView.addSubview(searchController.searchBar)
|
searchBarView.addSubview(searchController.searchBar)
|
||||||
view.addSubview(searchBarView)
|
view.addSubview(searchBarView)
|
||||||
tableView.insertSubview(refreshControl, at: 0)
|
tableView.insertSubview(refreshControl, at: 0)
|
||||||
|
SVProgressHUD.setDefaultMaskType(.black)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
|
|
@ -152,6 +153,22 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
print("actOnPasswordUpdatedNotification")
|
print("actOnPasswordUpdatedNotification")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
|
||||||
|
if identifier == "showPasswordDetail" {
|
||||||
|
if Defaults[.pgpKeyID] == "" {
|
||||||
|
let alert = UIAlertController(title: "Unable to Decrypt Password", message: "PGP Key is not set. Please set your PGP Key first.", preferredStyle: UIAlertControllerStyle.alert)
|
||||||
|
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
|
||||||
|
self.present(alert, animated: true, completion: nil)
|
||||||
|
if let s = sender as? UITableViewCell {
|
||||||
|
let selectedIndexPath = tableView.indexPath(for: s)!
|
||||||
|
tableView.deselectRow(at: selectedIndexPath, animated: true)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||||
if segue.identifier == "showPasswordDetail" {
|
if segue.identifier == "showPasswordDetail" {
|
||||||
if let viewController = segue.destination as? PasswordDetailTableViewController {
|
if let viewController = segue.destination as? PasswordDetailTableViewController {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue