From 8421e2836aefbce7e720b7b2c409233c93235a86 Mon Sep 17 00:00:00 2001 From: Davide Date: Wed, 18 Dec 2024 17:15:19 +0100 Subject: [PATCH 1/4] Fix NE misbehavior on first profile activation --- Library/Package.resolved | 3 +-- Library/Package.swift | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Library/Package.resolved b/Library/Package.resolved index 0af4c7599..585e80fda 100644 --- a/Library/Package.resolved +++ b/Library/Package.resolved @@ -41,8 +41,7 @@ "kind" : "remoteSourceControl", "location" : "git@github.com:passepartoutvpn/passepartoutkit-source", "state" : { - "revision" : "a08e04fccde51d92d5bed3fbe1880c4225f18618", - "version" : "1.0.0" + "revision" : "612168933da04498bfe60abd09d466183388196f" } }, { diff --git a/Library/Package.swift b/Library/Package.swift index 7532dad33..9ed7d36c1 100644 --- a/Library/Package.swift +++ b/Library/Package.swift @@ -61,8 +61,8 @@ let package = Package( ) ], dependencies: [ - .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "1.0.0"), -// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "a08e04fccde51d92d5bed3fbe1880c4225f18618"), +// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "1.0.0"), + .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "612168933da04498bfe60abd09d466183388196f"), // .package(path: "../../passepartoutkit-source"), .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", from: "1.0.0"), // .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", revision: "031863a1cd683962a7dfe68e20b91fa820a1ecce"), From 784d17cc2f58d3bd0cd532511212ee7482c9faf5 Mon Sep 17 00:00:00 2001 From: Davide Date: Wed, 18 Dec 2024 17:15:45 +0100 Subject: [PATCH 2/4] Disable fake migration --- .../xcshareddata/xcschemes/Passepartout.xcscheme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Passepartout.xcodeproj/xcshareddata/xcschemes/Passepartout.xcscheme b/Passepartout.xcodeproj/xcshareddata/xcschemes/Passepartout.xcscheme index 946e30cb5..dd7d5885e 100644 --- a/Passepartout.xcodeproj/xcshareddata/xcschemes/Passepartout.xcscheme +++ b/Passepartout.xcodeproj/xcshareddata/xcschemes/Passepartout.xcscheme @@ -89,7 +89,7 @@ + isEnabled = "NO"> Date: Wed, 18 Dec 2024 17:16:00 +0100 Subject: [PATCH 3/4] Fix duplicate instantiation of NETunnelStrategy Could observe duplicate NEVPNStatus notifications. --- .../App/Context/AppContext+Shared.swift | 84 ++++++------------- 1 file changed, 25 insertions(+), 59 deletions(-) diff --git a/Passepartout/App/Context/AppContext+Shared.swift b/Passepartout/App/Context/AppContext+Shared.swift index b98e97851..be338e1c5 100644 --- a/Passepartout/App/Context/AppContext+Shared.swift +++ b/Passepartout/App/Context/AppContext+Shared.swift @@ -63,6 +63,23 @@ extension AppContext { let processor = dependencies.appProcessor(with: iapManager) let tunnelEnvironment = dependencies.tunnelEnvironment() +#if targetEnvironment(simulator) + let tunnelStrategy = FakeTunnelStrategy(environment: tunnelEnvironment, dataCountInterval: 1000) + let mainProfileRepository = dependencies.coreDataProfileRepository( + model: cdRemoteModel, + observingResults: true + ) +#else + let tunnelStrategy = NETunnelStrategy( + bundleIdentifier: BundleConfiguration.mainString(for: .tunnelId), + coder: dependencies.neProtocolCoder(), + environment: tunnelEnvironment + ) + let mainProfileRepository = NEProfileRepository(repository: tunnelStrategy) { + dependencies.profileTitle($0) + } +#endif + let profileManager: ProfileManager = { let remoteRepositoryBlock: (Bool) -> ProfileRepository = { let remoteStore = CoreDataPersistentStore( @@ -84,10 +101,7 @@ extension AppContext { ) } return ProfileManager( - repository: dependencies.mainProfileRepository( - model: cdRemoteModel, - environment: tunnelEnvironment - ), + repository: mainProfileRepository, backupRepository: dependencies.backupProfileRepository( model: cdRemoteModel ), @@ -98,7 +112,7 @@ extension AppContext { }() let tunnel = ExtendedTunnel( - tunnel: Tunnel(strategy: dependencies.tunnelStrategy(environment: tunnelEnvironment)), + tunnel: Tunnel(strategy: tunnelStrategy), environment: tunnelEnvironment, processor: processor, interval: Constants.shared.tunnel.refreshInterval @@ -214,49 +228,7 @@ private extension Dependencies { var betaReceiptURL: URL? { Bundle.main.appStoreProductionReceiptURL } -} - -// MARK: Simulator - -#if targetEnvironment(simulator) - -private extension Dependencies { - func tunnelStrategy(environment: TunnelEnvironment) -> TunnelObservableStrategy { - FakeTunnelStrategy(environment: environment, dataCountInterval: 1000) - } - - func mainProfileRepository(model: NSManagedObjectModel, environment: TunnelEnvironment) -> ProfileRepository { - coreDataProfileRepository(model: model, observingResults: true) - } - - func backupProfileRepository(model: NSManagedObjectModel) -> ProfileRepository? { - nil - } -} - -#else - -// MARK: Device - -private extension Dependencies { - func tunnelStrategy(environment: TunnelEnvironment) -> TunnelObservableStrategy { - neStrategy(environment: environment) - } - - func mainProfileRepository(model: NSManagedObjectModel, environment: TunnelEnvironment) -> ProfileRepository { - neProfileRepository(environment: environment) - } - - func backupProfileRepository(model: NSManagedObjectModel) -> ProfileRepository? { - coreDataProfileRepository(model: model, observingResults: false) - } -} - -#endif -// MARK: Common - -private extension Dependencies { var mirrorsRemoteRepository: Bool { #if os(tvOS) true @@ -265,18 +237,12 @@ private extension Dependencies { #endif } - func neProfileRepository(environment: TunnelEnvironment) -> ProfileRepository { - NEProfileRepository(repository: neStrategy(environment: environment)) { - profileTitle($0) - } - } - - func neStrategy(environment: TunnelEnvironment) -> NETunnelStrategy { - NETunnelStrategy( - bundleIdentifier: BundleConfiguration.mainString(for: .tunnelId), - coder: neProtocolCoder(), - environment: environment - ) + func backupProfileRepository(model: NSManagedObjectModel) -> ProfileRepository? { +#if targetEnvironment(simulator) + nil +#else + coreDataProfileRepository(model: model, observingResults: false) +#endif } func coreDataProfileRepository(model: NSManagedObjectModel, observingResults: Bool) -> ProfileRepository { From 9feb3e72c2d46edcd7f4fe70833c4feeb7735b43 Mon Sep 17 00:00:00 2001 From: Davide Date: Wed, 18 Dec 2024 17:22:53 +0100 Subject: [PATCH 4/4] Restore untagged libraries --- Library/Package.resolved | 6 ++---- Library/Package.swift | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Library/Package.resolved b/Library/Package.resolved index 585e80fda..85a7ca054 100644 --- a/Library/Package.resolved +++ b/Library/Package.resolved @@ -49,8 +49,7 @@ "kind" : "remoteSourceControl", "location" : "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", "state" : { - "revision" : "3c3d7a4b477976fed638858bca9bb06e224bea3c", - "version" : "1.0.0" + "revision" : "dc14907a90eb9ece4f2a2d993a99ebde674fe409" } }, { @@ -58,8 +57,7 @@ "kind" : "remoteSourceControl", "location" : "git@github.com:passepartoutvpn/passepartoutkit-source-wireguard-go", "state" : { - "revision" : "7c1e0279eadf319a8744b34c09cb481a32d17623", - "version" : "1.0.0" + "revision" : "6b24ea9ad16b37ecfe5d18ddccc8be8fc2f612f8" } }, { diff --git a/Library/Package.swift b/Library/Package.swift index 9ed7d36c1..ce7f5fac9 100644 --- a/Library/Package.swift +++ b/Library/Package.swift @@ -64,11 +64,11 @@ let package = Package( // .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "1.0.0"), .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "612168933da04498bfe60abd09d466183388196f"), // .package(path: "../../passepartoutkit-source"), - .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", from: "1.0.0"), -// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", revision: "031863a1cd683962a7dfe68e20b91fa820a1ecce"), +// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", from: "1.0.0"), + .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", revision: "dc14907a90eb9ece4f2a2d993a99ebde674fe409"), // .package(path: "../../passepartoutkit-source-openvpn-openssl"), - .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-wireguard-go", from: "1.0.0"), -// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-wireguard-go", revision: "68fceaa664913988b2d9053405738682a30b87b8"), +// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-wireguard-go", from: "1.0.0"), + .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-wireguard-go", revision: "6b24ea9ad16b37ecfe5d18ddccc8be8fc2f612f8"), // .package(path: "../../passepartoutkit-source-wireguard-go"), .package(url: "https://github.com/Cocoanetics/Kvitto", from: "1.0.0") ],