[iOS] Fix race in UI

FossilOrigin-Name: 18ce2e80c83083528be618b27b6b1c5bcb2a770d5d727d44fffc847cfa7491c1
This commit is contained in:
Jonathan Schleifer 2022-06-15 18:38:46 +00:00
parent 06b0caf2cc
commit 8c7ec72780

View file

@ -131,7 +131,9 @@ class ShowDetailsController: UITableViewController, UITextFieldDelegate {
}
}
private func generateWithCallback(_ block: (_: NSMutableString) -> ()) {
private func generateWithCallback(
_ block: @escaping (_: NSMutableString) -> ()
) {
let generator: PasswordGenerator = isLegacy ?
LegacyPasswordGenerator() : NewPasswordGenerator()
generator.site = name.ofObject
@ -166,9 +168,9 @@ class ShowDetailsController: UITableViewController, UITextFieldDelegate {
DispatchQueue.global(qos: .default).async {
generator.derivePassword()
}
let password = NSMutableString(bytes: generator.output.items,
let password = NSMutableString(
bytes: generator.output.items!,
length: generator.length,
encoding: String.Encoding.utf8.rawValue)!
@ -177,6 +179,7 @@ class ShowDetailsController: UITableViewController, UITextFieldDelegate {
block(password)
}
}
}
@IBAction func remove(_ sender: Any?) {
let message = "Do you want to remove this site?"