]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
Make sure a scanned config is actually saved and displayed.
authorJeroen Leenarts <jeroen.leenarts@gmail.com>
Wed, 19 Sep 2018 22:43:43 +0000 (00:43 +0200)
committerJeroen Leenarts <jeroen.leenarts@gmail.com>
Wed, 19 Sep 2018 22:43:43 +0000 (00:43 +0200)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
WireGuard/Coordinators/AppCoordinator.swift
WireGuard/ViewControllers/QRScanViewController.swift

index 437a30b8f45d8e9c022048c9e85a98e244413990..1ae11a5e3123b8b5060dd0685b50f27921dec145 100644 (file)
@@ -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!)
     }
 }
 
index ad57f7793b9edc748338c2cddfb01dd7875edfda..811602e5b56e7303e358994b96f54d8986b36d00 100644 (file)
@@ -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.")