-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from bndkt/v0.0.6-rc
v0.0.6
- Loading branch information
Showing
9 changed files
with
91 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ExportedConfig, InfoPlist } from "@expo/config-plugins"; | ||
|
||
export function getWidgetExtensionEntitlements( | ||
iosConfig: ExportedConfig["ios"], | ||
{ | ||
groupIdentifier, | ||
}: { | ||
groupIdentifier?: string; | ||
} | ||
) { | ||
const entitlements: InfoPlist = {}; | ||
|
||
addApplicationGroupsEntitlement(entitlements, groupIdentifier); | ||
|
||
return entitlements; | ||
} | ||
|
||
export function addApplicationGroupsEntitlement(entitlements: InfoPlist, groupIdentifier?: string) { | ||
if (groupIdentifier) { | ||
const existingApplicationGroups = (entitlements["com.apple.security.application-groups"] as string[]) ?? []; | ||
|
||
entitlements["com.apple.security.application-groups"] = [groupIdentifier, ...existingApplicationGroups]; | ||
} | ||
|
||
return entitlements; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import plist from "@expo/plist"; | ||
import { ConfigPlugin, withInfoPlist } from "@expo/config-plugins"; | ||
import * as fs from "fs"; | ||
import * as path from "path"; | ||
|
||
import { getWidgetExtensionEntitlements } from "./lib/getWidgetExtensionEntitlements"; | ||
|
||
export const withWidgetExtensionEntitlements: ConfigPlugin<{ | ||
targetName: string; | ||
targetPath: string; | ||
groupIdentifier: string; | ||
appleSignin: boolean; | ||
}> = (config, { targetName, groupIdentifier }) => { | ||
return withInfoPlist(config, (config) => { | ||
const targetPath = path.join(config.modRequest.platformProjectRoot, targetName); | ||
const filePath = path.join(targetPath, `${targetName}.entitlements`); | ||
|
||
const appClipEntitlements = getWidgetExtensionEntitlements(config.ios, { | ||
groupIdentifier, | ||
}); | ||
|
||
fs.mkdirSync(path.dirname(filePath), { recursive: true }); | ||
fs.writeFileSync(filePath, plist.build(appClipEntitlements)); | ||
|
||
return config; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters