Reorganize app folders (#323)

This commit is contained in:
Davide De Rosa 2023-07-04 22:29:43 +02:00 committed by GitHub
parent bd6340ce77
commit bf70c7c59a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
78 changed files with 103 additions and 144 deletions

View File

@ -37,7 +37,6 @@
0E1F562B287F0EF100F8ADD7 /* ProviderProfileItem+ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E1F5629287F0EEE00F8ADD7 /* ProviderProfileItem+ViewModel.swift */; }; 0E1F562B287F0EF100F8ADD7 /* ProviderProfileItem+ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E1F5629287F0EEE00F8ADD7 /* ProviderProfileItem+ViewModel.swift */; };
0E293851285A70AC002A6E0E /* AppPreference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E293850285A70AC002A6E0E /* AppPreference.swift */; }; 0E293851285A70AC002A6E0E /* AppPreference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E293850285A70AC002A6E0E /* AppPreference.swift */; };
0E293857285A73BC002A6E0E /* AppContext+Shared.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E293856285A73BC002A6E0E /* AppContext+Shared.swift */; }; 0E293857285A73BC002A6E0E /* AppContext+Shared.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E293856285A73BC002A6E0E /* AppContext+Shared.swift */; };
0E29385C285A8B30002A6E0E /* CoreContext+Shared.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E29385B285A8B30002A6E0E /* CoreContext+Shared.swift */; };
0E2A8D4927ADF87F00207D04 /* PassepartoutApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E2A8D4727ADF87F00207D04 /* PassepartoutApp.swift */; }; 0E2A8D4927ADF87F00207D04 /* PassepartoutApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E2A8D4727ADF87F00207D04 /* PassepartoutApp.swift */; };
0E2A8D4F27B04BBA00207D04 /* OrganizerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E2A8D4E27B04BB900207D04 /* OrganizerView.swift */; }; 0E2A8D4F27B04BBA00207D04 /* OrganizerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E2A8D4E27B04BB900207D04 /* OrganizerView.swift */; };
0E2AC24522EC3AC10037B4B0 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 0E2AC24422EC3AC10037B4B0 /* Settings.bundle */; }; 0E2AC24522EC3AC10037B4B0 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 0E2AC24422EC3AC10037B4B0 /* Settings.bundle */; };
@ -328,7 +327,6 @@
0E23B4A12298559800304C30 /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; }; 0E23B4A12298559800304C30 /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = "<group>"; };
0E293850285A70AC002A6E0E /* AppPreference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppPreference.swift; sourceTree = "<group>"; }; 0E293850285A70AC002A6E0E /* AppPreference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppPreference.swift; sourceTree = "<group>"; };
0E293856285A73BC002A6E0E /* AppContext+Shared.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppContext+Shared.swift"; sourceTree = "<group>"; }; 0E293856285A73BC002A6E0E /* AppContext+Shared.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppContext+Shared.swift"; sourceTree = "<group>"; };
0E29385B285A8B30002A6E0E /* CoreContext+Shared.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CoreContext+Shared.swift"; sourceTree = "<group>"; };
0E2A8D4727ADF87F00207D04 /* PassepartoutApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PassepartoutApp.swift; sourceTree = "<group>"; }; 0E2A8D4727ADF87F00207D04 /* PassepartoutApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PassepartoutApp.swift; sourceTree = "<group>"; };
0E2A8D4E27B04BB900207D04 /* OrganizerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrganizerView.swift; sourceTree = "<group>"; }; 0E2A8D4E27B04BB900207D04 /* OrganizerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrganizerView.swift; sourceTree = "<group>"; };
0E2AC24422EC3AC10037B4B0 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; }; 0E2AC24422EC3AC10037B4B0 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
@ -583,23 +581,12 @@
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
0E293859285A7489002A6E0E /* Context */ = {
isa = PBXGroup;
children = (
0E021D9A284E68580077EF5D /* CoreContext.swift */,
0E29385B285A8B30002A6E0E /* CoreContext+Shared.swift */,
0E7A8C092A1D410400780F4B /* PersistenceManager.swift */,
);
path = Context;
sourceTree = "<group>";
};
0E29385A285A749E002A6E0E /* Context */ = { 0E29385A285A749E002A6E0E /* Context */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0E021D9B284E68580077EF5D /* AppContext.swift */, 0E021D9B284E68580077EF5D /* AppContext.swift */,
0E293856285A73BC002A6E0E /* AppContext+Shared.swift */, 0E293856285A73BC002A6E0E /* AppContext+Shared.swift */,
0E1AD5CB2A2682DA002AE6E6 /* AppError.swift */, 0E021D9A284E68580077EF5D /* CoreContext.swift */,
0E293850285A70AC002A6E0E /* AppPreference.swift */,
); );
path = Context; path = Context;
sourceTree = "<group>"; sourceTree = "<group>";
@ -706,6 +693,32 @@
path = Views; path = Views;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
0E3A593F2A54ACC900B3FE40 /* Managers */ = {
isa = PBXGroup;
children = (
0E9C232F27F47032007D5FC7 /* IntentsManager.swift */,
0E7A8C092A1D410400780F4B /* PersistenceManager.swift */,
0E53249627D26B51002565C3 /* ProductManager.swift */,
);
path = Managers;
sourceTree = "<group>";
};
0E3A59402A54AD4300B3FE40 /* Domain */ = {
isa = PBXGroup;
children = (
0E1AD5CB2A2682DA002AE6E6 /* AppError.swift */,
0E293850285A70AC002A6E0E /* AppPreference.swift */,
0E0392762818732D00827C10 /* BuildProducts.swift */,
0EA591142733DDDA0096F796 /* Intents.intentdefinition */,
0EA591122733DD4E0096F796 /* IntentDispatcher.swift */,
0E9C233227F47E95007D5FC7 /* IntentDispatcher+Activities.swift */,
0EB17EA327D2263700D473B5 /* LocalProduct.swift */,
0E7A8C072A1D40BA00780F4B /* Picker+OpenVPN.swift */,
0E7A8C082A1D40BA00780F4B /* Picker+Network.swift */,
);
path = Domain;
sourceTree = "<group>";
};
0E41BD98286711C3006346B4 /* Launcher */ = { 0E41BD98286711C3006346B4 /* Launcher */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -733,7 +746,7 @@
0E5467F12867A52B00F74D1C /* Mac */ = { 0E5467F12867A52B00F74D1C /* Mac */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0E96D2FA2871D93B005EFBCF /* Models */, 0E96D2FA2871D93B005EFBCF /* Managers */,
0E5467F92867AA0A00F74D1C /* MacBundleDelegate.swift */, 0E5467F92867AA0A00F74D1C /* MacBundleDelegate.swift */,
0E5467F22867A54600F74D1C /* MacBundle.swift */, 0E5467F22867A54600F74D1C /* MacBundle.swift */,
); );
@ -743,7 +756,7 @@
0E5467F52867A55F00F74D1C /* Mac */ = { 0E5467F52867A55F00F74D1C /* Mac */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0E96D2F72871D868005EFBCF /* Models */, 0E96D2F72871D868005EFBCF /* Managers */,
0E5467F62867A57000F74D1C /* MacBridge.swift */, 0E5467F62867A57000F74D1C /* MacBridge.swift */,
0E5468052867AEC500F74D1C /* MacMenu.swift */, 0E5468052867AEC500F74D1C /* MacMenu.swift */,
0E5467FF2867AC9900F74D1C /* MacUtils.swift */, 0E5467FF2867AC9900F74D1C /* MacUtils.swift */,
@ -777,7 +790,7 @@
path = Mac; path = Mac;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
0E54680C286B675F00F74D1C /* Menu */ = { 0E54680C286B675F00F74D1C /* Views */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0E96D2EB2871A0AD005EFBCF /* HostProfileItem.swift */, 0E96D2EB2871A0AD005EFBCF /* HostProfileItem.swift */,
@ -798,7 +811,7 @@
0E96D2DF28718E44005EFBCF /* VPNItemGroup.swift */, 0E96D2DF28718E44005EFBCF /* VPNItemGroup.swift */,
0E96D2E128718E78005EFBCF /* VPNItemGroup+ViewModel.swift */, 0E96D2E128718E78005EFBCF /* VPNItemGroup+ViewModel.swift */,
); );
path = Menu; path = Views;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
0E57F62F20C83FC5008323CF = { 0E57F62F20C83FC5008323CF = {
@ -827,26 +840,7 @@
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
0E7A8C062A1D40BA00780F4B /* Pickers */ = { 0E96D2F72871D868005EFBCF /* Managers */ = {
isa = PBXGroup;
children = (
0E7A8C072A1D40BA00780F4B /* Picker+OpenVPN.swift */,
0E7A8C082A1D40BA00780F4B /* Picker+Network.swift */,
);
path = Pickers;
sourceTree = "<group>";
};
0E92781227E7CD530057BB81 /* InApp */ = {
isa = PBXGroup;
children = (
0E0392762818732D00827C10 /* BuildProducts.swift */,
0EB17EA327D2263700D473B5 /* LocalProduct.swift */,
0E53249627D26B51002565C3 /* ProductManager.swift */,
);
path = InApp;
sourceTree = "<group>";
};
0E96D2F72871D868005EFBCF /* Models */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0E96D2F82871D874005EFBCF /* LightProfileManager.swift */, 0E96D2F82871D874005EFBCF /* LightProfileManager.swift */,
@ -854,10 +848,10 @@
0E04F0052883462E00BFCE1C /* LightUtils.swift */, 0E04F0052883462E00BFCE1C /* LightUtils.swift */,
0E96D30128720067005EFBCF /* LightVPNManager.swift */, 0E96D30128720067005EFBCF /* LightVPNManager.swift */,
); );
path = Models; path = Managers;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
0E96D2FA2871D93B005EFBCF /* Models */ = { 0E96D2FA2871D93B005EFBCF /* Managers */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0E96D2FB2871D94E005EFBCF /* DefaultLightProfileManager.swift */, 0E96D2FB2871D94E005EFBCF /* DefaultLightProfileManager.swift */,
@ -865,7 +859,7 @@
0E04F0082883466500BFCE1C /* DefaultLightUtils.swift */, 0E04F0082883466500BFCE1C /* DefaultLightUtils.swift */,
0E96D3042872010A005EFBCF /* DefaultLightVPNManager.swift */, 0E96D3042872010A005EFBCF /* DefaultLightVPNManager.swift */,
); );
path = Models; path = Managers;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
0E96D3122872185E005EFBCF /* Constants */ = { 0E96D3122872185E005EFBCF /* Constants */ = {
@ -895,11 +889,11 @@
children = ( children = (
0ECB78D4285F505D00B0E460 /* Constants */, 0ECB78D4285F505D00B0E460 /* Constants */,
0E29385A285A749E002A6E0E /* Context */, 0E29385A285A749E002A6E0E /* Context */,
0E3A59402A54AD4300B3FE40 /* Domain */,
0E49F6C927DB398100385834 /* Extensions */, 0E49F6C927DB398100385834 /* Extensions */,
0E92781227E7CD530057BB81 /* InApp */, 0E3A593F2A54ACC900B3FE40 /* Managers */,
0EA591112733DD4E0096F796 /* Intents */, 0E34A2B827CAA8EA00C73B67 /* L10n */,
0E5467F12867A52B00F74D1C /* Mac */, 0E5467F12867A52B00F74D1C /* Mac */,
0E7A8C062A1D40BA00780F4B /* Pickers */,
0E2C171C27CB6307007E8488 /* Reusable */, 0E2C171C27CB6307007E8488 /* Reusable */,
0E35C0AE280EF8A80071FA35 /* Views */, 0E35C0AE280EF8A80071FA35 /* Views */,
0E6059CA27FCC5DE003F4063 /* Assets.xcassets */, 0E6059CA27FCC5DE003F4063 /* Assets.xcassets */,
@ -907,10 +901,11 @@
0E6059C927FCC5DE003F4063 /* Providers.xcassets */, 0E6059C927FCC5DE003F4063 /* Providers.xcassets */,
0E2AC24422EC3AC10037B4B0 /* Settings.bundle */, 0E2AC24422EC3AC10037B4B0 /* Settings.bundle */,
0EDE8DE220C86A13004C739C /* App.entitlements */, 0EDE8DE220C86A13004C739C /* App.entitlements */,
0EDDEC7C28D0DC130017802E /* LaunchScreen.storyboard */,
0E09E35C2834172800BE1BAE /* Credits.rtf */, 0E09E35C2834172800BE1BAE /* Credits.rtf */,
0E57F64720C83FC7008323CF /* Info.plist */, 0E57F64720C83FC7008323CF /* Info.plist */,
0E0C072B236087A100155AAC /* InfoPlist.strings */, 0E0C072B236087A100155AAC /* InfoPlist.strings */,
0E9E5AE227B44CF1008C95DA /* Localizable.strings */,
0EDDEC7C28D0DC130017802E /* LaunchScreen.storyboard */,
0E3FC6852867A3F9009B851C /* AppDelegate.swift */, 0E3FC6852867A3F9009B851C /* AppDelegate.swift */,
0E2A8D4727ADF87F00207D04 /* PassepartoutApp.swift */, 0E2A8D4727ADF87F00207D04 /* PassepartoutApp.swift */,
0E0F4C5929C761850022E884 /* SceneDelegate.swift */, 0E0F4C5929C761850022E884 /* SceneDelegate.swift */,
@ -919,17 +914,6 @@
path = App; path = App;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
0EA591112733DD4E0096F796 /* Intents */ = {
isa = PBXGroup;
children = (
0EA591142733DDDA0096F796 /* Intents.intentdefinition */,
0EA591122733DD4E0096F796 /* IntentDispatcher.swift */,
0E9C233227F47E95007D5FC7 /* IntentDispatcher+Activities.swift */,
0E9C232F27F47032007D5FC7 /* IntentsManager.swift */,
);
path = Intents;
sourceTree = "<group>";
};
0EB13BAD290E825E003CB654 /* PassepartoutTests */ = { 0EB13BAD290E825E003CB654 /* PassepartoutTests */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -942,10 +926,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0ECB78D3285F4F9600B0E460 /* Constants */, 0ECB78D3285F4F9600B0E460 /* Constants */,
0E293859285A7489002A6E0E /* Context */,
0E34A2B827CAA8EA00C73B67 /* L10n */,
0E5467F52867A55F00F74D1C /* Mac */, 0E5467F52867A55F00F74D1C /* Mac */,
0E9E5AE227B44CF1008C95DA /* Localizable.strings */,
); );
path = AppShared; path = AppShared;
sourceTree = "<group>"; sourceTree = "<group>";
@ -974,8 +955,8 @@
children = ( children = (
0E96D3122872185E005EFBCF /* Constants */, 0E96D3122872185E005EFBCF /* Constants */,
0E5468022867AD2100F74D1C /* Mac */, 0E5468022867AD2100F74D1C /* Mac */,
0E54680C286B675F00F74D1C /* Menu */,
0E5467FB2867AC4900F74D1C /* Reusable */, 0E5467FB2867AC4900F74D1C /* Reusable */,
0E54680C286B675F00F74D1C /* Views */,
0E96D30628720AA1005EFBCF /* Assets.xcassets */, 0E96D30628720AA1005EFBCF /* Assets.xcassets */,
0EA1D84628805EAE00F3CA48 /* Flags.xcassets */, 0EA1D84628805EAE00F3CA48 /* Flags.xcassets */,
0ECB78E1285F53ED00B0E460 /* Info.plist */, 0ECB78E1285F53ED00B0E460 /* Info.plist */,
@ -1446,7 +1427,6 @@
0EA591162733DDDA0096F796 /* Intents.intentdefinition in Sources */, 0EA591162733DDDA0096F796 /* Intents.intentdefinition in Sources */,
0E34AC7827F840890042F2AB /* OrganizerView+Scene.swift in Sources */, 0E34AC7827F840890042F2AB /* OrganizerView+Scene.swift in Sources */,
0E0BD27927B2EBE500583AC5 /* ShortcutsView.swift in Sources */, 0E0BD27927B2EBE500583AC5 /* ShortcutsView.swift in Sources */,
0E29385C285A8B30002A6E0E /* CoreContext+Shared.swift in Sources */,
0E92D7C627F103300033CB7B /* ProfileView+Configuration.swift in Sources */, 0E92D7C627F103300033CB7B /* ProfileView+Configuration.swift in Sources */,
0E2DE71C27DCCFE80067B9E1 /* TunnelKit+Identifiable.swift in Sources */, 0E2DE71C27DCCFE80067B9E1 /* TunnelKit+Identifiable.swift in Sources */,
0ED1D6DE27DBA42100983466 /* DiagnosticsView+WireGuard.swift in Sources */, 0ED1D6DE27DBA42100983466 /* DiagnosticsView+WireGuard.swift in Sources */,

View File

@ -26,10 +26,38 @@
import Foundation import Foundation
import PassepartoutLibrary import PassepartoutLibrary
// safer alternative to @EnvironmentObject
extension AppContext { extension AppContext {
static let shared = AppContext(coreContext: .shared) private static let coreContext = CoreContext(store: UserDefaultsStore(defaults: .standard, key: \.key))
static let shared = AppContext(coreContext: coreContext)
} }
extension ProductManager { extension ProductManager {
static let shared = AppContext.shared.productManager static let shared = AppContext.shared.productManager
} }
extension UpgradeManager {
static let shared = AppContext.shared.upgradeManager
}
extension ProfileManager {
static let shared = AppContext.shared.profileManager
}
extension ProviderManager {
@MainActor
static let shared = AppContext.shared.providerManager
}
extension VPNManager {
static let shared = AppContext.shared.vpnManager
}
extension ObservableVPNState {
@MainActor
static let shared = AppContext.shared.vpnManager.currentState
}

View File

@ -29,6 +29,8 @@ import PassepartoutLibrary
@MainActor @MainActor
final class AppContext { final class AppContext {
private let coreContext: CoreContext
let productManager: ProductManager let productManager: ProductManager
private let reviewer: Reviewer private let reviewer: Reviewer
@ -36,6 +38,8 @@ final class AppContext {
private var cancellables: Set<AnyCancellable> = [] private var cancellables: Set<AnyCancellable> = []
init(coreContext: CoreContext) { init(coreContext: CoreContext) {
self.coreContext = coreContext
productManager = ProductManager( productManager = ProductManager(
appType: Constants.InApp.appType, appType: Constants.InApp.appType,
buildProducts: Constants.InApp.buildProducts buildProducts: Constants.InApp.buildProducts
@ -46,12 +50,28 @@ final class AppContext {
// post // post
configureObjects(coreContext: coreContext) configureObjects()
}
var upgradeManager: UpgradeManager {
coreContext.upgradeManager
}
var providerManager: ProviderManager {
coreContext.providerManager
}
var profileManager: ProfileManager {
coreContext.profileManager
}
var vpnManager: VPNManager {
coreContext.vpnManager
} }
} }
private extension AppContext { private extension AppContext {
func configureObjects(coreContext: CoreContext) { func configureObjects() {
coreContext.vpnManager.isOnDemandRulesSupported = { coreContext.vpnManager.isOnDemandRulesSupported = {
self.isEligibleForOnDemandRules() self.isEligibleForOnDemandRules()
} }
@ -71,7 +91,7 @@ private extension AppContext {
.sink { .sink {
Task { Task {
pp_log.info("Refunds detected, uninstalling VPN profile") pp_log.info("Refunds detected, uninstalling VPN profile")
await coreContext.vpnManager.uninstall() await self.coreContext.vpnManager.uninstall()
} }
}.store(in: &cancellables) }.store(in: &cancellables)
} }

View File

@ -31,20 +31,6 @@ import TunnelKitManager
@MainActor @MainActor
final class CoreContext { final class CoreContext {
let store: KeyValueStore
private let providersPersistence: ProvidersPersistence
private let vpnPersistence: VPNPersistence
var urlsForProviders: [URL]? {
providersPersistence.containerURLs
}
var urlsForProfiles: [URL]? {
vpnPersistence.containerURLs
}
let upgradeManager: UpgradeManager let upgradeManager: UpgradeManager
let providerManager: ProviderManager let providerManager: ProviderManager
@ -56,8 +42,6 @@ final class CoreContext {
private var cancellables: Set<AnyCancellable> = [] private var cancellables: Set<AnyCancellable> = []
init(store: KeyValueStore) { init(store: KeyValueStore) {
self.store = store
let logger = SwiftyBeaverLogger( let logger = SwiftyBeaverLogger(
logFile: Constants.Log.App.url, logFile: Constants.Log.App.url,
logLevel: Constants.Log.level, logLevel: Constants.Log.level,
@ -67,10 +51,10 @@ final class CoreContext {
pp_log.info("Logging to: \(logger.logFile!)") pp_log.info("Logging to: \(logger.logFile!)")
let persistenceManager = PersistenceManager(store: store) let persistenceManager = PersistenceManager(store: store)
vpnPersistence = persistenceManager.vpnPersistence( let vpnPersistence = persistenceManager.vpnPersistence(
withName: Constants.Persistence.profilesContainerName withName: Constants.Persistence.profilesContainerName
) )
providersPersistence = persistenceManager.providersPersistence( let providersPersistence = persistenceManager.providersPersistence(
withName: Constants.Persistence.providersContainerName withName: Constants.Persistence.providersContainerName
) )
@ -126,8 +110,10 @@ final class CoreContext {
configureObjects() configureObjects()
} }
}
private func configureObjects() { private extension CoreContext {
func configureObjects() {
providerManager.rateLimitMilliseconds = Constants.RateLimit.providerManager providerManager.rateLimitMilliseconds = Constants.RateLimit.providerManager
vpnManager.tunnelLogPath = Constants.Log.Tunnel.path vpnManager.tunnelLogPath = Constants.Log.Tunnel.path
vpnManager.tunnelLogFormat = Constants.Log.Tunnel.format vpnManager.tunnelLogFormat = Constants.Log.Tunnel.format

View File

@ -47,17 +47,17 @@ struct PassepartoutApp: App {
} }
} }
extension View { private extension View {
fileprivate func onIntentActivity(_ activity: IntentActivity<VPNManager>) -> some View { func onIntentActivity(_ activity: IntentActivity<VPNManager>) -> some View {
onContinueUserActivity(activity.name) { userActivity in onContinueUserActivity(activity.name) { userActivity in
// eligibility: ignore Siri shortcuts if not purchased // eligibility: ignore Siri shortcuts if not purchased
guard AppContext.shared.productManager.isEligible(forFeature: .siriShortcuts) else { guard ProductManager.shared.isEligible(forFeature: .siriShortcuts) else {
pp_log.warning("Ignore activity handler, not eligible for Siri shortcuts") pp_log.warning("Ignore activity handler, not eligible for Siri shortcuts")
return return
} }
pp_log.info("Handling activity: \(activity.name)") pp_log.info("Handling activity: \(activity.name)")
activity.handler(userActivity, CoreContext.shared.vpnManager) activity.handler(userActivity, .shared)
} }
} }
} }

View File

@ -258,8 +258,6 @@ internal enum L10n {
internal enum Success { internal enum Success {
/// This means a lot to me and I really hope you keep using and promoting this app. /// This means a lot to me and I really hope you keep using and promoting this app.
internal static let message = L10n.tr("Localizable", "donate.alerts.purchase.success.message", fallback: "This means a lot to me and I really hope you keep using and promoting this app.") internal static let message = L10n.tr("Localizable", "donate.alerts.purchase.success.message", fallback: "This means a lot to me and I really hope you keep using and promoting this app.")
/// Thank you
internal static let title = L10n.tr("Localizable", "donate.alerts.purchase.success.title", fallback: "Thank you")
} }
} }
} }

View File

@ -1,53 +0,0 @@
//
// CoreContext.swift
// Passepartout
//
// Created by Davide De Rosa on 6/15/22.
// Copyright (c) 2023 Davide De Rosa. All rights reserved.
//
// https://github.com/passepartoutvpn
//
// This file is part of Passepartout.
//
// Passepartout is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Passepartout is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
//
import Foundation
import PassepartoutLibrary
extension CoreContext {
static let shared = CoreContext(store: UserDefaultsStore(defaults: .standard, key: \.key))
}
extension UpgradeManager {
static let shared = CoreContext.shared.upgradeManager
}
extension ProfileManager {
static let shared = CoreContext.shared.profileManager
}
extension ProviderManager {
static let shared = CoreContext.shared.providerManager
}
extension VPNManager {
static let shared = CoreContext.shared.vpnManager
}
extension ObservableVPNState {
@MainActor
static let shared = CoreContext.shared.vpnManager.currentState
}

View File

@ -1,6 +1,6 @@
strings: strings:
inputs: inputs:
- Passepartout/AppShared/en.lproj/Localizable.strings - Passepartout/App/en.lproj/Localizable.strings
outputs: outputs:
- templateName: structured-swift4 - templateName: structured-swift4
output: Passepartout/AppShared/Constants/SwiftGen+Strings.swift output: Passepartout/AppShared/Constants/SwiftGen+Strings.swift