Skip to content

Commit

Permalink
Add more config options
Browse files Browse the repository at this point in the history
  • Loading branch information
bndkt committed Jun 15, 2024
1 parent 4b56a95 commit 9781156
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ In your app’s Expo config (app.json, or app.config.js), make sure that react-n

## Additional parameters:

- **name** (string): The public name of the App Clip (displayed when opening it).
- **bundleIdSuffix** (string, default: "Clip"): The suffix that is appended to the bundle id to form the App Clip's bundle id.
- **targetSuffix** (string, default: "Clip"): The suffix that is appended to the target name.
- **groupIdentifier** (string): Configures an app group to share data between App Clip and full app (see [Apple Developer Docs](https://developer.apple.com/documentation/xcode/configuring-app-groups))
- **deploymentTarget** (string): Sets the deployment target for the App Clip. If you set this to "16.0", your App Clip can be 15 MB instead of 10 MB.
- **requestEphemeralUserNotification** (boolean): Enables notifications for the App Clip (see [Apple Developer Docs](https://developer.apple.com/documentation/app_clips/enabling_notifications_in_app_clips))
Expand Down
2 changes: 2 additions & 0 deletions example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"../app.plugin.js",
{
"name": "Example Clip",
"bundleIdSuffix": "AppClip",
"targetSuffix": "Clip",
"groupIdentifier": "dev.example.app",
"deploymentTarget": "14.2",
"requestEphemeralUserNotification": true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-app-clip",
"version": "0.3.0",
"version": "0.3.1",
"description": "Config plugin to add an App Clip to a React Native iOS app",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down
10 changes: 8 additions & 2 deletions plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { withXcode } from "./withXcode";

const withAppClip: ConfigPlugin<{
name?: string;
bundleIdSuffix?: string;
targetSuffix?: string;
groupIdentifier?: string;
deploymentTarget?: string;
requestEphemeralUserNotification?: boolean;
Expand All @@ -19,6 +21,8 @@ const withAppClip: ConfigPlugin<{
config,
{
name,
bundleIdSuffix,
targetSuffix,
groupIdentifier,
deploymentTarget,
requestEphemeralUserNotification,
Expand All @@ -29,15 +33,17 @@ const withAppClip: ConfigPlugin<{
} = {},
) => {
name ??= "Clip";
bundleIdSuffix ??= "Clip";
targetSuffix ??= "Clip";
deploymentTarget ??= "14.0";
appleSignin ??= false;

if (!config.ios?.bundleIdentifier) {
throw new Error("No bundle identifier specified in app config");
}

const bundleIdentifier = `${config.ios.bundleIdentifier}.Clip`;
const targetName = `${IOSConfig.XcodeUtils.sanitizedName(config.name)}Clip`;
const bundleIdentifier = `${config.ios.bundleIdentifier}.${bundleIdSuffix}`;
const targetName = `${IOSConfig.XcodeUtils.sanitizedName(config.name)}${targetSuffix}`;

const modifiedConfig = withPlugins(config, [
[
Expand Down

0 comments on commit 9781156

Please sign in to comment.