Make app groups work on both iOS and macOS
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
parent
55d6961a2f
commit
d7d4355f5e
|
@ -6,7 +6,12 @@ import os.log
|
||||||
|
|
||||||
extension FileManager {
|
extension FileManager {
|
||||||
private static var sharedFolderURL: URL? {
|
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)
|
os_log("Cannot obtain app group ID from bundle", log: OSLog.default, type: .error)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -689,6 +689,9 @@
|
||||||
6FB1BD5C21D2607A00A991BF = {
|
6FB1BD5C21D2607A00A991BF = {
|
||||||
CreatedOnToolsVersion = 10.1;
|
CreatedOnToolsVersion = 10.1;
|
||||||
SystemCapabilities = {
|
SystemCapabilities = {
|
||||||
|
com.apple.ApplicationGroups.Mac = {
|
||||||
|
enabled = 1;
|
||||||
|
};
|
||||||
com.apple.NetworkExtensions = {
|
com.apple.NetworkExtensions = {
|
||||||
enabled = 1;
|
enabled = 1;
|
||||||
};
|
};
|
||||||
|
@ -696,6 +699,11 @@
|
||||||
};
|
};
|
||||||
6FB1BD9021D4BFE600A991BF = {
|
6FB1BD9021D4BFE600A991BF = {
|
||||||
CreatedOnToolsVersion = 10.1;
|
CreatedOnToolsVersion = 10.1;
|
||||||
|
SystemCapabilities = {
|
||||||
|
com.apple.ApplicationGroups.Mac = {
|
||||||
|
enabled = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
6FDEF7DD21846BC100D8FBF6 = {
|
6FDEF7DD21846BC100D8FBF6 = {
|
||||||
CreatedOnToolsVersion = 10.0;
|
CreatedOnToolsVersion = 10.0;
|
||||||
|
|
|
@ -123,6 +123,6 @@
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>com.wireguard.ios.app_group_id</key>
|
<key>com.wireguard.ios.app_group_id</key>
|
||||||
<string>group.$(APP_ID_IOS)</string>
|
<string>group.$(APP_ID_IOS)</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -28,5 +28,7 @@
|
||||||
<string>MainMenu</string>
|
<string>MainMenu</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string>NSApplication</string>
|
<string>NSApplication</string>
|
||||||
|
<key>com.wireguard.macos.app_group_id</key>
|
||||||
|
<string>$(DEVELOPMENT_TEAM).group.$(APP_ID_MACOS)</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
</array>
|
</array>
|
||||||
<key>com.apple.security.app-sandbox</key>
|
<key>com.apple.security.app-sandbox</key>
|
||||||
<true/>
|
<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>
|
<key>com.apple.security.files.user-selected.read-only</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<string>$(PRODUCT_MODULE_NAME).PacketTunnelProvider</string>
|
<string>$(PRODUCT_MODULE_NAME).PacketTunnelProvider</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>com.wireguard.ios.app_group_id</key>
|
<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>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -2,11 +2,15 @@
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.security.app-sandbox</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.developer.networking.networkextension</key>
|
<key>com.apple.developer.networking.networkextension</key>
|
||||||
<array>
|
<array>
|
||||||
<string>packet-tunnel-provider</string>
|
<string>packet-tunnel-provider</string>
|
||||||
</array>
|
</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>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
Loading…
Reference in New Issue