aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-12-06 19:22:48 +0530
committerRoopesh Chander <roop@roopc.net>2018-12-07 12:36:19 +0530
commitc827a0030749944269afa7c65d91ecdcf9ab8080 (patch)
tree5184e26092022583e604943cd0f4cbf76a4475f9 /WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
parentError handling: Use WireGuardAppError and WireGuardResult throughout the app (diff)
downloadwireguard-apple-c827a0030749944269afa7c65d91ecdcf9ab8080.tar.xz
wireguard-apple-c827a0030749944269afa7c65d91ecdcf9ab8080.zip
Error handling: Use ErrorPresenter.showErrorAlert() instead of per-VC showErrorAlert() methods
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift')
-rw-r--r--WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift14
1 files changed, 3 insertions, 11 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
index 7beb2e9..4c8c9a1 100644
--- a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
@@ -101,14 +101,14 @@ class SettingsTableViewController: UITableViewController {
if (FileManager.default.fileExists(atPath: destinationURL.path)) {
let isDeleted = FileManager.deleteFile(at: destinationURL)
if (!isDeleted) {
- showErrorAlert(title: "No log available", message: "The pre-existing log could not be cleared")
+ ErrorPresenter.showErrorAlert(title: "No log available", message: "The pre-existing log could not be cleared", from: self)
return
}
}
guard let networkExtensionLogFileURL = FileManager.networkExtensionLogFileURL,
FileManager.default.fileExists(atPath: networkExtensionLogFileURL.path) else {
- showErrorAlert(title: "No log available", message: "Please activate a tunnel and then export the log")
+ ErrorPresenter.showErrorAlert(title: "No log available", message: "Please activate a tunnel and then export the log", from: self)
return
}
@@ -116,7 +116,7 @@ class SettingsTableViewController: UITableViewController {
try FileManager.default.copyItem(at: networkExtensionLogFileURL, to: destinationURL)
} catch {
os_log("Failed to copy file: %{public}@ to %{public}@: %{public}@", log: OSLog.default, type: .error, networkExtensionLogFileURL.absoluteString, destinationURL.absoluteString, error.localizedDescription)
- showErrorAlert(title: "No log available", message: "The log could not be accessed")
+ ErrorPresenter.showErrorAlert(title: "No log available", message: "The log could not be accessed", from: self)
return
}
@@ -130,14 +130,6 @@ class SettingsTableViewController: UITableViewController {
}
self.present(activityVC, animated: true)
}
-
- func showErrorAlert(title: String, message: String) {
- let okAction = UIAlertAction(title: "OK", style: .default)
- let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
- alert.addAction(okAction)
-
- self.present(alert, animated: true, completion: nil)
- }
}
// MARK: UITableViewDataSource