mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-22 16:42:09 +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",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source",
|
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "a08e04fccde51d92d5bed3fbe1880c4225f18618",
|
"revision" : "612168933da04498bfe60abd09d466183388196f"
|
||||||
"version" : "1.0.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -50,8 +49,7 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl",
|
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "3c3d7a4b477976fed638858bca9bb06e224bea3c",
|
"revision" : "dc14907a90eb9ece4f2a2d993a99ebde674fe409"
|
||||||
"version" : "1.0.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -59,8 +57,7 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source-wireguard-go",
|
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source-wireguard-go",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "7c1e0279eadf319a8744b34c09cb481a32d17623",
|
"revision" : "6b24ea9ad16b37ecfe5d18ddccc8be8fc2f612f8"
|
||||||
"version" : "1.0.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -61,14 +61,14 @@ let package = Package(
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "1.0.0"),
|
// .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", revision: "612168933da04498bfe60abd09d466183388196f"),
|
||||||
// .package(path: "../../passepartoutkit-source"),
|
// .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", 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", revision: "dc14907a90eb9ece4f2a2d993a99ebde674fe409"),
|
||||||
// .package(path: "../../passepartoutkit-source-openvpn-openssl"),
|
// .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", 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", revision: "6b24ea9ad16b37ecfe5d18ddccc8be8fc2f612f8"),
|
||||||
// .package(path: "../../passepartoutkit-source-wireguard-go"),
|
// .package(path: "../../passepartoutkit-source-wireguard-go"),
|
||||||
.package(url: "https://github.com/Cocoanetics/Kvitto", from: "1.0.0")
|
.package(url: "https://github.com/Cocoanetics/Kvitto", from: "1.0.0")
|
||||||
],
|
],
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
</CommandLineArgument>
|
</CommandLineArgument>
|
||||||
<CommandLineArgument
|
<CommandLineArgument
|
||||||
argument = "-pp_fake_migration"
|
argument = "-pp_fake_migration"
|
||||||
isEnabled = "YES">
|
isEnabled = "NO">
|
||||||
</CommandLineArgument>
|
</CommandLineArgument>
|
||||||
<CommandLineArgument
|
<CommandLineArgument
|
||||||
argument = "-com.apple.CoreData.SQLDebug 1"
|
argument = "-com.apple.CoreData.SQLDebug 1"
|
||||||
|
@ -63,6 +63,23 @@ extension AppContext {
|
|||||||
let processor = dependencies.appProcessor(with: iapManager)
|
let processor = dependencies.appProcessor(with: iapManager)
|
||||||
let tunnelEnvironment = dependencies.tunnelEnvironment()
|
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 profileManager: ProfileManager = {
|
||||||
let remoteRepositoryBlock: (Bool) -> ProfileRepository = {
|
let remoteRepositoryBlock: (Bool) -> ProfileRepository = {
|
||||||
let remoteStore = CoreDataPersistentStore(
|
let remoteStore = CoreDataPersistentStore(
|
||||||
@ -84,10 +101,7 @@ extension AppContext {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
return ProfileManager(
|
return ProfileManager(
|
||||||
repository: dependencies.mainProfileRepository(
|
repository: mainProfileRepository,
|
||||||
model: cdRemoteModel,
|
|
||||||
environment: tunnelEnvironment
|
|
||||||
),
|
|
||||||
backupRepository: dependencies.backupProfileRepository(
|
backupRepository: dependencies.backupProfileRepository(
|
||||||
model: cdRemoteModel
|
model: cdRemoteModel
|
||||||
),
|
),
|
||||||
@ -98,7 +112,7 @@ extension AppContext {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
let tunnel = ExtendedTunnel(
|
let tunnel = ExtendedTunnel(
|
||||||
tunnel: Tunnel(strategy: dependencies.tunnelStrategy(environment: tunnelEnvironment)),
|
tunnel: Tunnel(strategy: tunnelStrategy),
|
||||||
environment: tunnelEnvironment,
|
environment: tunnelEnvironment,
|
||||||
processor: processor,
|
processor: processor,
|
||||||
interval: Constants.shared.tunnel.refreshInterval
|
interval: Constants.shared.tunnel.refreshInterval
|
||||||
@ -214,49 +228,7 @@ private extension Dependencies {
|
|||||||
var betaReceiptURL: URL? {
|
var betaReceiptURL: URL? {
|
||||||
Bundle.main.appStoreProductionReceiptURL
|
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 {
|
var mirrorsRemoteRepository: Bool {
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
true
|
true
|
||||||
@ -265,18 +237,12 @@ private extension Dependencies {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func neProfileRepository(environment: TunnelEnvironment) -> ProfileRepository {
|
func backupProfileRepository(model: NSManagedObjectModel) -> ProfileRepository? {
|
||||||
NEProfileRepository(repository: neStrategy(environment: environment)) {
|
#if targetEnvironment(simulator)
|
||||||
profileTitle($0)
|
nil
|
||||||
}
|
#else
|
||||||
}
|
coreDataProfileRepository(model: model, observingResults: false)
|
||||||
|
#endif
|
||||||
func neStrategy(environment: TunnelEnvironment) -> NETunnelStrategy {
|
|
||||||
NETunnelStrategy(
|
|
||||||
bundleIdentifier: BundleConfiguration.mainString(for: .tunnelId),
|
|
||||||
coder: neProtocolCoder(),
|
|
||||||
environment: environment
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func coreDataProfileRepository(model: NSManagedObjectModel, observingResults: Bool) -> ProfileRepository {
|
func coreDataProfileRepository(model: NSManagedObjectModel, observingResults: Bool) -> ProfileRepository {
|
||||||
|
Loading…
Reference in New Issue
Block a user