diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index db8e45a757..9c20a38a1c 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -1147,7 +1147,6 @@ 4B2D06292A11C0C900DE1F49 /* Bundle+VPN.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B4D605E2A0B29FA00BCD287 /* Bundle+VPN.swift */; }; 4B2D062A2A11C0C900DE1F49 /* NetworkProtectionOptionKeyExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B4D605F2A0B29FA00BCD287 /* NetworkProtectionOptionKeyExtension.swift */; }; 4B2D062C2A11C0E100DE1F49 /* Networking in Frameworks */ = {isa = PBXBuildFile; productRef = 4B2D062B2A11C0E100DE1F49 /* Networking */; }; - 4B2D06322A11C1D300DE1F49 /* NSApplicationExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA5C8F622591021700748EB7 /* NSApplicationExtension.swift */; }; 4B2D065B2A11D1FF00DE1F49 /* Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B4BEC322A11B509001D9AC5 /* Logging.swift */; }; 4B2D065E2A11D2D700DE1F49 /* DuckDuckGo Notifications.app in Embed Login Items */ = {isa = PBXBuildFile; fileRef = 4B4BEC202A11B4E2001D9AC5 /* DuckDuckGo Notifications.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 4B2D065F2A11D2D700DE1F49 /* DuckDuckGo VPN.app in Embed Login Items */ = {isa = PBXBuildFile; fileRef = 4B2D06392A11CFBB00DE1F49 /* DuckDuckGo VPN.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; @@ -1195,7 +1194,6 @@ 4B4D60A02A0B2D5B00BCD287 /* Bundle+VPN.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B4D605E2A0B29FA00BCD287 /* Bundle+VPN.swift */; }; 4B4D60A12A0B2D6100BCD287 /* NetworkProtectionOptionKeyExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B4D605F2A0B29FA00BCD287 /* NetworkProtectionOptionKeyExtension.swift */; }; 4B4D60A52A0B2EC000BCD287 /* UserText+NetworkProtectionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B4D607C2A0B29FA00BCD287 /* UserText+NetworkProtectionExtensions.swift */; }; - 4B4D60AD2A0C807300BCD287 /* NSApplicationExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA5C8F622591021700748EB7 /* NSApplicationExtension.swift */; }; 4B4D60AF2A0C837F00BCD287 /* Networking in Frameworks */ = {isa = PBXBuildFile; productRef = 4B4D60AE2A0C837F00BCD287 /* Networking */; }; 4B4D60B12A0C83B900BCD287 /* NetworkProtectionUI in Frameworks */ = {isa = PBXBuildFile; productRef = 4B4D60B02A0C83B900BCD287 /* NetworkProtectionUI */; }; 4B4D60B62A0C847D00BCD287 /* NetworkProtectionNavBarButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B4D60652A0B29FA00BCD287 /* NetworkProtectionNavBarButtonModel.swift */; }; @@ -1606,7 +1604,6 @@ 7B97CD5B2B7E0B85004FEF43 /* Common in Frameworks */ = {isa = PBXBuildFile; productRef = 7B97CD5A2B7E0B85004FEF43 /* Common */; }; 7B97CD5C2B7E0BBB004FEF43 /* UserDefaultsWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85C6A29525CC1FFD00EEB5F1 /* UserDefaultsWrapper.swift */; }; 7B97CD5D2B7E0BCE004FEF43 /* BundleExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6106B9D26A565DA0013B453 /* BundleExtension.swift */; }; - 7B97CD5F2B7E0BF7004FEF43 /* NSApplicationExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA5C8F622591021700748EB7 /* NSApplicationExtension.swift */; }; 7BA076BB2B65D61400D7FB72 /* NetworkProtectionProxy in Frameworks */ = {isa = PBXBuildFile; productRef = 7BA076BA2B65D61400D7FB72 /* NetworkProtectionProxy */; }; 7BA4727D26F01BC400EAA165 /* CoreDataTestUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B9292C42667104B00AD2C21 /* CoreDataTestUtilities.swift */; }; 7BA59C9B2AE18B49009A97B1 /* SystemExtensionManager in Frameworks */ = {isa = PBXBuildFile; productRef = 7BA59C9A2AE18B49009A97B1 /* SystemExtensionManager */; }; @@ -1799,6 +1796,15 @@ 9D9AE9202AAA3B450026E7DC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9D9AE9162AAA3B450026E7DC /* Assets.xcassets */; }; 9D9AE9212AAA3B450026E7DC /* UserText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D9AE9172AAA3B450026E7DC /* UserText.swift */; }; 9D9AE9222AAA3B450026E7DC /* UserText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D9AE9172AAA3B450026E7DC /* UserText.swift */; }; + 9D9DE5732C63AA0700D20B15 /* AppKitExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 9D9DE5722C63AA0700D20B15 /* AppKitExtensions */; }; + 9D9DE5752C63AA0C00D20B15 /* AppKitExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 9D9DE5742C63AA0C00D20B15 /* AppKitExtensions */; }; + 9D9DE5772C63AA1600D20B15 /* AppKitExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 9D9DE5762C63AA1600D20B15 /* AppKitExtensions */; }; + 9D9DE5792C63AA1A00D20B15 /* AppKitExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 9D9DE5782C63AA1A00D20B15 /* AppKitExtensions */; }; + 9D9DE57B2C63AA1F00D20B15 /* AppKitExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 9D9DE57A2C63AA1F00D20B15 /* AppKitExtensions */; }; + 9D9DE57D2C63AA2400D20B15 /* AppKitExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 9D9DE57C2C63AA2400D20B15 /* AppKitExtensions */; }; + 9D9DE57F2C63B64F00D20B15 /* AppKitExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 9D9DE57E2C63B64F00D20B15 /* AppKitExtensions */; }; + 9D9DE5812C63BA0B00D20B15 /* AppKitExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 9D9DE5802C63BA0B00D20B15 /* AppKitExtensions */; }; + 9D9DE5832C63BE9600D20B15 /* AppKitExtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 9D9DE5822C63BE9600D20B15 /* AppKitExtensions */; }; 9DC70B1A2AA1FA5B005A844B /* LoginItems in Frameworks */ = {isa = PBXBuildFile; productRef = 9DC70B192AA1FA5B005A844B /* LoginItems */; }; 9DEF97E12B06C4EE00764F03 /* Networking in Frameworks */ = {isa = PBXBuildFile; productRef = 9DEF97E02B06C4EE00764F03 /* Networking */; }; 9F0660732BECC71200B8EEF1 /* SubscriptionAttributionPixelHandlerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0660722BECC71200B8EEF1 /* SubscriptionAttributionPixelHandlerTests.swift */; }; @@ -2486,7 +2492,6 @@ B6E6B9F62BA1FD90008AA7E1 /* SandboxTestTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6E6B9F52BA1FD90008AA7E1 /* SandboxTestTool.swift */; }; B6E6BA042BA1FE05008AA7E1 /* FilePresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6E6B9E22BA1F5F1008AA7E1 /* FilePresenter.swift */; }; B6E6BA052BA1FE09008AA7E1 /* URLExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA8EDF2324923E980071C2E8 /* URLExtension.swift */; }; - B6E6BA062BA1FE10008AA7E1 /* NSApplicationExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA5C8F622591021700748EB7 /* NSApplicationExtension.swift */; }; B6E6BA082BA1FE24008AA7E1 /* Common in Frameworks */ = {isa = PBXBuildFile; productRef = B6E6BA072BA1FE24008AA7E1 /* Common */; }; B6E6BA142BA2CDD6008AA7E1 /* SandboxTestToolNotifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6E6BA132BA2CDD6008AA7E1 /* SandboxTestToolNotifications.swift */; }; B6E6BA162BA2CF5F008AA7E1 /* SandboxTestToolNotifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6E6BA132BA2CDD6008AA7E1 /* SandboxTestToolNotifications.swift */; }; @@ -3699,6 +3704,7 @@ 9D9AE9182AAA3B450026E7DC /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 9D9AE9192AAA3B450026E7DC /* DuckDuckGoDBPBackgroundAgentAppStore.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = DuckDuckGoDBPBackgroundAgentAppStore.entitlements; sourceTree = ""; }; 9D9AE91A2AAA3B450026E7DC /* DuckDuckGoDBPBackgroundAgent.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = DuckDuckGoDBPBackgroundAgent.entitlements; sourceTree = ""; }; + 9D9DE5712C63A96400D20B15 /* AppKitExtensions */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = AppKitExtensions; sourceTree = ""; }; 9DB6E7222AA0DA7A00A17F3C /* LoginItems */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = LoginItems; sourceTree = ""; }; 9F0660722BECC71200B8EEF1 /* SubscriptionAttributionPixelHandlerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionAttributionPixelHandlerTests.swift; sourceTree = ""; }; 9F0660762BECC81800B8EEF1 /* PixelCapturedParameters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PixelCapturedParameters.swift; sourceTree = ""; }; @@ -4359,6 +4365,7 @@ 3739326529AE4B39009346AE /* DDGSync in Frameworks */, D6BC8AC82C5A95B10025375B /* DuckPlayer in Frameworks */, 37DF000729F9C061002B7D3E /* SyncDataProviders in Frameworks */, + 9D9DE5752C63AA0C00D20B15 /* AppKitExtensions in Frameworks */, 37BA812F29B3CD6E0053F1A3 /* SyncUI in Frameworks */, 3706FCAF293F65D500E42796 /* PrivacyDashboard in Frameworks */, ); @@ -4408,6 +4415,7 @@ buildActionMask = 2147483647; files = ( 37269F012B332FC8005E8E46 /* Common in Frameworks */, + 9D9DE57B2C63AA1F00D20B15 /* AppKitExtensions in Frameworks */, EE7295E92A545BC4008C0991 /* NetworkProtection in Frameworks */, 7B37C7A52BAA32A50062546A /* Subscription in Frameworks */, F198C7182BD18A4C000BF24D /* PixelKit in Frameworks */, @@ -4433,6 +4441,7 @@ EE7295ED2A545C0A008C0991 /* NetworkProtection in Frameworks */, EE2F9C5B2B90F2FF00D45FC9 /* Subscription in Frameworks */, 7BEC182F2AD5D8DC00D30536 /* SystemExtensionManager in Frameworks */, + 9D9DE5812C63BA0B00D20B15 /* AppKitExtensions in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4446,6 +4455,7 @@ F198C71C2BD18A61000BF24D /* PixelKit in Frameworks */, 7BEEA5142AD1236300A9E72B /* NetworkProtectionIPC in Frameworks */, BDADBDCB2BD2BC2800421B9B /* Lottie in Frameworks */, + 9D9DE5832C63BE9600D20B15 /* AppKitExtensions in Frameworks */, 7B00997F2B6508C200FE7C31 /* NetworkProtectionProxy in Frameworks */, EE7295EF2A545C12008C0991 /* NetworkProtection in Frameworks */, 4B2D067F2A1334D700DE1F49 /* NetworkProtectionUI in Frameworks */, @@ -4474,6 +4484,7 @@ 4B4D60AF2A0C837F00BCD287 /* Networking in Frameworks */, 7B2366882C09FADA002D393F /* VPNAppLauncher in Frameworks */, 7B25856E2BA2F2ED00D49F79 /* NetworkProtectionUI in Frameworks */, + 9D9DE5772C63AA1600D20B15 /* AppKitExtensions in Frameworks */, 4B4D603F2A0B290200BCD287 /* NetworkExtension.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -4490,6 +4501,7 @@ buildActionMask = 2147483647; files = ( EE02D4202BB460C000DBE6B3 /* BrowserServicesKit in Frameworks */, + 9D9DE57F2C63B64F00D20B15 /* AppKitExtensions in Frameworks */, B64E42872B908501006C1346 /* SnapshotTesting in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -4500,6 +4512,7 @@ files = ( 7BDA36E62B7E037100AD5388 /* NetworkExtension.framework in Frameworks */, 7B97CD592B7E0B57004FEF43 /* NetworkProtectionProxy in Frameworks */, + 9D9DE5792C63AA1A00D20B15 /* AppKitExtensions in Frameworks */, 7B7DFB222B7E7473009EA1A3 /* Networking in Frameworks */, 7B97CD5B2B7E0B85004FEF43 /* Common in Frameworks */, ); @@ -4560,6 +4573,7 @@ 85D44B862BA08D29001B4AB5 /* Suggestions in Frameworks */, 37DF000529F9C056002B7D3E /* SyncDataProviders in Frameworks */, 37BA812D29B3CD690053F1A3 /* SyncUI in Frameworks */, + 9D9DE5732C63AA0700D20B15 /* AppKitExtensions in Frameworks */, F1DF95E72BD188B60045E591 /* LoginItems in Frameworks */, 372217802B3337FE00B8E9C2 /* TestUtils in Frameworks */, 7BA076BB2B65D61400D7FB72 /* NetworkProtectionProxy in Frameworks */, @@ -4586,6 +4600,7 @@ buildActionMask = 2147483647; files = ( 37DB56ED2C3B314F0093D4DC /* BrowserServicesKit in Frameworks */, + 9D9DE57D2C63AA2400D20B15 /* AppKitExtensions in Frameworks */, B6E6BA082BA1FE24008AA7E1 /* Common in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -5056,6 +5071,7 @@ 378E279C2970217400FCADA2 /* LocalPackages */ = { isa = PBXGroup; children = ( + 9D9DE5712C63A96400D20B15 /* AppKitExtensions */, 7B9167A82C09E88800322310 /* AppLauncher */, 378E279D2970217400FCADA2 /* BuildToolPlugins */, 3192A2702A4C4E330084EA89 /* DataBrokerProtection */, @@ -8666,6 +8682,7 @@ 7B2366852C09FACD002D393F /* VPNAppLauncher */, 371209242C232E6C003ADF3D /* RemoteMessaging */, D6BC8AC72C5A95B10025375B /* DuckPlayer */, + 9D9DE5742C63AA0C00D20B15 /* AppKitExtensions */, ); productName = DuckDuckGo; productReference = 3706FD05293F65D500E42796 /* DuckDuckGo App Store.app */; @@ -8784,6 +8801,7 @@ 7BBE2B7A2B61663C00697445 /* NetworkProtectionProxy */, 7B37C7A42BAA32A50062546A /* Subscription */, F198C7172BD18A4C000BF24D /* PixelKit */, + 9D9DE57A2C63AA1F00D20B15 /* AppKitExtensions */, ); productName = NetworkProtectionSystemExtension; productReference = 4B25375A2A11BE7300610219 /* com.duckduckgo.macos.vpn.network-extension.debug.systemextension */; @@ -8818,6 +8836,7 @@ F198C7192BD18A5B000BF24D /* PixelKit */, BDADBDC82BD2BC2200421B9B /* Lottie */, 7B23668B2C09FAF1002D393F /* VPNAppLauncher */, + 9D9DE5802C63BA0B00D20B15 /* AppKitExtensions */, ); productName = DuckDuckGoAgent; productReference = 4B2D06392A11CFBB00DE1F49 /* DuckDuckGo VPN.app */; @@ -8852,6 +8871,7 @@ F198C71B2BD18A61000BF24D /* PixelKit */, BDADBDCA2BD2BC2800421B9B /* Lottie */, 7B23668D2C09FAFA002D393F /* VPNAppLauncher */, + 9D9DE5822C63BE9600D20B15 /* AppKitExtensions */, ); productName = DuckDuckGoAgentAppStore; productReference = 4B2D06692A13318400DE1F49 /* DuckDuckGo VPN App Store.app */; @@ -8902,6 +8922,7 @@ DC3F73D49B2D44464AFEFCD8 /* Subscription */, F198C7152BD18A44000BF24D /* PixelKit */, 7B2366872C09FADA002D393F /* VPNAppLauncher */, + 9D9DE5762C63AA1600D20B15 /* AppKitExtensions */, ); productName = NetworkProtectionAppExtension; productReference = 4B4D603D2A0B290200BCD287 /* NetworkProtectionAppExtension.appex */; @@ -8941,6 +8962,7 @@ packageProductDependencies = ( B65CD8D22B316E1700A595BB /* SnapshotTesting */, EE02D41F2BB460C000DBE6B3 /* BrowserServicesKit */, + 9D9DE57E2C63B64F00D20B15 /* AppKitExtensions */, ); productName = "UI Tests"; productReference = 7B4CE8DA26F02108009134B1 /* UI Tests.xctest */; @@ -8963,6 +8985,7 @@ 7B97CD582B7E0B57004FEF43 /* NetworkProtectionProxy */, 7B97CD5A2B7E0B85004FEF43 /* Common */, 7B7DFB212B7E7473009EA1A3 /* Networking */, + 9D9DE5782C63AA1A00D20B15 /* AppKitExtensions */, ); productName = VPNProxyExtension; productReference = 7BDA36E52B7E037100AD5388 /* VPNProxyExtension.appex */; @@ -9071,6 +9094,7 @@ 7B2366832C09FAC2002D393F /* VPNAppLauncher */, 371209222C232E66003ADF3D /* RemoteMessaging */, D6BC8AC52C5A95AA0025375B /* DuckPlayer */, + 9D9DE5722C63AA0700D20B15 /* AppKitExtensions */, ); productName = DuckDuckGo; productReference = AA585D7E248FD31100E9A3E2 /* DuckDuckGo.app */; @@ -9120,6 +9144,7 @@ packageProductDependencies = ( B6E6BA072BA1FE24008AA7E1 /* Common */, 37DB56EC2C3B314F0093D4DC /* BrowserServicesKit */, + 9D9DE57C2C63AA2400D20B15 /* AppKitExtensions */, ); productName = "sandbox-test-tool"; productReference = B6E6B9F32BA1FD90008AA7E1 /* sandbox-test-tool.app */; @@ -11099,7 +11124,6 @@ B602E8232A1E260E006D261F /* Bundle+NetworkProtectionExtensions.swift in Sources */, 4B2D062A2A11C0C900DE1F49 /* NetworkProtectionOptionKeyExtension.swift in Sources */, B602E8192A1E2570006D261F /* URL+NetworkProtection.swift in Sources */, - 4B2D06322A11C1D300DE1F49 /* NSApplicationExtension.swift in Sources */, F1FDC93B2BF51F41006B1435 /* VPNSettings+Environment.swift in Sources */, 4BF0E50B2AD2552200FFEC9E /* NetworkProtectionPixelEvent.swift in Sources */, 7B01AC6F2C36BB7E004FADC7 /* VPNLogger.swift in Sources */, @@ -11228,7 +11252,6 @@ 4B4D60892A0B2A1C00BCD287 /* NetworkProtectionUNNotificationsPresenter.swift in Sources */, F1C70D7E2BFF510000599292 /* SubscriptionEnvironment+Default.swift in Sources */, 4B4D60A02A0B2D5B00BCD287 /* Bundle+VPN.swift in Sources */, - 4B4D60AD2A0C807300BCD287 /* NSApplicationExtension.swift in Sources */, F1DA51922BF6081C00CF29FA /* AttributionPixelHandler.swift in Sources */, 7B01AC6E2C36BB7E004FADC7 /* VPNLogger.swift in Sources */, 4B4D60A52A0B2EC000BCD287 /* UserText+NetworkProtectionExtensions.swift in Sources */, @@ -11275,7 +11298,6 @@ buildActionMask = 2147483647; files = ( 7B97CD5C2B7E0BBB004FEF43 /* UserDefaultsWrapper.swift in Sources */, - 7B97CD5F2B7E0BF7004FEF43 /* NSApplicationExtension.swift in Sources */, 7BDA36F52B7E055800AD5388 /* MacTransparentProxyProvider.swift in Sources */, 7B97CD5D2B7E0BCE004FEF43 /* BundleExtension.swift in Sources */, ); @@ -12464,7 +12486,6 @@ files = ( B6E6BA142BA2CDD6008AA7E1 /* SandboxTestToolNotifications.swift in Sources */, B6E6BA042BA1FE05008AA7E1 /* FilePresenter.swift in Sources */, - B6E6BA062BA1FE10008AA7E1 /* NSApplicationExtension.swift in Sources */, B6E6B9F62BA1FD90008AA7E1 /* SandboxTestTool.swift in Sources */, B6E6BA252BA2EDDE008AA7E1 /* FileReadResult.swift in Sources */, B6EECB322BC40A1400B3CB77 /* FileManagerExtension.swift in Sources */, @@ -13922,6 +13943,42 @@ isa = XCSwiftPackageProductDependency; productName = DataBrokerProtection; }; + 9D9DE5722C63AA0700D20B15 /* AppKitExtensions */ = { + isa = XCSwiftPackageProductDependency; + productName = AppKitExtensions; + }; + 9D9DE5742C63AA0C00D20B15 /* AppKitExtensions */ = { + isa = XCSwiftPackageProductDependency; + productName = AppKitExtensions; + }; + 9D9DE5762C63AA1600D20B15 /* AppKitExtensions */ = { + isa = XCSwiftPackageProductDependency; + productName = AppKitExtensions; + }; + 9D9DE5782C63AA1A00D20B15 /* AppKitExtensions */ = { + isa = XCSwiftPackageProductDependency; + productName = AppKitExtensions; + }; + 9D9DE57A2C63AA1F00D20B15 /* AppKitExtensions */ = { + isa = XCSwiftPackageProductDependency; + productName = AppKitExtensions; + }; + 9D9DE57C2C63AA2400D20B15 /* AppKitExtensions */ = { + isa = XCSwiftPackageProductDependency; + productName = AppKitExtensions; + }; + 9D9DE57E2C63B64F00D20B15 /* AppKitExtensions */ = { + isa = XCSwiftPackageProductDependency; + productName = AppKitExtensions; + }; + 9D9DE5802C63BA0B00D20B15 /* AppKitExtensions */ = { + isa = XCSwiftPackageProductDependency; + productName = AppKitExtensions; + }; + 9D9DE5822C63BE9600D20B15 /* AppKitExtensions */ = { + isa = XCSwiftPackageProductDependency; + productName = AppKitExtensions; + }; 9DC70B192AA1FA5B005A844B /* LoginItems */ = { isa = XCSwiftPackageProductDependency; productName = LoginItems; diff --git a/DuckDuckGo/Common/Extensions/NSApplicationExtension.swift b/DuckDuckGo/Common/Extensions/NSApplicationExtension.swift index 3b274ad164..9e22276407 100644 --- a/DuckDuckGo/Common/Extensions/NSApplicationExtension.swift +++ b/DuckDuckGo/Common/Extensions/NSApplicationExtension.swift @@ -21,66 +21,6 @@ import Combine extension NSApplication { - var isSandboxed: Bool { - ProcessInfo.processInfo.environment["APP_SANDBOX_CONTAINER_ID"] != nil - } - - enum RunType { - case normal - case unitTests - case integrationTests - case uiTests - case uiTestsOnboarding - case xcPreviews - - /// Defines if app run type requires loading full environment, i.e. databases, saved state, keychain etc. - var requiresEnvironment: Bool { - switch self { - case .normal, .integrationTests, .uiTests, .uiTestsOnboarding: - return true - case .unitTests, .xcPreviews: - return false - } - } - } - - static let runType: RunType = { -#if DEBUG - if let testBundlePath = ProcessInfo().environment["XCTestBundlePath"] { - if testBundlePath.contains("Unit") { - return .unitTests - } else if testBundlePath.contains("Integration") { - return .integrationTests - } else { - return .uiTests - } - } else if ProcessInfo().environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1" { - return .xcPreviews - } else if ProcessInfo.processInfo.environment["UITEST_MODE_ONBOARDING"] == "1"{ - return .uiTestsOnboarding - } else if ProcessInfo.processInfo.environment["UITEST_MODE"] == "1" { - return .uiTests - } else { - return .normal - } -#elseif REVIEW - let isCI = ProcessInfo.processInfo.environment["CI"] != nil - // UITEST_MODE is set from UI Tests code, but this check didn't work reliably - // in CI on its own, so we're defaulting all CI runs of the REVIEW app to UI Tests - if ProcessInfo().environment["UITEST_MODE_ONBOARDING"] == "1" { - return .uiTestsOnboarding - } - if ProcessInfo.processInfo.environment["UITEST_MODE"] == "1" || isCI { - return .uiTests - } - return .normal -#else - return .normal -#endif - }() - var runType: RunType { Self.runType } - -#if !NETWORK_EXTENSION && !SANDBOX_TEST_TOOL var mainMenuTyped: MainMenu { return mainMenu as! MainMenu // swiftlint:disable:this force_cast } @@ -88,36 +28,4 @@ extension NSApplication { var delegateTyped: AppDelegate { return delegate as! AppDelegate // swiftlint:disable:this force_cast } -#endif - - var isCommandPressed: Bool { - currentEvent?.modifierFlags.contains(.command) ?? false - } - - var isShiftPressed: Bool { - currentEvent?.modifierFlags.contains(.shift) ?? false - } - - var isOptionPressed: Bool { - currentEvent?.modifierFlags.contains(.option) ?? false - } - - var isReturnOrEnterPressed: Bool { - guard let event = currentEvent, - case .keyDown = event.type - else { return false } - return event.keyCode == 36 || event.keyCode == 76 - } - - func isActivePublisher() -> AnyPublisher { - let activated = NotificationCenter.default - .publisher(for: NSApplication.didBecomeActiveNotification).map { _ in true } - let deactivated = NotificationCenter.default - .publisher(for: NSApplication.didResignActiveNotification).map { _ in false } - - return Just(self.isActive) - .merge(with: activated.merge(with: deactivated)) - .eraseToAnyPublisher() - } - } diff --git a/DuckDuckGo/Common/Extensions/URLExtension.swift b/DuckDuckGo/Common/Extensions/URLExtension.swift index 3164a21591..ca459c0173 100644 --- a/DuckDuckGo/Common/Extensions/URLExtension.swift +++ b/DuckDuckGo/Common/Extensions/URLExtension.swift @@ -20,6 +20,7 @@ import AppKit import BrowserServicesKit import Common import Foundation +import AppKitExtensions extension URL.NavigationalScheme { diff --git a/DuckDuckGo/Common/Utilities/UserDefaultsWrapper.swift b/DuckDuckGo/Common/Utilities/UserDefaultsWrapper.swift index 5b928018e5..02e6b55d7c 100644 --- a/DuckDuckGo/Common/Utilities/UserDefaultsWrapper.swift +++ b/DuckDuckGo/Common/Utilities/UserDefaultsWrapper.swift @@ -18,6 +18,7 @@ import AppKit import Foundation +import AppKitExtensions extension UserDefaults { /// The app group's shared UserDefaults diff --git a/DuckDuckGo/FileDownload/Services/DownloadListStore.swift b/DuckDuckGo/FileDownload/Services/DownloadListStore.swift index 9af9ffb38a..5d3670f07d 100644 --- a/DuckDuckGo/FileDownload/Services/DownloadListStore.swift +++ b/DuckDuckGo/FileDownload/Services/DownloadListStore.swift @@ -22,6 +22,7 @@ import CoreData import Foundation import UniformTypeIdentifiers import PixelKit +import AppKitExtensions protocol DownloadListStoring { diff --git a/DuckDuckGo/RemoteMessaging/RemoteMessagingDebugMenu.swift b/DuckDuckGo/RemoteMessaging/RemoteMessagingDebugMenu.swift index 7242914ffd..6cfb5eff71 100644 --- a/DuckDuckGo/RemoteMessaging/RemoteMessagingDebugMenu.swift +++ b/DuckDuckGo/RemoteMessaging/RemoteMessagingDebugMenu.swift @@ -18,6 +18,7 @@ import AppKit import RemoteMessaging +import AppKitExtensions final class RemoteMessagingDebugMenu: NSMenu { diff --git a/DuckDuckGoVPN/DuckDuckGoVPNAppDelegate.swift b/DuckDuckGoVPN/DuckDuckGoVPNAppDelegate.swift index e6d7739c46..1f5ada33ed 100644 --- a/DuckDuckGoVPN/DuckDuckGoVPNAppDelegate.swift +++ b/DuckDuckGoVPN/DuckDuckGoVPNAppDelegate.swift @@ -440,17 +440,3 @@ final class DuckDuckGoVPNAppDelegate: NSObject, NSApplicationDelegate { } } } - -extension NSApplication { - - enum RunType: Int, CustomStringConvertible { - case normal - var description: String { - switch self { - case .normal: return "normal" - } - } - } - static var runType: RunType { .normal } - -} diff --git a/LocalPackages/AppKitExtensions/.gitignore b/LocalPackages/AppKitExtensions/.gitignore new file mode 100644 index 0000000000..3b29812086 --- /dev/null +++ b/LocalPackages/AppKitExtensions/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ +DerivedData/ +.swiftpm/config/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc diff --git a/LocalPackages/AppKitExtensions/Package.swift b/LocalPackages/AppKitExtensions/Package.swift new file mode 100644 index 0000000000..eed4c86e5c --- /dev/null +++ b/LocalPackages/AppKitExtensions/Package.swift @@ -0,0 +1,24 @@ +// swift-tools-version: 5.7 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "AppKitExtensions", + platforms: [ .macOS("11.4") ], + products: [ + .library(name: "AppKitExtensions", targets: ["AppKitExtensions"]), + ], + dependencies: [ + ], + targets: [ + .target( + name: "AppKitExtensions", + dependencies: [ + ], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ] + ), + ] +) diff --git a/LocalPackages/AppKitExtensions/README.md b/LocalPackages/AppKitExtensions/README.md new file mode 100644 index 0000000000..7bc0fbf786 --- /dev/null +++ b/LocalPackages/AppKitExtensions/README.md @@ -0,0 +1,6 @@ +# AppKitExtensions + +A package for any extensions on AppKit classes, so local packages and other targets besides the main app can use them. + +- If you need to add a new one put it here unless it's specific to the main app. +- If you need to modify on existing one, consider moving it here. diff --git a/LocalPackages/AppKitExtensions/Sources/AppKitExtensions/NSApplicationExtension.swift b/LocalPackages/AppKitExtensions/Sources/AppKitExtensions/NSApplicationExtension.swift new file mode 100644 index 0000000000..ba442dce6b --- /dev/null +++ b/LocalPackages/AppKitExtensions/Sources/AppKitExtensions/NSApplicationExtension.swift @@ -0,0 +1,100 @@ +// +// NSApplicationExtension.swift +// +// Copyright © 2020 DuckDuckGo. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import Cocoa +import Combine + +public extension NSApplication { + + var isSandboxed: Bool { + ProcessInfo.processInfo.environment["APP_SANDBOX_CONTAINER_ID"] != nil + } + + enum RunType { + case normal + case unitTests + case integrationTests + case uiTests + case uiTestsOnboarding + case xcPreviews + + /// Defines if app run type requires loading full environment, i.e. databases, saved state, keychain etc. + public var requiresEnvironment: Bool { + switch self { + case .normal, .integrationTests, .uiTests, .uiTestsOnboarding: + return true + case .unitTests, .xcPreviews: + return false + } + } + } + + static let runType: RunType = { + let isCI = ProcessInfo.processInfo.environment["CI"] != nil + + if let testBundlePath = ProcessInfo().environment["XCTestBundlePath"] { + if testBundlePath.contains("Unit") { + return .unitTests + } else if testBundlePath.contains("Integration") { + return .integrationTests + } else { + return .uiTests + } + } else if ProcessInfo().environment["XCODE_RUNNING_FOR_PREVIEWS"] == "1" { + return .xcPreviews + } else if ProcessInfo.processInfo.environment["UITEST_MODE_ONBOARDING"] == "1"{ + return .uiTestsOnboarding + } else if ProcessInfo.processInfo.environment["UITEST_MODE"] == "1" || isCI { + return .uiTests + } else { + return .normal + } + }() + var runType: RunType { Self.runType } + + var isCommandPressed: Bool { + currentEvent?.modifierFlags.contains(.command) ?? false + } + + var isShiftPressed: Bool { + currentEvent?.modifierFlags.contains(.shift) ?? false + } + + var isOptionPressed: Bool { + currentEvent?.modifierFlags.contains(.option) ?? false + } + + var isReturnOrEnterPressed: Bool { + guard let event = currentEvent, + case .keyDown = event.type + else { return false } + return event.keyCode == 36 || event.keyCode == 76 + } + + func isActivePublisher() -> AnyPublisher { + let activated = NotificationCenter.default + .publisher(for: NSApplication.didBecomeActiveNotification).map { _ in true } + let deactivated = NotificationCenter.default + .publisher(for: NSApplication.didResignActiveNotification).map { _ in false } + + return Just(self.isActive) + .merge(with: activated.merge(with: deactivated)) + .eraseToAnyPublisher() + } + +}