Skip to content

Commit

Permalink
use new expo config appleTeamId
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreCapo committed Jan 31, 2025
1 parent 48b70c4 commit 295736a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 22 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ You can pass props to the plugin config object to configure:
| Plugin Prop | | |
|--------------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `mode` | **required** | Used to configure [APNs environment](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment) entitlement. `"development"` or `"production"` |
| `devTeam` | optional | Used to configure Apple Team ID. You can find your Apple Team ID by running `expo credentials:manager` e.g: `"91SW8A37CR"` |
| `iPhoneDeploymentTarget` | optional | Target `IPHONEOS_DEPLOYMENT_TARGET` value to be used when adding the iOS [NSE](https://documentation.onesignal.com/docs/service-extensions). A deployment target is nothing more than the minimum version of the operating system the application can run on. This value should match the value in your Podfile e.g: `"12.0"`. |
| `smallIcons` | optional | An array of local paths to small notification icons for Android. Image should be white, transparent, and 96x96 in size. Input images will be automatically scaled down and placed in the appropriate resource folders. e.g: `["./assets/ic_stat_onesignal_default.png"]`. See https://documentation.onesignal.com/docs/customize-notification-icons#small-notification-icons. |
| `largeIcons` | optional | An array of local paths to large notification icons for Android. Image should be white, transparent, and 256x256 in size. e.g: `["./assets/ic_onesignal_large_icon_default.png"]`. See https://documentation.onesignal.com/docs/customize-notification-icons#large-notification-icons. |
Expand Down
5 changes: 1 addition & 4 deletions onesignal/withOneSignalIos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,14 @@ const withOneSignalXcodeProject: ConfigPlugin<OneSignalPluginProps> = (config, p
configurations[key].buildSettings.PRODUCT_NAME == `"${NSE_TARGET_NAME}"`
) {
const buildSettingsObj = configurations[key].buildSettings;
buildSettingsObj.DEVELOPMENT_TEAM = props?.devTeam;
buildSettingsObj.DEVELOPMENT_TEAM = config.ios.appleTeamId;
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = props?.iPhoneDeploymentTarget ?? IPHONEOS_DEPLOYMENT_TARGET;
buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;
buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${NSE_TARGET_NAME}/${NSE_TARGET_NAME}.entitlements`;
buildSettingsObj.CODE_SIGN_STYLE = "Automatic";
}
}

// Add development teams to both your target and the original project
xcodeProject.addTargetAttribute("DevelopmentTeam", props?.devTeam, nseTarget);
xcodeProject.addTargetAttribute("DevelopmentTeam", props?.devTeam);
return newConfig;
})
}
Expand Down
4 changes: 0 additions & 4 deletions support/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ export function validatePluginProps(props: any): void {
throw new Error("OneSignal Expo Plugin: 'mode' must be a string.");
}

if (props.devTeam && typeof props.devTeam !== "string") {
throw new Error("OneSignal Expo Plugin: 'devTeam' must be a string.");
}

if (props.iPhoneDeploymentTarget && typeof props.iPhoneDeploymentTarget !== "string") {
throw new Error("OneSignal Expo Plugin: 'iPhoneDeploymentTarget' must be a string.");
}
Expand Down
20 changes: 7 additions & 13 deletions types/types.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
/**
* OneSignalPluginProps refer to the properties set by the user in their app config file (e.g: app.json)
*/
export type OneSignalPluginProps = {
export type OneSignalPluginProps = {
/**
* (required) Used to configure APNs environment entitlement. "development" or "production"
*/
mode: Mode;

/**
* (optional) Used to configure Apple Team ID. You can find your Apple Team ID by running expo credentials:manager e.g: "91SW8A37CR"
*/
devTeam?: string;

/**
* (optional) Target IPHONEOS_DEPLOYMENT_TARGET value to be used when adding the iOS NSE. A deployment target is nothing more than
* the minimum version of the operating system the application can run on. This value should match the value in your Podfile e.g: "12.0".
Expand All @@ -22,37 +17,36 @@
* (optional) The small notification icons for Android. Images will be automatically scaled up/down, the recommended size
* is 96x96 to always scale down.
*/
smallIcons?: string[];
smallIcons?: string[];

/**
* (optional) The accent color to use for notification icons on Android. Must be a valid Android color resource, for example: "#FF0000"
*/
smallIconAccentColor?: string;
smallIconAccentColor?: string;

/**
* (optional) The large notification icons for Android. Images will be automatically scaled up/down to 256x256.
*/
largeIcons?: string[];
largeIcons?: string[];

/**
* (optional) The local path to a custom Notification Service Extension (NSE), written in Objective-C. The NSE will typically start as a copy
* of the default NSE found at (support/serviceExtensionFiles/NotificationService.m, then altered to support any custom
* logic required.
*/
iosNSEFilePath?: string;
iosNSEFilePath?: string;
};

export const ONESIGNAL_PLUGIN_PROPS: string[] = [
"mode",
"devTeam",
"iPhoneDeploymentTarget",
"smallIcons",
"largeIcons",
"iosNSEFilePath",
"smallIconAccentColor"
"smallIconAccentColor",
];

export enum Mode {
Dev = "development",
Prod = "production"
Prod = "production",
}

0 comments on commit 295736a

Please sign in to comment.