aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift')
-rw-r--r--WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift22
1 files changed, 10 insertions, 12 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
index 796c030..6e77433 100644
--- a/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/TunnelsListTableViewController.swift
@@ -160,20 +160,18 @@ class TunnelsListTableViewController: UIViewController {
func importFromFile(url: URL) {
guard let tunnelsManager = tunnelsManager else { return }
if (url.pathExtension == "zip") {
- let zipImporter = ZipImporter(url: url)
- let configs: [TunnelConfiguration?]
- do {
- configs = try zipImporter.importConfigFiles()
- } catch (let error) {
- ErrorPresenter.showErrorAlert(error: error, from: self)
- return
- }
- tunnelsManager.addMultiple(tunnelConfigurations: configs.compactMap { $0 }) { [weak self] (numberSuccessful) in
- if numberSuccessful == configs.count {
+ ZipImporter.importConfigFiles(from: url) { (configs, error) in
+ if let error = error {
+ ErrorPresenter.showErrorAlert(error: error, from: self)
return
}
- self?.showErrorAlert(title: "Created \(numberSuccessful) tunnels",
- message: "Created \(numberSuccessful) of \(configs.count) tunnels from zip archive")
+ tunnelsManager.addMultiple(tunnelConfigurations: configs.compactMap { $0 }) { [weak self] (numberSuccessful) in
+ if numberSuccessful == configs.count {
+ return
+ }
+ self?.showErrorAlert(title: "Created \(numberSuccessful) tunnels",
+ message: "Created \(numberSuccessful) of \(configs.count) tunnels from zip archive")
+ }
}
} else /* if (url.pathExtension == "conf") -- we assume everything else is a conf */ {
let fileBaseName = url.deletingPathExtension().lastPathComponent.trimmingCharacters(in: .whitespacesAndNewlines)