CryptoPassphrase  Check-in [18ce2e80c8]

Overview
Comment:[iOS] Fix race in UI
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 18ce2e80c83083528be618b27b6b1c5bcb2a770d5d727d44fffc847cfa7491c1
User & Date: js on 2022-06-15 18:38:46
Other Links: manifest | tags
Context
2022-06-15
18:53
[iOS] Clean up Xcode project check-in: 5a2cc30911 user: js tags: trunk
18:38
[iOS] Fix race in UI check-in: 18ce2e80c8 user: js tags: trunk
18:37
[iOS] Fix new Swift warning check-in: a5a265ded5 user: js tags: trunk
Changes

Modified iOS/ShowDetailsController.swift from [b276f25352] to [161a2ecc95].

127
128
129
130
131
132
133
134



135
136
137
138
139
140
141
127
128
129
130
131
132
133

134
135
136
137
138
139
140
141
142
143







-
+
+
+








            self.present(alert, animated: true) {
                ShowDetailsController.clearNSMutableString(password)
            }
        }
    }

    private func generateWithCallback(_ block: (_: NSMutableString) -> ()) {
    private func generateWithCallback(
        _ block: @escaping (_: NSMutableString) -> ()
    ) {
        let generator: PasswordGenerator = isLegacy ?
            LegacyPasswordGenerator() : NewPasswordGenerator()
        generator.site = name.ofObject
        generator.length = size_t(length)

        if let keyFile = keyFile {
            guard let documentDirectory = NSSearchPathForDirectoriesInDomains(
162
163
164
165
166
167
168
169
170
171
172
173





174
175
176
177




178
179
180
181
182
183
184
164
165
166
167
168
169
170





171
172
173
174
175
176



177
178
179
180
181
182
183
184
185
186
187







-
-
-
-
-
+
+
+
+
+

-
-
-
+
+
+
+







        let mainStoryboard = UIStoryboard(name: "Main", bundle: nil)
        let activityController = mainStoryboard.instantiateViewController(
            withIdentifier: "activityIndicator")
        navigationController?.view.addSubview(activityController.view)

        DispatchQueue.global(qos: .default).async {
            generator.derivePassword()
        }

        let password = NSMutableString(bytes: generator.output.items,
                                       length: generator.length,
                                       encoding: String.Encoding.utf8.rawValue)!

            let password = NSMutableString(
                bytes: generator.output.items!,
                length: generator.length,
                encoding: String.Encoding.utf8.rawValue)!

        DispatchQueue.main.sync {
            activityController.view.isHidden = true
            block(password)
            DispatchQueue.main.sync {
                activityController.view.isHidden = true
                block(password)
            }
        }
    }

    @IBAction func remove(_ sender: Any?) {
        let message = "Do you want to remove this site?"
        let alert = UIAlertController(title: "Remove Site?",
                                      message: message,