aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard
diff options
context:
space:
mode:
authorJeroen Leenarts <jeroen.leenarts@gmail.com>2018-09-20 00:43:43 +0200
committerJeroen Leenarts <jeroen.leenarts@gmail.com>2018-09-20 00:43:43 +0200
commit06f61cbc991abe0d49ba5d4c3061e856ac445a98 (patch)
treeeec3768b93c3a08673e87c806d69f162928c8f28 /WireGuard
parentDisable bitcode to allow reporting of GO version in App settings. (diff)
downloadwireguard-apple-06f61cbc991abe0d49ba5d4c3061e856ac445a98.tar.xz
wireguard-apple-06f61cbc991abe0d49ba5d4c3061e856ac445a98.zip
Make sure a scanned config is actually saved and displayed.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard')
-rw-r--r--WireGuard/Coordinators/AppCoordinator.swift3
-rw-r--r--WireGuard/ViewControllers/QRScanViewController.swift3
2 files changed, 4 insertions, 2 deletions
diff --git a/WireGuard/Coordinators/AppCoordinator.swift b/WireGuard/Coordinators/AppCoordinator.swift
index 437a30b..1ae11a5 100644
--- a/WireGuard/Coordinators/AppCoordinator.swift
+++ b/WireGuard/Coordinators/AppCoordinator.swift
@@ -521,7 +521,8 @@ extension AppCoordinator: TunnelConfigurationTableViewControllerDelegate {
extension AppCoordinator: QRScanViewControllerDelegate {
func didSave(tunnel: Tunnel, qrScanViewController: QRScanViewController) {
- showTunnelConfigurationViewController(tunnel: tunnel, context: tunnel.managedObjectContext!)
+ qrScanViewController.navigationController?.popViewController(animated: true)
+ showTunnelInfoViewController(tunnel: tunnel, context: tunnel.managedObjectContext!)
}
}
diff --git a/WireGuard/ViewControllers/QRScanViewController.swift b/WireGuard/ViewControllers/QRScanViewController.swift
index ad57f77..811602e 100644
--- a/WireGuard/ViewControllers/QRScanViewController.swift
+++ b/WireGuard/ViewControllers/QRScanViewController.swift
@@ -95,13 +95,14 @@ class QRScanViewController: UIViewController {
}
}
}
-
+
previewLayer.frame = self.view.bounds
}
func scanDidComplete(withCode code: String) {
do {
let tunnel = try Tunnel.fromConfig(code, context: viewContext)
+ try viewContext.save()
delegate?.didSave(tunnel: tunnel, qrScanViewController: self)
} catch {
scanDidEncounterError(title: "Invalid Code", message: "The scanned code is not a valid WireGuard config file.")