From c10006ebe4182ade8a7547bd64fc29dd921966d4 Mon Sep 17 00:00:00 2001 From: Jon Petersson Date: Fri, 22 Sep 2023 15:56:06 +0200 Subject: [PATCH] Update tunnel manager to not return error for configuration loading --- ios/MullvadVPN/AppDelegate.swift | 9 ++++----- ios/MullvadVPN/TunnelManager/TunnelManager.swift | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ios/MullvadVPN/AppDelegate.swift b/ios/MullvadVPN/AppDelegate.swift index 5bd73b1d52b4..4bbbff665765 100644 --- a/ios/MullvadVPN/AppDelegate.swift +++ b/ios/MullvadVPN/AppDelegate.swift @@ -434,12 +434,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } private func getInitTunnelManagerOperation() -> AsyncBlockOperation { + // This operation is always treated as successful no matter what the configuration load yields. + // If the tunnel settings or device state can't be read, we simply pretend they are not there + // and leave user in logged out state. VPN config will be removed as well. AsyncBlockOperation(dispatchQueue: .main) { finish in - self.tunnelManager.loadConfiguration { error in - if let error { - fatalError(error.localizedDescription) - } - + self.tunnelManager.loadConfiguration { self.logger.debug("Finished initialization.") NotificationManager.shared.updateNotifications() diff --git a/ios/MullvadVPN/TunnelManager/TunnelManager.swift b/ios/MullvadVPN/TunnelManager/TunnelManager.swift index 40ae1a1160ab..260a2edd7e2f 100644 --- a/ios/MullvadVPN/TunnelManager/TunnelManager.swift +++ b/ios/MullvadVPN/TunnelManager/TunnelManager.swift @@ -168,7 +168,7 @@ final class TunnelManager: StorePaymentObserver { // MARK: - Public methods - func loadConfiguration(completionHandler: @escaping (Error?) -> Void) { + func loadConfiguration(completionHandler: @escaping () -> Void) { let loadTunnelOperation = LoadTunnelConfigurationOperation( dispatchQueue: internalQueue, interactor: TunnelInteractorProxy(self) @@ -187,7 +187,7 @@ final class TunnelManager: StorePaymentObserver { self.updatePrivateKeyRotationTimer() self.startNetworkMonitor() - completionHandler(completion.error) + completionHandler() } loadTunnelOperation.addObserver(