diff options
| author | mojganii <mojgan.jelodar@codic.se> | 2023-12-18 16:29:30 +0100 |
|---|---|---|
| committer | Emīls <emils@mullvad.net> | 2023-12-22 13:41:49 +0100 |
| commit | c0e4733d40c83111c22ec127185b5f69e7d531bc (patch) | |
| tree | 049235541f62e4c84fdde225bbbdc612e1b2cb55 | |
| parent | 9d71eccc2f3507928b833f969c952347c7a76d4c (diff) | |
| download | mullvadvpn-c0e4733d40c83111c22ec127185b5f69e7d531bc.tar.xz mullvadvpn-c0e4733d40c83111c22ec127185b5f69e7d531bc.zip | |
removing network operation from settings migration
| -rw-r--r-- | ios/MullvadSettings/MigrationManager.swift | 4 | ||||
| -rw-r--r-- | ios/MullvadSettings/SettingsManager.swift | 1 | ||||
| -rw-r--r-- | ios/MullvadSettings/TunnelSettings.swift | 1 | ||||
| -rw-r--r-- | ios/MullvadSettings/TunnelSettingsV1.swift | 1 | ||||
| -rw-r--r-- | ios/MullvadSettings/TunnelSettingsV2.swift | 1 | ||||
| -rw-r--r-- | ios/MullvadSettings/TunnelSettingsV3.swift | 1 | ||||
| -rw-r--r-- | ios/MullvadVPN/AppDelegate.swift | 2 | ||||
| -rw-r--r-- | ios/MullvadVPNTests/MigrationManagerTests.swift | 27 |
8 files changed, 8 insertions, 30 deletions
diff --git a/ios/MullvadSettings/MigrationManager.swift b/ios/MullvadSettings/MigrationManager.swift index 8667885823..38fe546ea1 100644 --- a/ios/MullvadSettings/MigrationManager.swift +++ b/ios/MullvadSettings/MigrationManager.swift @@ -8,7 +8,6 @@ import Foundation import MullvadLogging -import MullvadREST import MullvadTypes public enum SettingsMigrationResult { @@ -37,7 +36,6 @@ public struct MigrationManager { /// - migrationCompleted: Completion handler called with a migration result. public func migrateSettings( store: SettingsStore, - proxyFactory: REST.ProxyFactory, migrationCompleted: @escaping (SettingsMigrationResult) -> Void ) { let resetStoreHandler = { (result: SettingsMigrationResult) in @@ -51,7 +49,6 @@ public struct MigrationManager { do { try upgradeSettingsToLatestVersion( store: store, - proxyFactory: proxyFactory, migrationCompleted: migrationCompleted ) } catch .itemNotFound as KeychainError { @@ -63,7 +60,6 @@ public struct MigrationManager { private func upgradeSettingsToLatestVersion( store: SettingsStore, - proxyFactory: REST.ProxyFactory, migrationCompleted: @escaping (SettingsMigrationResult) -> Void ) throws { let parser = SettingsParser(decoder: JSONDecoder(), encoder: JSONEncoder()) diff --git a/ios/MullvadSettings/SettingsManager.swift b/ios/MullvadSettings/SettingsManager.swift index 9d34fd877d..2f8aa546db 100644 --- a/ios/MullvadSettings/SettingsManager.swift +++ b/ios/MullvadSettings/SettingsManager.swift @@ -8,7 +8,6 @@ import Foundation import MullvadLogging -import MullvadREST import MullvadTypes private let keychainServiceName = "Mullvad VPN" diff --git a/ios/MullvadSettings/TunnelSettings.swift b/ios/MullvadSettings/TunnelSettings.swift index 9d27b0a375..c72d03c4b7 100644 --- a/ios/MullvadSettings/TunnelSettings.swift +++ b/ios/MullvadSettings/TunnelSettings.swift @@ -7,7 +7,6 @@ // import Foundation -import MullvadREST /// Alias to the latest version of the `TunnelSettings`. public typealias LatestTunnelSettings = TunnelSettingsV3 diff --git a/ios/MullvadSettings/TunnelSettingsV1.swift b/ios/MullvadSettings/TunnelSettingsV1.swift index 21c28164c8..aaa3c27845 100644 --- a/ios/MullvadSettings/TunnelSettingsV1.swift +++ b/ios/MullvadSettings/TunnelSettingsV1.swift @@ -7,7 +7,6 @@ // import Foundation -import MullvadREST import MullvadTypes import Network import WireGuardKitTypes diff --git a/ios/MullvadSettings/TunnelSettingsV2.swift b/ios/MullvadSettings/TunnelSettingsV2.swift index c5d39ca0e6..c3bb7cd756 100644 --- a/ios/MullvadSettings/TunnelSettingsV2.swift +++ b/ios/MullvadSettings/TunnelSettingsV2.swift @@ -7,7 +7,6 @@ // import Foundation -import MullvadREST import MullvadTypes public struct TunnelSettingsV2: Codable, Equatable, TunnelSettings { diff --git a/ios/MullvadSettings/TunnelSettingsV3.swift b/ios/MullvadSettings/TunnelSettingsV3.swift index 98d9f4bc71..c91fbfe0b9 100644 --- a/ios/MullvadSettings/TunnelSettingsV3.swift +++ b/ios/MullvadSettings/TunnelSettingsV3.swift @@ -7,7 +7,6 @@ // import Foundation -import MullvadREST import MullvadTypes public struct TunnelSettingsV3: Codable, Equatable, TunnelSettings { diff --git a/ios/MullvadVPN/AppDelegate.swift b/ios/MullvadVPN/AppDelegate.swift index 64f642cd89..fe254248c2 100644 --- a/ios/MullvadVPN/AppDelegate.swift +++ b/ios/MullvadVPN/AppDelegate.swift @@ -418,7 +418,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD private func getMigrateSettingsOperation(application: UIApplication) -> AsyncBlockOperation { AsyncBlockOperation(dispatchQueue: .main) { [self] finish in migrationManager - .migrateSettings(store: SettingsManager.store, proxyFactory: proxyFactory) { [self] migrationResult in + .migrateSettings(store: SettingsManager.store) { [self] migrationResult in switch migrationResult { case .success: // Tell the tunnel to re-read tunnel configuration after migration. diff --git a/ios/MullvadVPNTests/MigrationManagerTests.swift b/ios/MullvadVPNTests/MigrationManagerTests.swift index 1b0bc35bad..c5f693ad01 100644 --- a/ios/MullvadVPNTests/MigrationManagerTests.swift +++ b/ios/MullvadVPNTests/MigrationManagerTests.swift @@ -15,7 +15,6 @@ final class MigrationManagerTests: XCTestCase { static let store = InMemorySettingsStore<SettingNotFound>() var manager: MigrationManager! - var proxyFactory: REST.ProxyFactory! override class func setUp() { SettingsManager.unitTestStore = store } @@ -25,18 +24,6 @@ final class MigrationManagerTests: XCTestCase { } override func setUpWithError() throws { - let transportProvider = REST.AnyTransportProvider { nil } - let addressCache = REST.AddressCache(canWriteToCache: false, fileCache: MemoryCache()) - let proxyConfiguration = REST.ProxyConfiguration( - transportProvider: transportProvider, - addressCacheStore: addressCache - ) - let authProxy = REST.AuthProxyConfiguration( - proxyConfiguration: proxyConfiguration, - accessTokenManager: AccessTokenManagerStub() - ) - - proxyFactory = REST.ProxyFactory(configuration: authProxy) manager = MigrationManager() } @@ -46,7 +33,7 @@ final class MigrationManagerTests: XCTestCase { try SettingsManager.writeSettings(settings) let nothingToMigrateExpectation = expectation(description: "No migration") - manager.migrateSettings(store: store, proxyFactory: proxyFactory) { result in + manager.migrateSettings(store: store) { result in if case .nothing = result { nothingToMigrateExpectation.fulfill() } @@ -59,7 +46,7 @@ final class MigrationManagerTests: XCTestCase { SettingsManager.unitTestStore = store let nothingToMigrateExpectation = expectation(description: "No migration") - manager.migrateSettings(store: store, proxyFactory: proxyFactory) { result in + manager.migrateSettings(store: store) { result in if case .nothing = result { nothingToMigrateExpectation.fulfill() } @@ -74,7 +61,7 @@ final class MigrationManagerTests: XCTestCase { func testFailedMigration() throws { let store = Self.store let failedMigrationExpectation = expectation(description: "Failed migration") - manager.migrateSettings(store: store, proxyFactory: proxyFactory) { result in + manager.migrateSettings(store: store) { result in if case .failure = result { failedMigrationExpectation.fulfill() } @@ -89,7 +76,7 @@ final class MigrationManagerTests: XCTestCase { try store.write(data, for: .deviceState) // Failed migration should reset settings and device state keys - manager.migrateSettings(store: store, proxyFactory: proxyFactory) { _ in } + manager.migrateSettings(store: store) { _ in } let assertDeletionFor: (SettingsKey) throws -> Void = { key in try XCTAssertThrowsError(store.read(key: key)) { thrownError in @@ -106,7 +93,7 @@ final class MigrationManagerTests: XCTestCase { let settings = FutureVersionSettings() try write(settings: settings, version: Int.max - 1, in: store) - manager.migrateSettings(store: store, proxyFactory: proxyFactory) { _ in } + manager.migrateSettings(store: store) { _ in } let assertDeletionFor: (SettingsKey) throws -> Void = { key in try XCTAssertThrowsError(store.read(key: key)) { thrownError in @@ -124,7 +111,7 @@ final class MigrationManagerTests: XCTestCase { try write(settings: settings, version: -42, in: store) let failedMigrationExpectation = expectation(description: "Failed migration") - manager.migrateSettings(store: store, proxyFactory: proxyFactory) { result in + manager.migrateSettings(store: store) { result in if case .failure = result { failedMigrationExpectation.fulfill() } @@ -161,7 +148,7 @@ final class MigrationManagerTests: XCTestCase { try write(settings: settings, version: version.rawValue, in: store) let successfulMigrationExpectation = expectation(description: "Successful migration") - manager.migrateSettings(store: store, proxyFactory: proxyFactory) { result in + manager.migrateSettings(store: store) { result in if case .success = result { successfulMigrationExpectation.fulfill() } |
