diff options
author | 2018-12-28 00:33:31 +0530 | |
---|---|---|
committer | 2019-01-14 14:52:28 +0530 | |
commit | d7d4355f5efa9c78d721392c4d7d6474105f29c8 (patch) | |
tree | 89b338d97b44499a08a407f4bb8536ea16b55f2a | |
parent | macOS: Add Network Extensions capability to app (diff) | |
download | wireguard-apple-d7d4355f5efa9c78d721392c4d7d6474105f29c8.tar.xz wireguard-apple-d7d4355f5efa9c78d721392c4d7d6474105f29c8.zip |
Make app groups work on both iOS and macOS
Signed-off-by: Roopesh Chander <roop@roopc.net>
7 files changed, 30 insertions, 5 deletions
diff --git a/WireGuard/Shared/FileManager+Extension.swift b/WireGuard/Shared/FileManager+Extension.swift index 5873f3b..d98cd0a 100644 --- a/WireGuard/Shared/FileManager+Extension.swift +++ b/WireGuard/Shared/FileManager+Extension.swift @@ -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 } diff --git a/WireGuard/WireGuard.xcodeproj/project.pbxproj b/WireGuard/WireGuard.xcodeproj/project.pbxproj index eab1a2a..c5c5486 100644 --- a/WireGuard/WireGuard.xcodeproj/project.pbxproj +++ b/WireGuard/WireGuard.xcodeproj/project.pbxproj @@ -689,6 +689,9 @@ 6FB1BD5C21D2607A00A991BF = { CreatedOnToolsVersion = 10.1; SystemCapabilities = { + com.apple.ApplicationGroups.Mac = { + enabled = 1; + }; com.apple.NetworkExtensions = { enabled = 1; }; @@ -696,6 +699,11 @@ }; 6FB1BD9021D4BFE600A991BF = { CreatedOnToolsVersion = 10.1; + SystemCapabilities = { + com.apple.ApplicationGroups.Mac = { + enabled = 1; + }; + }; }; 6FDEF7DD21846BC100D8FBF6 = { CreatedOnToolsVersion = 10.0; diff --git a/WireGuard/WireGuard/UI/iOS/Info.plist b/WireGuard/WireGuard/UI/iOS/Info.plist index 9b7bc07..2a943eb 100644 --- a/WireGuard/WireGuard/UI/iOS/Info.plist +++ b/WireGuard/WireGuard/UI/iOS/Info.plist @@ -123,6 +123,6 @@ </dict> </array> <key>com.wireguard.ios.app_group_id</key> - <string>group.$(APP_ID_IOS)</string> + <string>group.$(APP_ID_IOS)</string> </dict> </plist> diff --git a/WireGuard/WireGuard/UI/macOS/Info.plist b/WireGuard/WireGuard/UI/macOS/Info.plist index 01b6caa..0c09003 100644 --- a/WireGuard/WireGuard/UI/macOS/Info.plist +++ b/WireGuard/WireGuard/UI/macOS/Info.plist @@ -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> diff --git a/WireGuard/WireGuard/UI/macOS/WireGuard.entitlements b/WireGuard/WireGuard/UI/macOS/WireGuard.entitlements index 90b496c..fd5bd28 100644 --- a/WireGuard/WireGuard/UI/macOS/WireGuard.entitlements +++ b/WireGuard/WireGuard/UI/macOS/WireGuard.entitlements @@ -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> diff --git a/WireGuard/WireGuardNetworkExtension/Info.plist b/WireGuard/WireGuardNetworkExtension/Info.plist index 1075c53..0b32ba2 100644 --- a/WireGuard/WireGuardNetworkExtension/Info.plist +++ b/WireGuard/WireGuardNetworkExtension/Info.plist @@ -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> diff --git a/WireGuard/WireGuardNetworkExtension/WireGuardNetworkExtension_macOS.entitlements b/WireGuard/WireGuardNetworkExtension/WireGuardNetworkExtension_macOS.entitlements index 3a24a44..a54ac34 100644 --- a/WireGuard/WireGuardNetworkExtension/WireGuardNetworkExtension_macOS.entitlements +++ b/WireGuard/WireGuardNetworkExtension/WireGuardNetworkExtension_macOS.entitlements @@ -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> |