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,
|