]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
Make app groups work on both iOS and macOS
authorRoopesh Chander <roop@roopc.net>
Thu, 27 Dec 2018 19:03:31 +0000 (00:33 +0530)
committerRoopesh Chander <roop@roopc.net>
Mon, 14 Jan 2019 09:22:28 +0000 (14:52 +0530)
Signed-off-by: Roopesh Chander <roop@roopc.net>
WireGuard/Shared/FileManager+Extension.swift
WireGuard/WireGuard.xcodeproj/project.pbxproj
WireGuard/WireGuard/UI/iOS/Info.plist
WireGuard/WireGuard/UI/macOS/Info.plist
WireGuard/WireGuard/UI/macOS/WireGuard.entitlements
WireGuard/WireGuardNetworkExtension/Info.plist
WireGuard/WireGuardNetworkExtension/WireGuardNetworkExtension_macOS.entitlements

index 5873f3b26e996078fe891d1d886afb6ac6881197..d98cd0a995366185104abefa3e49e78a7eb70834 100644 (file)
@@ -6,7 +6,12 @@ import os.log
 
 extension FileManager {
     private static var sharedFolderURL: URL? {
-        guard let appGroupId = Bundle.main.object(forInfoDictionaryKey: "com.wireguard.ios.app_group_id") as? String else {
+        #if os(iOS)
+        let appGroupIdInfoDictionaryKey = "com.wireguard.ios.app_group_id"
+        #elseif os(OSX)
+        let appGroupIdInfoDictionaryKey = "com.wireguard.macos.app_group_id"
+        #endif
+        guard let appGroupId = Bundle.main.object(forInfoDictionaryKey: appGroupIdInfoDictionaryKey) as? String else {
             os_log("Cannot obtain app group ID from bundle", log: OSLog.default, type: .error)
             return nil
         }
index eab1a2ab595da1679e304fb80cbe7ba18caa0147..c5c5486a7376fddfc0499e712221f07de0c2b54b 100644 (file)
                                        6FB1BD5C21D2607A00A991BF = {
                                                CreatedOnToolsVersion = 10.1;
                                                SystemCapabilities = {
+                                                       com.apple.ApplicationGroups.Mac = {
+                                                               enabled = 1;
+                                                       };
                                                        com.apple.NetworkExtensions = {
                                                                enabled = 1;
                                                        };
                                        };
                                        6FB1BD9021D4BFE600A991BF = {
                                                CreatedOnToolsVersion = 10.1;
+                                               SystemCapabilities = {
+                                                       com.apple.ApplicationGroups.Mac = {
+                                                               enabled = 1;
+                                                       };
+                                               };
                                        };
                                        6FDEF7DD21846BC100D8FBF6 = {
                                                CreatedOnToolsVersion = 10.0;
index 9b7bc07d70d3af411d004ae7e1815f6344fe78be..2a943eb0f1a821a827261ecf8f60e12aae0a1eae 100644 (file)
                </dict>
        </array>
        <key>com.wireguard.ios.app_group_id</key>
-    <string>group.$(APP_ID_IOS)</string>
+       <string>group.$(APP_ID_IOS)</string>
 </dict>
 </plist>
index 01b6caa22c5e880532f044fdec6342a7eda52e08..0c09003c7c64c145b23b5f85611c02faa6efffe9 100644 (file)
@@ -28,5 +28,7 @@
        <string>MainMenu</string>
        <key>NSPrincipalClass</key>
        <string>NSApplication</string>
+       <key>com.wireguard.macos.app_group_id</key>
+       <string>$(DEVELOPMENT_TEAM).group.$(APP_ID_MACOS)</string>
 </dict>
 </plist>
index 90b496c7de5bd42449a3b06038c31bdddea39b0c..fd5bd283cbee1c64b3244e84c9a0e5dc6518d5f8 100644 (file)
@@ -8,6 +8,10 @@
        </array>
        <key>com.apple.security.app-sandbox</key>
        <true/>
+       <key>com.apple.security.application-groups</key>
+       <array>
+               <string>$(DEVELOPMENT_TEAM).group.$(APP_ID_MACOS)</string>
+       </array>
        <key>com.apple.security.files.user-selected.read-only</key>
        <true/>
 </dict>
index 1075c539bedef447a84f205ddc4ba1b6c5b67925..0b32ba21eb0abe332535e218d63c33a791ca00d4 100644 (file)
@@ -30,6 +30,8 @@
                <string>$(PRODUCT_MODULE_NAME).PacketTunnelProvider</string>
        </dict>
        <key>com.wireguard.ios.app_group_id</key>
-    <string>group.$(APP_ID_IOS)</string>
+       <string>group.$(APP_ID_IOS)</string>
+       <key>com.wireguard.macos.app_group_id</key>
+       <string>$(DEVELOPMENT_TEAM).group.$(APP_ID_MACOS)</string>
 </dict>
 </plist>
index 3a24a44e48b1ce39c87ddc3ddfdf5f9b06111fb3..a54ac348c4a80aa4687e648e625ca59fbfecc3fb 100644 (file)
@@ -2,11 +2,15 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
-    <key>com.apple.security.app-sandbox</key>
-    <true/>
        <key>com.apple.developer.networking.networkextension</key>
        <array>
                <string>packet-tunnel-provider</string>
        </array>
+       <key>com.apple.security.app-sandbox</key>
+       <true/>
+       <key>com.apple.security.application-groups</key>
+       <array>
+               <string>$(DEVELOPMENT_TEAM).group.$(APP_ID_MACOS)</string>
+       </array>
 </dict>
 </plist>