Refresh the password table after getting the next HOTP password.
This commit is contained in:
parent
d49cbb9754
commit
131c3af873
1 changed files with 18 additions and 13 deletions
|
|
@ -106,6 +106,7 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
|
||||||
self.passwordStore.pgpKeyPassphrase = passphrase
|
self.passwordStore.pgpKeyPassphrase = passphrase
|
||||||
}
|
}
|
||||||
DispatchQueue.global(qos: .userInitiated).async {
|
DispatchQueue.global(qos: .userInitiated).async {
|
||||||
|
// decrypt password
|
||||||
do {
|
do {
|
||||||
self.password = try self.passwordEntity!.decrypt(passphrase: passphrase)!
|
self.password = try self.passwordEntity!.decrypt(passphrase: passphrase)!
|
||||||
} catch {
|
} catch {
|
||||||
|
|
@ -118,22 +119,25 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// display password
|
||||||
let password = self.password!
|
self.showPassword()
|
||||||
DispatchQueue.main.async { [weak self] in
|
|
||||||
self?.showPassword(password: password)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func showPassword(password: Password) {
|
func showPassword() {
|
||||||
setTableData()
|
DispatchQueue.main.async { [weak self] in
|
||||||
self.tableView.reloadData()
|
self?.indicator.stopAnimating()
|
||||||
indicator.stopAnimating()
|
self?.setTableData()
|
||||||
editUIBarButtonItem.isEnabled = true
|
UIView.performWithoutAnimation {
|
||||||
if let urlString = password.getURLString() {
|
self?.tableView.reloadData()
|
||||||
if self.passwordEntity?.image == nil{
|
// add layoutIfNeeded solves the "flickering problem" during refresh
|
||||||
self.updatePasswordImage(urlString: urlString)
|
self?.tableView.layoutIfNeeded()
|
||||||
|
}
|
||||||
|
self?.editUIBarButtonItem.isEnabled = true
|
||||||
|
if let urlString = self?.password?.getURLString() {
|
||||||
|
if self?.passwordEntity?.image == nil{
|
||||||
|
self?.updatePasswordImage(urlString: urlString)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -384,6 +388,7 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
|
||||||
|
|
||||||
private func addNotificationObservers() {
|
private func addNotificationObservers() {
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(setShouldPopCurrentView), name: .passwordStoreChangeDiscarded, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(setShouldPopCurrentView), name: .passwordStoreChangeDiscarded, object: nil)
|
||||||
|
NotificationCenter.default.addObserver(self, selector: #selector(showPassword), name: .passwordStoreUpdated, object: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func setShouldPopCurrentView() {
|
func setShouldPopCurrentView() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue