aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-12-06 19:05:46 +0530
committerRoopesh Chander <roop@roopc.net>2018-12-07 12:36:19 +0530
commitdcfa9473e955e372d2c32d7fc682a6fa9ff30bdf (patch)
treedfc481407b9b650076635fbe52e7f9f65dbcdd47 /WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
parentError handling: Introduce a WireGuardResult type to handle errors in callbacks across the app (diff)
downloadwireguard-apple-dcfa9473e955e372d2c32d7fc682a6fa9ff30bdf.tar.xz
wireguard-apple-dcfa9473e955e372d2c32d7fc682a6fa9ff30bdf.zip
Error handling: Use WireGuardAppError and WireGuardResult throughout the app
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift')
-rw-r--r--WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift5
1 files changed, 3 insertions, 2 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
index ae39587..4450796 100644
--- a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
@@ -165,11 +165,12 @@ class TunnelsListTableViewController: UIViewController {
func importFromFile(url: URL) {
guard let tunnelsManager = tunnelsManager else { return }
if (url.pathExtension == "zip") {
- ZipImporter.importConfigFiles(from: url) { (configs, error) in
- if let error = error {
+ ZipImporter.importConfigFiles(from: url) { [weak self] result in
+ if let error = result.error {
ErrorPresenter.showErrorAlert(error: error, from: self)
return
}
+ let configs: [TunnelConfiguration?] = result.value!
tunnelsManager.addMultiple(tunnelConfigurations: configs.compactMap { $0 }) { [weak self] (numberSuccessful) in
if numberSuccessful == configs.count {
return