onesignal-expo-plugin 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/release-drafter.yml +27 -0
- package/.github/workflows/Zapier.yml +29 -0
- package/.github/workflows/release-drafter.yml +42 -0
- package/CHANGELOG.md +10 -0
- package/EAS.md +1 -1
- package/README.md +15 -12
- package/build/onesignal/withOneSignalIos.js +13 -11
- package/onesignal/withOneSignalIos.ts +14 -11
- package/package.json +1 -1
- package/types/types.ts +9 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name-template: $RESOLVED_VERSION
|
|
2
|
+
tag-template: $RESOLVED_VERSION
|
|
3
|
+
categories:
|
|
4
|
+
- title: 🚀 Features
|
|
5
|
+
label: Enhancement / Feature
|
|
6
|
+
- title: 🐛 Bug Fixes
|
|
7
|
+
label: Bug
|
|
8
|
+
- title: 🧰 Improvements
|
|
9
|
+
label: Improvement
|
|
10
|
+
- title: down arrow Dependency Updates
|
|
11
|
+
label: Dependencies
|
|
12
|
+
change-template: '- $TITLE (#$NUMBER)'
|
|
13
|
+
version-resolver:
|
|
14
|
+
major:
|
|
15
|
+
labels:
|
|
16
|
+
- 'major'
|
|
17
|
+
minor:
|
|
18
|
+
labels:
|
|
19
|
+
- 'minor'
|
|
20
|
+
patch:
|
|
21
|
+
labels:
|
|
22
|
+
- 'patch'
|
|
23
|
+
default: patch
|
|
24
|
+
template: |
|
|
25
|
+
## Other Changes
|
|
26
|
+
|
|
27
|
+
$CHANGES
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# This is an action to close asana tasks that were generated by Github issues
|
|
2
|
+
|
|
3
|
+
name: Zapier web hook
|
|
4
|
+
|
|
5
|
+
# Controls when the workflow will run
|
|
6
|
+
on:
|
|
7
|
+
# Triggers the workflow on push or pull request events but only for the "main" branch
|
|
8
|
+
issues:
|
|
9
|
+
types: [closed]
|
|
10
|
+
|
|
11
|
+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
12
|
+
jobs:
|
|
13
|
+
# This workflow contains a single job called "build"
|
|
14
|
+
build:
|
|
15
|
+
# The type of runner that the job will run on
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
|
|
18
|
+
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
19
|
+
steps:
|
|
20
|
+
# Runs a set of commands using the runners shell
|
|
21
|
+
- name: Call Zapier web hook to close Asana task
|
|
22
|
+
if: ${{ !github.event.issue.pull_request }}
|
|
23
|
+
run: |
|
|
24
|
+
curl --location --request POST 'https://hooks.zapier.com/hooks/catch/12728683/b7009qc/' \
|
|
25
|
+
--header 'Content-Type: application/json' \
|
|
26
|
+
--header 'Accept: application/json' \
|
|
27
|
+
--data-raw '{
|
|
28
|
+
"task_name" : "${{ github.event.issue.title }}"
|
|
29
|
+
}'
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
name: Release Drafter
|
|
3
|
+
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
# branches to consider in the event; optional, defaults to all
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
# pull_request event is required only for autolabeler
|
|
10
|
+
pull_request:
|
|
11
|
+
# Only following types are handled by the action, but one can default to all as well
|
|
12
|
+
types: [opened, reopened, synchronize]
|
|
13
|
+
# pull_request_target event is required for autolabeler to support PRs from forks
|
|
14
|
+
# pull_request_target:
|
|
15
|
+
# types: [opened, reopened, synchronize]
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
update_release_draft:
|
|
22
|
+
permissions:
|
|
23
|
+
# write permission is required to create a github release
|
|
24
|
+
contents: write
|
|
25
|
+
# write permission is required for autolabeler
|
|
26
|
+
# otherwise, read permission is required at least
|
|
27
|
+
pull-requests: write
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
steps:
|
|
30
|
+
# (Optional) GitHub Enterprise requires GHE_HOST variable set
|
|
31
|
+
#- name: Set GHE_HOST
|
|
32
|
+
# run: |
|
|
33
|
+
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
|
|
34
|
+
|
|
35
|
+
# Drafts your next Release notes as Pull Requests are merged into "master"
|
|
36
|
+
- uses: release-drafter/release-drafter@v5
|
|
37
|
+
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
|
|
38
|
+
# with:
|
|
39
|
+
# config-name: my-config.yml
|
|
40
|
+
# disable-autolabeler: true
|
|
41
|
+
env:
|
|
42
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
|
3
3
|
|
|
4
|
+
## March 2023
|
|
5
|
+
### `1.3.1` - 03/03/23
|
|
6
|
+
#### Changes
|
|
7
|
+
- Update monorepo logic to rely on the more reliable `require.resolve` to find the `onesignal-expo-plugin` package.
|
|
8
|
+
|
|
9
|
+
## November 2022
|
|
10
|
+
### `1.3.0` - 11/30/22
|
|
11
|
+
#### Changes
|
|
12
|
+
- Add `iosNSEFilePath` configuration options to the plugin, which allows an app to specify a custom iOS Notification Service Extension.
|
|
13
|
+
|
|
4
14
|
## October 2022
|
|
5
15
|
### `1.2.0` - 10/25/22
|
|
6
16
|
#### Changes
|
package/EAS.md
CHANGED
|
@@ -18,4 +18,4 @@ For development/internal distribution builds, you will need to install a [develo
|
|
|
18
18
|
2. In the terminal, run `expo start --dev-client` to be able to serve the application to the client.
|
|
19
19
|
3. Scan the generated QR code to open the dev client and fetch the app bundle from the running Expo process.
|
|
20
20
|
4. You may be prompted to allow the app to find local area network devices. Approve.
|
|
21
|
-
5. Rescan the QR code & open the app. At this point, you should see the
|
|
21
|
+
5. Rescan the QR code & open the app. At this point, you should see the metro bundler working. As soon as the bundle is complete, your working app should open!
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<h1 align="center">Welcome to onesignal-expo-plugin 👋</h1>
|
|
1
|
+
<h1 align="center">Welcome to the onesignal-expo-plugin 👋</h1>
|
|
2
2
|
<p>
|
|
3
3
|
<a href="https://www.npmjs.com/package/onesignal-expo-plugin" target="_blank">
|
|
4
4
|
<img alt="Version" src="https://img.shields.io/npm/v/onesignal-expo-plugin.svg">
|
|
@@ -30,9 +30,10 @@ This plugin is an [Expo Config Plugin](https://docs.expo.dev/guides/config-plugi
|
|
|
30
30
|
---
|
|
31
31
|
|
|
32
32
|
## Install
|
|
33
|
+
You need both the `onesignal-expo-plugin` *and* the `react-native-onesignal` npm package.
|
|
33
34
|
|
|
34
35
|
```sh
|
|
35
|
-
expo install onesignal-expo-plugin
|
|
36
|
+
npx expo install onesignal-expo-plugin
|
|
36
37
|
|
|
37
38
|
# npm
|
|
38
39
|
npm install react-native-onesignal
|
|
@@ -43,7 +44,7 @@ yarn add react-native-onesignal
|
|
|
43
44
|
|
|
44
45
|
## Configuration in app.json / app.config.js
|
|
45
46
|
### Plugin
|
|
46
|
-
Add the plugin to the **front** of the [plugin array](https://docs.expo.dev/versions/latest/config/app/). It should be added automatically if you ran `expo install`. Just make sure it is the first plugin in the array and to configure any desired plugin props:
|
|
47
|
+
Add the plugin to the **front** of the [plugin array](https://docs.expo.dev/versions/latest/config/app/). It should be added automatically if you ran `npx expo install`. Just make sure it is the first plugin in the array and to configure any desired plugin props:
|
|
47
48
|
|
|
48
49
|
**app.json**
|
|
49
50
|
```json
|
|
@@ -86,6 +87,7 @@ You can pass props to the plugin config object to configure:
|
|
|
86
87
|
| `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"`. |
|
|
87
88
|
| `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. |
|
|
88
89
|
| `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. |
|
|
90
|
+
| `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"`. |
|
|
89
91
|
|
|
90
92
|
### OneSignal App ID
|
|
91
93
|
Add your OneSignal App ID to your [Expo constants via the `extra` param](https://docs.expo.dev/versions/latest/config/app/):
|
|
@@ -117,9 +119,10 @@ OneSignal.setAppId("YOUR-ONESIGNAL-APP-ID");
|
|
|
117
119
|
In your configuration file, make sure you set:
|
|
118
120
|
|
|
119
121
|
| Property | Details |
|
|
120
|
-
|
|
121
|
-
| `version` | Your app version. Corresponds to `CFBundleShortVersionString` on iOS. This value will be used in your NSE* target's plist file. |
|
|
122
|
-
| `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. |
|
|
122
|
+
|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
123
|
+
| `version` | Your app version. Corresponds to `CFBundleShortVersionString` on iOS. It is a human-readable version number of an iOS app, and is typically in the format of "X.X.X" (e.g. "1.0" or "2.3.1"). It is the version number that is typically displayed to users in the App Store and in the app itself. This value will be used in your NSE* target's plist file. |
|
|
124
|
+
| `ios.buildNumber` | Build number for your iOS standalone app. Corresponds to `CFBundleVersion` and must match Apple's specified format (e.g: "42" or "100"). The build number is used by the App Store and iOS to identify and track different versions of an app, and is typically incremented for each new release. It is a number typically used for the developer's and system reference. This value will be used in your NSE* target's plist file. |
|
|
125
|
+
| `ios.bundleIdentifier` | Bundle identifier for your iOS standalone app. Corresponds to `CFBundleIdentifier`. It's a unique identifier string that is used to identify an iOS app or bundle. It is typically in the format of `"com.companyname.appname"` (e.g. `"com.example.myapp"`). This value will be used in your NSE* target's plist and entitlements file. |
|
|
123
126
|
|
|
124
127
|
\* NSE = Notification Service Extension. Learn more about the NSE [here](https://documentation.onesignal.com/docs/service-extensions).
|
|
125
128
|
|
|
@@ -139,24 +142,24 @@ It may make sense to prebuild locally to inspect config plugin changes and help
|
|
|
139
142
|
|
|
140
143
|
#### Run
|
|
141
144
|
```sh
|
|
142
|
-
expo prebuild
|
|
145
|
+
npx expo prebuild
|
|
143
146
|
```
|
|
144
147
|
|
|
145
148
|
```sh
|
|
146
149
|
# nukes changes and rebuilds
|
|
147
|
-
expo prebuild --clean
|
|
150
|
+
npx expo prebuild --clean
|
|
148
151
|
```
|
|
149
152
|
|
|
150
|
-
**EAS Note:** if you choose to stay in a fully managed workflow by not prebuilding, EAS will still run `expo prebuild` at build time. You can also prebuild locally but remain in a fully managed workflow by adding the `android` and `ios` directories to your .gitignore.
|
|
153
|
+
**EAS Note:** if you choose to stay in a fully managed workflow by not prebuilding, EAS will still run `npx expo prebuild` at build time. You can also prebuild locally but remain in a fully managed workflow by adding the `android` and `ios` directories to your .gitignore.
|
|
151
154
|
|
|
152
155
|
## Run
|
|
153
156
|
The following commands will prebuild *and* run your application. Note that for iOS, push notifications will **not** work in the Simulator.
|
|
154
157
|
```sh
|
|
155
158
|
# Build and run your native iOS project
|
|
156
|
-
expo run:ios
|
|
159
|
+
npx expo run:ios
|
|
157
160
|
|
|
158
161
|
# Build and run your native Android project
|
|
159
|
-
expo run:android
|
|
162
|
+
npx expo run:android
|
|
160
163
|
```
|
|
161
164
|
|
|
162
165
|
---
|
|
@@ -178,5 +181,5 @@ Give a ⭐️ if this project helped you!
|
|
|
178
181
|
|
|
179
182
|
## 📝 License
|
|
180
183
|
|
|
181
|
-
Copyright ©
|
|
184
|
+
Copyright © 2023 [OneSignal](https://github.com/OneSignal).<br />
|
|
182
185
|
This project is [MIT](https://github.com/OneSignal/onesignal-expo-plugin/blob/main/LICENSE) licensed.
|
|
@@ -33,6 +33,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
33
33
|
exports.xcodeProjectAddNse = exports.withOneSignalIos = void 0;
|
|
34
34
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
35
35
|
const fs = __importStar(require("fs"));
|
|
36
|
+
const path = __importStar(require("path"));
|
|
36
37
|
const xcode_1 = __importDefault(require("xcode"));
|
|
37
38
|
const iosConstants_1 = require("../support/iosConstants");
|
|
38
39
|
const updatePodfile_1 = require("../support/updatePodfile");
|
|
@@ -105,15 +106,12 @@ const withOneSignalNSE = (config, onesignalProps) => {
|
|
|
105
106
|
bundleVersion: (_b = props.ios) === null || _b === void 0 ? void 0 : _b.buildNumber,
|
|
106
107
|
bundleShortVersion: props === null || props === void 0 ? void 0 : props.version,
|
|
107
108
|
mode: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.mode,
|
|
108
|
-
iPhoneDeploymentTarget: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.iPhoneDeploymentTarget
|
|
109
|
+
iPhoneDeploymentTarget: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.iPhoneDeploymentTarget,
|
|
110
|
+
iosNSEFilePath: onesignalProps.iosNSEFilePath
|
|
109
111
|
};
|
|
110
|
-
// support for monorepos where node_modules can be
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
for (let x = 0; x < 5 && !FileManager_1.FileManager.dirExists(dir); x++) {
|
|
114
|
-
dir = "../" + dir;
|
|
115
|
-
}
|
|
116
|
-
xcodeProjectAddNse(props.modRequest.projectName || "", options, dir + "/onesignal-expo-plugin/build/support/serviceExtensionFiles/");
|
|
112
|
+
// support for monorepos where node_modules can be above the project directory.
|
|
113
|
+
const pluginDir = require.resolve("onesignal-expo-plugin/package.json");
|
|
114
|
+
xcodeProjectAddNse(props.modRequest.projectName || "", options, path.join(pluginDir, "../build/support/serviceExtensionFiles/"));
|
|
117
115
|
return props;
|
|
118
116
|
});
|
|
119
117
|
};
|
|
@@ -133,13 +131,13 @@ const withOneSignalIos = (config, props) => {
|
|
|
133
131
|
};
|
|
134
132
|
exports.withOneSignalIos = withOneSignalIos;
|
|
135
133
|
function xcodeProjectAddNse(appName, options, sourceDir) {
|
|
136
|
-
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget } = options;
|
|
134
|
+
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget, iosNSEFilePath } = options;
|
|
137
135
|
// not awaiting in order to not block main thread
|
|
138
136
|
(0, updatePodfile_1.updatePodfile)(iosPath).catch(err => { OneSignalLog_1.OneSignalLog.error(err); });
|
|
139
137
|
const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`;
|
|
138
|
+
const sourceFile = "NotificationService.m";
|
|
140
139
|
const extFiles = [
|
|
141
140
|
"NotificationService.h",
|
|
142
|
-
"NotificationService.m",
|
|
143
141
|
`${iosConstants_1.NSE_TARGET_NAME}.entitlements`,
|
|
144
142
|
`${iosConstants_1.NSE_TARGET_NAME}-Info.plist`
|
|
145
143
|
];
|
|
@@ -156,13 +154,17 @@ function xcodeProjectAddNse(appName, options, sourceDir) {
|
|
|
156
154
|
const targetFile = `${iosPath}/${iosConstants_1.NSE_TARGET_NAME}/${extFile}`;
|
|
157
155
|
await FileManager_1.FileManager.copyFile(`${sourceDir}${extFile}`, targetFile);
|
|
158
156
|
}
|
|
157
|
+
// Copy NSE source file either from configuration-provided location, falling back to the default one.
|
|
158
|
+
const sourcePath = iosNSEFilePath !== null && iosNSEFilePath !== void 0 ? iosNSEFilePath : `${sourceDir}${sourceFile}`;
|
|
159
|
+
const targetFile = `${iosPath}/${iosConstants_1.NSE_TARGET_NAME}/${sourceFile}`;
|
|
160
|
+
await FileManager_1.FileManager.copyFile(`${sourcePath}`, targetFile);
|
|
159
161
|
/* MODIFY COPIED EXTENSION FILES */
|
|
160
162
|
const nseUpdater = new NseUpdaterManager_1.default(iosPath);
|
|
161
163
|
await nseUpdater.updateNSEEntitlements(`group.${bundleIdentifier}.onesignal`);
|
|
162
164
|
await nseUpdater.updateNSEBundleVersion(bundleVersion !== null && bundleVersion !== void 0 ? bundleVersion : iosConstants_1.DEFAULT_BUNDLE_VERSION);
|
|
163
165
|
await nseUpdater.updateNSEBundleShortVersion(bundleShortVersion !== null && bundleShortVersion !== void 0 ? bundleShortVersion : iosConstants_1.DEFAULT_BUNDLE_SHORT_VERSION);
|
|
164
166
|
// Create new PBXGroup for the extension
|
|
165
|
-
const extGroup = xcodeProject.addPbxGroup(extFiles, iosConstants_1.NSE_TARGET_NAME, iosConstants_1.NSE_TARGET_NAME);
|
|
167
|
+
const extGroup = xcodeProject.addPbxGroup([...extFiles, sourceFile], iosConstants_1.NSE_TARGET_NAME, iosConstants_1.NSE_TARGET_NAME);
|
|
166
168
|
// Add the new PBXGroup to the top level group. This makes the
|
|
167
169
|
// files / folder appear in the file explorer in Xcode.
|
|
168
170
|
const groups = xcodeProject.hash.project.objects["PBXGroup"];
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
withXcodeProject,
|
|
11
11
|
} from "@expo/config-plugins";
|
|
12
12
|
import * as fs from 'fs';
|
|
13
|
+
import * as path from 'path';
|
|
13
14
|
import xcode from 'xcode';
|
|
14
15
|
import {
|
|
15
16
|
DEFAULT_BUNDLE_SHORT_VERSION,
|
|
@@ -102,20 +103,17 @@ const withOneSignalNSE: ConfigPlugin<OneSignalPluginProps> = (config, onesignalP
|
|
|
102
103
|
bundleVersion: props.ios?.buildNumber,
|
|
103
104
|
bundleShortVersion: props?.version,
|
|
104
105
|
mode: onesignalProps?.mode,
|
|
105
|
-
iPhoneDeploymentTarget: onesignalProps?.iPhoneDeploymentTarget
|
|
106
|
+
iPhoneDeploymentTarget: onesignalProps?.iPhoneDeploymentTarget,
|
|
107
|
+
iosNSEFilePath: onesignalProps.iosNSEFilePath
|
|
106
108
|
};
|
|
107
109
|
|
|
108
|
-
// support for monorepos where node_modules can be
|
|
109
|
-
|
|
110
|
-
let dir = "node_modules"
|
|
111
|
-
for(let x=0; x < 5 && !FileManager.dirExists(dir); x++) {
|
|
112
|
-
dir = "../" + dir
|
|
113
|
-
}
|
|
110
|
+
// support for monorepos where node_modules can be above the project directory.
|
|
111
|
+
const pluginDir = require.resolve("onesignal-expo-plugin/package.json")
|
|
114
112
|
|
|
115
113
|
xcodeProjectAddNse(
|
|
116
114
|
props.modRequest.projectName || "",
|
|
117
115
|
options,
|
|
118
|
-
|
|
116
|
+
path.join(pluginDir, "../build/support/serviceExtensionFiles/")
|
|
119
117
|
);
|
|
120
118
|
|
|
121
119
|
return props;
|
|
@@ -145,16 +143,16 @@ export function xcodeProjectAddNse(
|
|
|
145
143
|
options: PluginOptions,
|
|
146
144
|
sourceDir: string
|
|
147
145
|
): void {
|
|
148
|
-
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget } = options;
|
|
146
|
+
const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget, iosNSEFilePath } = options;
|
|
149
147
|
|
|
150
148
|
// not awaiting in order to not block main thread
|
|
151
149
|
updatePodfile(iosPath).catch(err => { OneSignalLog.error(err) });
|
|
152
150
|
|
|
153
151
|
const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`;
|
|
154
152
|
|
|
153
|
+
const sourceFile = "NotificationService.m"
|
|
155
154
|
const extFiles = [
|
|
156
155
|
"NotificationService.h",
|
|
157
|
-
"NotificationService.m",
|
|
158
156
|
`${NSE_TARGET_NAME}.entitlements`,
|
|
159
157
|
`${NSE_TARGET_NAME}-Info.plist`
|
|
160
158
|
];
|
|
@@ -176,6 +174,11 @@ export function xcodeProjectAddNse(
|
|
|
176
174
|
await FileManager.copyFile(`${sourceDir}${extFile}`, targetFile);
|
|
177
175
|
}
|
|
178
176
|
|
|
177
|
+
// Copy NSE source file either from configuration-provided location, falling back to the default one.
|
|
178
|
+
const sourcePath = iosNSEFilePath ?? `${sourceDir}${sourceFile}`
|
|
179
|
+
const targetFile = `${iosPath}/${NSE_TARGET_NAME}/${sourceFile}`;
|
|
180
|
+
await FileManager.copyFile(`${sourcePath}`, targetFile);
|
|
181
|
+
|
|
179
182
|
/* MODIFY COPIED EXTENSION FILES */
|
|
180
183
|
const nseUpdater = new NseUpdaterManager(iosPath);
|
|
181
184
|
await nseUpdater.updateNSEEntitlements(`group.${bundleIdentifier}.onesignal`)
|
|
@@ -183,7 +186,7 @@ export function xcodeProjectAddNse(
|
|
|
183
186
|
await nseUpdater.updateNSEBundleShortVersion(bundleShortVersion ?? DEFAULT_BUNDLE_SHORT_VERSION);
|
|
184
187
|
|
|
185
188
|
// Create new PBXGroup for the extension
|
|
186
|
-
const extGroup = xcodeProject.addPbxGroup(extFiles, NSE_TARGET_NAME, NSE_TARGET_NAME);
|
|
189
|
+
const extGroup = xcodeProject.addPbxGroup([...extFiles, sourceFile], NSE_TARGET_NAME, NSE_TARGET_NAME);
|
|
187
190
|
|
|
188
191
|
// Add the new PBXGroup to the top level group. This makes the
|
|
189
192
|
// files / folder appear in the file explorer in Xcode.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onesignal-expo-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "The OneSignal Expo plugin allows you to use OneSignal without leaving the managed workflow. Developed in collaboration with SweetGreen.",
|
|
5
5
|
"main": "./app.plugin.js",
|
|
6
6
|
"scripts": {
|
package/types/types.ts
CHANGED
|
@@ -28,6 +28,13 @@
|
|
|
28
28
|
* (optional) The large notification icons for Android. Images will be automatically scaled up/down to 256x256.
|
|
29
29
|
*/
|
|
30
30
|
largeIcons?: string[];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* (optional) The local path to a custom Notification Service Extension (NSE), written in Objective-C. The NSE will typically start as a copy
|
|
34
|
+
* of the default NSE found at (support/serviceExtensionFiles/NotificationService.m, then altered to support any custom
|
|
35
|
+
* logic required.
|
|
36
|
+
*/
|
|
37
|
+
iosNSEFilePath?: string;
|
|
31
38
|
};
|
|
32
39
|
|
|
33
40
|
/**
|
|
@@ -41,7 +48,8 @@ export type PluginOptions = {
|
|
|
41
48
|
bundleVersion?: string,
|
|
42
49
|
bundleShortVersion?: string,
|
|
43
50
|
bundleIdentifier?: string,
|
|
44
|
-
iPhoneDeploymentTarget?: string
|
|
51
|
+
iPhoneDeploymentTarget?: string,
|
|
52
|
+
iosNSEFilePath?: string
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
export enum Mode {
|