[iOS] Fix race in UI
FossilOrigin-Name: 18ce2e80c83083528be618b27b6b1c5bcb2a770d5d727d44fffc847cfa7491c1
This commit is contained in:
parent
06b0caf2cc
commit
8c7ec72780
1 changed files with 11 additions and 8 deletions
|
@ -131,7 +131,9 @@ class ShowDetailsController: UITableViewController, UITextFieldDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func generateWithCallback(_ block: (_: NSMutableString) -> ()) {
|
private func generateWithCallback(
|
||||||
|
_ block: @escaping (_: NSMutableString) -> ()
|
||||||
|
) {
|
||||||
let generator: PasswordGenerator = isLegacy ?
|
let generator: PasswordGenerator = isLegacy ?
|
||||||
LegacyPasswordGenerator() : NewPasswordGenerator()
|
LegacyPasswordGenerator() : NewPasswordGenerator()
|
||||||
generator.site = name.ofObject
|
generator.site = name.ofObject
|
||||||
|
@ -166,9 +168,9 @@ class ShowDetailsController: UITableViewController, UITextFieldDelegate {
|
||||||
|
|
||||||
DispatchQueue.global(qos: .default).async {
|
DispatchQueue.global(qos: .default).async {
|
||||||
generator.derivePassword()
|
generator.derivePassword()
|
||||||
}
|
|
||||||
|
|
||||||
let password = NSMutableString(bytes: generator.output.items,
|
let password = NSMutableString(
|
||||||
|
bytes: generator.output.items!,
|
||||||
length: generator.length,
|
length: generator.length,
|
||||||
encoding: String.Encoding.utf8.rawValue)!
|
encoding: String.Encoding.utf8.rawValue)!
|
||||||
|
|
||||||
|
@ -177,6 +179,7 @@ class ShowDetailsController: UITableViewController, UITextFieldDelegate {
|
||||||
block(password)
|
block(password)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@IBAction func remove(_ sender: Any?) {
|
@IBAction func remove(_ sender: Any?) {
|
||||||
let message = "Do you want to remove this site?"
|
let message = "Do you want to remove this site?"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue