mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2025-02-16 12:52:06 +00:00
Make sure a scanned config is actually saved and displayed.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
9bdf987b42
commit
06f61cbc99
@ -521,7 +521,8 @@ extension AppCoordinator: TunnelConfigurationTableViewControllerDelegate {
|
|||||||
|
|
||||||
extension AppCoordinator: QRScanViewControllerDelegate {
|
extension AppCoordinator: QRScanViewControllerDelegate {
|
||||||
func didSave(tunnel: Tunnel, qrScanViewController: QRScanViewController) {
|
func didSave(tunnel: Tunnel, qrScanViewController: QRScanViewController) {
|
||||||
showTunnelConfigurationViewController(tunnel: tunnel, context: tunnel.managedObjectContext!)
|
qrScanViewController.navigationController?.popViewController(animated: true)
|
||||||
|
showTunnelInfoViewController(tunnel: tunnel, context: tunnel.managedObjectContext!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,13 +95,14 @@ class QRScanViewController: UIViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
previewLayer.frame = self.view.bounds
|
previewLayer.frame = self.view.bounds
|
||||||
}
|
}
|
||||||
|
|
||||||
func scanDidComplete(withCode code: String) {
|
func scanDidComplete(withCode code: String) {
|
||||||
do {
|
do {
|
||||||
let tunnel = try Tunnel.fromConfig(code, context: viewContext)
|
let tunnel = try Tunnel.fromConfig(code, context: viewContext)
|
||||||
|
try viewContext.save()
|
||||||
delegate?.didSave(tunnel: tunnel, qrScanViewController: self)
|
delegate?.didSave(tunnel: tunnel, qrScanViewController: self)
|
||||||
} catch {
|
} catch {
|
||||||
scanDidEncounterError(title: "Invalid Code", message: "The scanned code is not a valid WireGuard config file.")
|
scanDidEncounterError(title: "Invalid Code", message: "The scanned code is not a valid WireGuard config file.")
|
||||||
|
Loading…
Reference in New Issue
Block a user