mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-22 08:32:11 +00:00
Resolve NEVPNErrorDomain error and profile duplication on first import (#1026)
Fixes #1025
This commit is contained in:
parent
1be2510e8c
commit
1f81c3dfea
@ -41,8 +41,7 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source",
|
||||
"state" : {
|
||||
"revision" : "a08e04fccde51d92d5bed3fbe1880c4225f18618",
|
||||
"version" : "1.0.0"
|
||||
"revision" : "612168933da04498bfe60abd09d466183388196f"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -50,8 +49,7 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl",
|
||||
"state" : {
|
||||
"revision" : "3c3d7a4b477976fed638858bca9bb06e224bea3c",
|
||||
"version" : "1.0.0"
|
||||
"revision" : "dc14907a90eb9ece4f2a2d993a99ebde674fe409"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -59,8 +57,7 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source-wireguard-go",
|
||||
"state" : {
|
||||
"revision" : "7c1e0279eadf319a8744b34c09cb481a32d17623",
|
||||
"version" : "1.0.0"
|
||||
"revision" : "6b24ea9ad16b37ecfe5d18ddccc8be8fc2f612f8"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -61,14 +61,14 @@ 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"),
|
||||
// .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")
|
||||
],
|
||||
|
@ -89,7 +89,7 @@
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "-pp_fake_migration"
|
||||
isEnabled = "YES">
|
||||
isEnabled = "NO">
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "-com.apple.CoreData.SQLDebug 1"
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user