onesignal-expo-plugin
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -108,3 +108,4 @@ "use strict"; | ||
mode: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.mode, | ||
iPhoneDeploymentTarget: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.iPhoneDeploymentTarget | ||
iPhoneDeploymentTarget: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.iPhoneDeploymentTarget, | ||
iosNSEFilePath: onesignalProps.iosNSEFilePath | ||
}; | ||
@@ -137,9 +138,9 @@ // support for monorepos where node_modules can be up to 5 parents | ||
function xcodeProjectAddNse(appName, options, sourceDir) { | ||
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget } = options; | ||
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget, iosNSEFilePath } = options; | ||
// not awaiting in order to not block main thread | ||
(0, updatePodfile_1.updatePodfile)(iosPath).catch(err => { OneSignalLog_1.OneSignalLog.error(err); }); | ||
const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`; | ||
const sourceFile = "NotificationService.m"; | ||
const extFiles = [ | ||
"NotificationService.h", | ||
"NotificationService.m", | ||
`${iosConstants_1.NSE_TARGET_NAME}.entitlements`, | ||
@@ -161,2 +162,6 @@ `${iosConstants_1.NSE_TARGET_NAME}-Info.plist` | ||
} | ||
// Copy NSE source file either from configuration-provided location, falling back to the default one. | ||
const sourcePath = iosNSEFilePath !== null && iosNSEFilePath !== void 0 ? iosNSEFilePath : `${sourceDir}${sourceFile}`; | ||
const targetFile = `${iosPath}/${iosConstants_1.NSE_TARGET_NAME}/${sourceFile}`; | ||
await FileManager_1.FileManager.copyFile(`${sourcePath}`, targetFile); | ||
/* MODIFY COPIED EXTENSION FILES */ | ||
@@ -168,3 +173,3 @@ const nseUpdater = new NseUpdaterManager_1.default(iosPath); | ||
// Create new PBXGroup for the extension | ||
const extGroup = xcodeProject.addPbxGroup(extFiles, iosConstants_1.NSE_TARGET_NAME, iosConstants_1.NSE_TARGET_NAME); | ||
const extGroup = xcodeProject.addPbxGroup([...extFiles, sourceFile], iosConstants_1.NSE_TARGET_NAME, iosConstants_1.NSE_TARGET_NAME); | ||
// Add the new PBXGroup to the top level group. This makes the | ||
@@ -171,0 +176,0 @@ // files / folder appear in the file explorer in Xcode. |
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
## November 2022 | ||
### `1.3.0` - 11/30/22 | ||
#### Changes | ||
- Add `iosNSEFilePath` configuration options to the plugin, which allows an app to specify a custom iOS Notification Service Extension. | ||
## October 2022 | ||
@@ -5,0 +10,0 @@ ### `1.2.0` - 10/25/22 |
@@ -105,3 +105,4 @@ /** | ||
mode: onesignalProps?.mode, | ||
iPhoneDeploymentTarget: onesignalProps?.iPhoneDeploymentTarget | ||
iPhoneDeploymentTarget: onesignalProps?.iPhoneDeploymentTarget, | ||
iosNSEFilePath: onesignalProps.iosNSEFilePath | ||
}; | ||
@@ -149,3 +150,3 @@ | ||
): void { | ||
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget } = options; | ||
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget, iosNSEFilePath } = options; | ||
@@ -157,5 +158,5 @@ // not awaiting in order to not block main thread | ||
const sourceFile = "NotificationService.m" | ||
const extFiles = [ | ||
"NotificationService.h", | ||
"NotificationService.m", | ||
`${NSE_TARGET_NAME}.entitlements`, | ||
@@ -182,2 +183,7 @@ `${NSE_TARGET_NAME}-Info.plist` | ||
// Copy NSE source file either from configuration-provided location, falling back to the default one. | ||
const sourcePath = iosNSEFilePath ?? `${sourceDir}${sourceFile}` | ||
const targetFile = `${iosPath}/${NSE_TARGET_NAME}/${sourceFile}`; | ||
await FileManager.copyFile(`${sourcePath}`, targetFile); | ||
/* MODIFY COPIED EXTENSION FILES */ | ||
@@ -190,3 +196,3 @@ const nseUpdater = new NseUpdaterManager(iosPath); | ||
// Create new PBXGroup for the extension | ||
const extGroup = xcodeProject.addPbxGroup(extFiles, NSE_TARGET_NAME, NSE_TARGET_NAME); | ||
const extGroup = xcodeProject.addPbxGroup([...extFiles, sourceFile], NSE_TARGET_NAME, NSE_TARGET_NAME); | ||
@@ -193,0 +199,0 @@ // Add the new PBXGroup to the top level group. This makes the |
{ | ||
"name": "onesignal-expo-plugin", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "The OneSignal Expo plugin allows you to use OneSignal without leaving the managed workflow. Developed in collaboration with SweetGreen.", | ||
@@ -5,0 +5,0 @@ "main": "./app.plugin.js", |
@@ -89,2 +89,3 @@ <h1 align="center">Welcome to onesignal-expo-plugin 👋</h1> | ||
| `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. | | ||
| `iosNSEFilePath` | 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](https://github.com/OneSignal/onesignal-expo-plugin/blob/main/support/serviceExtensionFiles/NotificationService.m), then altered to support any custom logic required. e.g: `"./assets/NotificationService.m"`. | | ||
@@ -121,5 +122,6 @@ ### OneSignal App ID | ||
| Property | Details | | ||
|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `version` | Your app version. Corresponds to `CFBundleShortVersionString` on iOS. This value will be used in your NSE* target's plist file. | | ||
| `ios.buildNumber` | Build number for your iOS standalone app. Corresponds to `CFBundleVersion` and must match Apple's specified format. This value will be used in your NSE* target's plist file. | | ||
| `ios.bundleIdentifier` | Bundle identifier for your iOS standalone app. Corresponds to `CFBundleIdentifier`. This value will be used in your NSE* target's plist and entitlements file. | | ||
@@ -126,0 +128,0 @@ \* NSE = Notification Service Extension. Learn more about the NSE [here](https://documentation.onesignal.com/docs/service-extensions). |
@@ -31,2 +31,9 @@ /** | ||
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; | ||
}; | ||
@@ -45,3 +52,4 @@ | ||
bundleIdentifier?: string, | ||
iPhoneDeploymentTarget?: string | ||
iPhoneDeploymentTarget?: string, | ||
iosNSEFilePath?: string | ||
} | ||
@@ -48,0 +56,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89117
1136
185