Debug
This commit is contained in:
parent
0338b976d4
commit
0307eba6ef
|
@ -495,6 +495,8 @@
|
|||
"modal_clear_all_data_title" = "Clear All Data";
|
||||
"modal_clear_all_data_explanation" = "This will permanently delete your messages, sessions, and contacts.";
|
||||
"modal_clear_all_data_explanation_2" = "Would you like to clear only this device, or delete your entire account?";
|
||||
"dialog_clear_all_data_deletion_failed_1" = "Data not deleted by 1 Service Node. Service Node ID: %@.";
|
||||
"dialog_clear_all_data_deletion_failed_2" = "Data not deleted by %@ Service Nodes. Service Node IDs: %@.";
|
||||
"modal_clear_all_data_device_only_button_title" = "Device Only";
|
||||
"modal_clear_all_data_entire_account_button_title" = "Entire Account";
|
||||
"vc_qr_code_title" = "QR Code";
|
||||
|
|
|
@ -132,11 +132,29 @@ final class NukeDataModal : Modal {
|
|||
|
||||
@objc private func clearEntireAccount() {
|
||||
ModalActivityIndicatorViewController.present(fromViewController: self, canCancel: false) { [weak self] _ in
|
||||
SnodeAPI.clearAllData().ensure(on: DispatchQueue.main) {
|
||||
SnodeAPI.clearAllData().done(on: DispatchQueue.main) { confirmations in
|
||||
self?.dismiss(animated: true, completion: nil) // Dismiss the loader
|
||||
let potentiallyMaliciousSnodes = confirmations.compactMap { $0.value == false ? $0.key : nil }
|
||||
if potentiallyMaliciousSnodes.isEmpty {
|
||||
UserDefaults.removeAll() // Not done in the nuke data implementation as unlinking requires this to happen later
|
||||
NotificationCenter.default.post(name: .dataNukeRequested, object: nil)
|
||||
}.retainUntilComplete()
|
||||
} else {
|
||||
let message: String
|
||||
if potentiallyMaliciousSnodes.count == 1 {
|
||||
message = String(format: NSLocalizedString("dialog_clear_all_data_deletion_failed_1", comment: ""), potentiallyMaliciousSnodes[0])
|
||||
} else {
|
||||
message = String(format: NSLocalizedString("dialog_clear_all_data_deletion_failed_2", comment: ""), String(potentiallyMaliciousSnodes.count), potentiallyMaliciousSnodes.joined(separator: ", "))
|
||||
}
|
||||
let alert = UIAlertController(title: "Error", message: message, preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
|
||||
self?.presentAlert(alert)
|
||||
}
|
||||
}.catch(on: DispatchQueue.main) { error in
|
||||
self?.dismiss(animated: true, completion: nil) // Dismiss the loader
|
||||
let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil))
|
||||
self?.presentAlert(alert)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue