onesignal-expo-plugin 1.0.0-beta8 → 1.0.0-beta9
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/README.md +12 -10
- package/build/onesignal/withOneSignalIos.js +10 -3
- package/build/support/iosConstants.js +1 -1
- package/build/testRuniOS.js +7 -1
- package/onesignal/withOneSignal.ts +1 -1
- package/onesignal/withOneSignalIos.ts +20 -7
- package/package.json +1 -1
- package/support/iosConstants.ts +1 -1
- package/testRuniOS.ts +11 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<h1 align="center">Welcome to onesignal-expo-plugin 👋</h1>
|
|
2
2
|
<p>
|
|
3
|
-
<img alt="Version" src="https://img.shields.io/badge/version-1.0.0--
|
|
3
|
+
<img alt="Version" src="https://img.shields.io/badge/version-1.0.0--beta9-blue.svg?cacheSeconds=2592000" />
|
|
4
4
|
<a href="https://github.com/OneSignal/onesignal-expo-plugin#readme" target="_blank">
|
|
5
5
|
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
|
|
6
6
|
</a>
|
|
@@ -32,6 +32,7 @@ This plugin is an [Expo Config Plugin](https://docs.expo.dev/guides/config-plugi
|
|
|
32
32
|
|
|
33
33
|
```sh
|
|
34
34
|
expo install onesignal-expo-plugin
|
|
35
|
+
yarn add react-native-onesignal
|
|
35
36
|
```
|
|
36
37
|
|
|
37
38
|
## Configuration in app.json / app.config.js
|
|
@@ -46,7 +47,6 @@ Add the plugin to the [plugin array](https://docs.expo.dev/versions/latest/confi
|
|
|
46
47
|
"onesignal-expo-plugin",
|
|
47
48
|
{
|
|
48
49
|
"mode": "development",
|
|
49
|
-
"devTeam": "91SW8A37CR"
|
|
50
50
|
}
|
|
51
51
|
]
|
|
52
52
|
]
|
|
@@ -63,19 +63,21 @@ export default {
|
|
|
63
63
|
[
|
|
64
64
|
"onesignal-expo-plugin",
|
|
65
65
|
{
|
|
66
|
-
mode:
|
|
67
|
-
devTeam: "91SW8A37CR"
|
|
66
|
+
mode: "development",
|
|
68
67
|
}
|
|
69
68
|
]
|
|
70
69
|
]
|
|
71
70
|
};
|
|
72
71
|
```
|
|
73
72
|
|
|
74
|
-
#### Plugin
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
#### Plugin Prop
|
|
74
|
+
You can pass props to the plugin config object to configure:
|
|
75
|
+
|
|
76
|
+
| Plugin Prop | | |
|
|
77
|
+
|--------------------------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
78
|
+
| `mode` | **required** | Used to configure [APNs environment](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment) entitlement. `"development"` or `"production"` |
|
|
79
|
+
| `devTeam` | optional | Used to configure Apple Team ID. You can find your Apple Team ID by running `expo credentials:manager` e.g: `"91SW8A37CR"` |
|
|
80
|
+
| `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"`. |
|
|
79
81
|
|
|
80
82
|
### OneSignal App ID
|
|
81
83
|
Add your OneSignal App ID to your [Expo constants via the `extra` param](https://docs.expo.dev/versions/latest/config/app/):
|
|
@@ -105,7 +107,7 @@ OneSignal.setAppId("YOUR-ONESIGNAL-APP-ID");
|
|
|
105
107
|
|
|
106
108
|
## Run
|
|
107
109
|
```sh
|
|
108
|
-
$ expo prebuild
|
|
110
|
+
$ expo prebuild --clean
|
|
109
111
|
|
|
110
112
|
# Build your native iOS project
|
|
111
113
|
$ expo run:ios
|
|
@@ -67,7 +67,13 @@ const withAppGroupPermissions = (config) => {
|
|
|
67
67
|
const withOneSignalNSE = (config, onesignalProps) => {
|
|
68
68
|
return (0, config_plugins_1.withXcodeProject)(config, async (props) => {
|
|
69
69
|
var _a;
|
|
70
|
-
|
|
70
|
+
const options = {
|
|
71
|
+
iosPath: props.modRequest.platformProjectRoot,
|
|
72
|
+
bundleIdentifier: (_a = props.ios) === null || _a === void 0 ? void 0 : _a.bundleIdentifier,
|
|
73
|
+
devTeam: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.devTeam,
|
|
74
|
+
iPhoneDeploymentTarget: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.iPhoneDeploymentTarget
|
|
75
|
+
};
|
|
76
|
+
xcodeProjectAddNse(props.modRequest.projectName || "", options, "node_modules/onesignal-expo-plugin/build/support/serviceExtensionFiles/");
|
|
71
77
|
return props;
|
|
72
78
|
});
|
|
73
79
|
};
|
|
@@ -80,7 +86,8 @@ const withOneSignalIos = (config, props) => {
|
|
|
80
86
|
return config;
|
|
81
87
|
};
|
|
82
88
|
exports.withOneSignalIos = withOneSignalIos;
|
|
83
|
-
function xcodeProjectAddNse(appName,
|
|
89
|
+
function xcodeProjectAddNse(appName, options, sourceDir) {
|
|
90
|
+
const { iosPath, devTeam, bundleIdentifier, iPhoneDeploymentTarget } = options;
|
|
84
91
|
(0, updatePodfile_1.updatePodfile)(iosPath);
|
|
85
92
|
(0, updateNSEEntitlements_1.updateNSEEntitlements)(`group.${bundleIdentifier}.onesignal`);
|
|
86
93
|
const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`;
|
|
@@ -144,7 +151,7 @@ function xcodeProjectAddNse(appName, iosPath, bundleIdentifier, devTeam, sourceD
|
|
|
144
151
|
configurations[key].buildSettings.PRODUCT_NAME == `"${targetName}"`) {
|
|
145
152
|
let buildSettingsObj = configurations[key].buildSettings;
|
|
146
153
|
buildSettingsObj.DEVELOPMENT_TEAM = devTeam;
|
|
147
|
-
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = iosConstants_1.IPHONEOS_DEPLOYMENT_TARGET;
|
|
154
|
+
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = iPhoneDeploymentTarget !== null && iPhoneDeploymentTarget !== void 0 ? iPhoneDeploymentTarget : iosConstants_1.IPHONEOS_DEPLOYMENT_TARGET;
|
|
148
155
|
buildSettingsObj.TARGETED_DEVICE_FAMILY = iosConstants_1.TARGETED_DEVICE_FAMILY;
|
|
149
156
|
buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${targetName}/${targetName}.entitlements`;
|
|
150
157
|
buildSettingsObj.CODE_SIGN_STYLE = "Automatic";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = exports.NSE_PODFILE_REGEX = exports.NSE_PODFILE_SNIPPET = exports.TARGETED_DEVICE_FAMILY = exports.IPHONEOS_DEPLOYMENT_TARGET = void 0;
|
|
4
|
-
exports.IPHONEOS_DEPLOYMENT_TARGET = "
|
|
4
|
+
exports.IPHONEOS_DEPLOYMENT_TARGET = "11.0";
|
|
5
5
|
exports.TARGETED_DEVICE_FAMILY = `\"1,2\"`;
|
|
6
6
|
exports.NSE_PODFILE_SNIPPET = `
|
|
7
7
|
target 'OneSignalNotificationServiceExtension' do
|
package/build/testRuniOS.js
CHANGED
|
@@ -11,4 +11,10 @@ const withOneSignalIos_1 = require("./onesignal/withOneSignalIos");
|
|
|
11
11
|
// - If you forget your main target in your Podfile you will get the
|
|
12
12
|
// "Please add the host targets for the embedded targets to the Podfile." error
|
|
13
13
|
// even if your .xcodeproj is correct.
|
|
14
|
-
|
|
14
|
+
const options = {
|
|
15
|
+
iosPath: '.',
|
|
16
|
+
bundleIdentifier: "com.onesignal.XcodeTestProj",
|
|
17
|
+
devTeam: "99SW8E36CT",
|
|
18
|
+
iPhoneDeploymentTarget: '12.0'
|
|
19
|
+
};
|
|
20
|
+
(0, withOneSignalIos_1.xcodeProjectAddNse)("XcodeTestProj", options, "../../repos/onesignal-expo-plugin/support/serviceExtensionFiles/");
|
|
@@ -12,8 +12,8 @@ export type OneSignalPluginProps = {
|
|
|
12
12
|
* (iOS only) Environment name and bundle identifier
|
|
13
13
|
*/
|
|
14
14
|
mode: string;
|
|
15
|
-
iOsBundleIdentifier: string;
|
|
16
15
|
devTeam: string;
|
|
16
|
+
iPhoneDeploymentTarget: string;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const withOneSignal: ConfigPlugin<OneSignalPluginProps> = (config, props) => {
|
|
@@ -16,6 +16,14 @@ import { IPHONEOS_DEPLOYMENT_TARGET, TARGETED_DEVICE_FAMILY } from "../support/i
|
|
|
16
16
|
import { updatePodfile } from "../support/updatePodfile";
|
|
17
17
|
import { updateNSEEntitlements } from "../support/updateNSEEntitlements";
|
|
18
18
|
|
|
19
|
+
/* I N T E R F A C E S */
|
|
20
|
+
interface PluginOptions {
|
|
21
|
+
iosPath: string,
|
|
22
|
+
devTeam?: string,
|
|
23
|
+
bundleIdentifier?: string,
|
|
24
|
+
iPhoneDeploymentTarget?: string
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
// ---------- ---------- ---------- ----------
|
|
20
28
|
|
|
21
29
|
/**
|
|
@@ -83,11 +91,16 @@ const withAppGroupPermissions: ConfigPlugin<OneSignalPluginProps> = (
|
|
|
83
91
|
|
|
84
92
|
const withOneSignalNSE: ConfigPlugin<OneSignalPluginProps> = (config, onesignalProps) => {
|
|
85
93
|
return withXcodeProject(config, async props => {
|
|
94
|
+
const options: PluginOptions = {
|
|
95
|
+
iosPath: props.modRequest.platformProjectRoot,
|
|
96
|
+
bundleIdentifier: props.ios?.bundleIdentifier,
|
|
97
|
+
devTeam: onesignalProps?.devTeam,
|
|
98
|
+
iPhoneDeploymentTarget: onesignalProps?.iPhoneDeploymentTarget
|
|
99
|
+
};
|
|
100
|
+
|
|
86
101
|
xcodeProjectAddNse(
|
|
87
102
|
props.modRequest.projectName || "",
|
|
88
|
-
|
|
89
|
-
props.ios?.bundleIdentifier || "",
|
|
90
|
-
onesignalProps?.devTeam,
|
|
103
|
+
options,
|
|
91
104
|
"node_modules/onesignal-expo-plugin/build/support/serviceExtensionFiles/"
|
|
92
105
|
);
|
|
93
106
|
|
|
@@ -110,11 +123,11 @@ export const withOneSignalIos: ConfigPlugin<OneSignalPluginProps> = (
|
|
|
110
123
|
|
|
111
124
|
export function xcodeProjectAddNse(
|
|
112
125
|
appName: string,
|
|
113
|
-
|
|
114
|
-
bundleIdentifier: string,
|
|
115
|
-
devTeam: string | undefined,
|
|
126
|
+
options: PluginOptions,
|
|
116
127
|
sourceDir: string
|
|
117
128
|
): void {
|
|
129
|
+
const { iosPath, devTeam, bundleIdentifier, iPhoneDeploymentTarget } = options;
|
|
130
|
+
|
|
118
131
|
updatePodfile(iosPath);
|
|
119
132
|
updateNSEEntitlements(`group.${bundleIdentifier}.onesignal`)
|
|
120
133
|
|
|
@@ -206,7 +219,7 @@ export function xcodeProjectAddNse(
|
|
|
206
219
|
) {
|
|
207
220
|
let buildSettingsObj = configurations[key].buildSettings;
|
|
208
221
|
buildSettingsObj.DEVELOPMENT_TEAM = devTeam;
|
|
209
|
-
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = IPHONEOS_DEPLOYMENT_TARGET;
|
|
222
|
+
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = iPhoneDeploymentTarget ?? IPHONEOS_DEPLOYMENT_TARGET;
|
|
210
223
|
buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;
|
|
211
224
|
buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${targetName}/${targetName}.entitlements`;
|
|
212
225
|
buildSettingsObj.CODE_SIGN_STYLE = "Automatic";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onesignal-expo-plugin",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta9",
|
|
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/support/iosConstants.ts
CHANGED
package/testRuniOS.ts
CHANGED
|
@@ -11,10 +11,16 @@ import { xcodeProjectAddNse } from "./onesignal/withOneSignalIos";
|
|
|
11
11
|
// - If you forget your main target in your Podfile you will get the
|
|
12
12
|
// "Please add the host targets for the embedded targets to the Podfile." error
|
|
13
13
|
// even if your .xcodeproj is correct.
|
|
14
|
+
|
|
15
|
+
const options = {
|
|
16
|
+
iosPath: '.',
|
|
17
|
+
bundleIdentifier: "com.onesignal.XcodeTestProj",
|
|
18
|
+
devTeam: "99SW8E36CT",
|
|
19
|
+
iPhoneDeploymentTarget: '12.0'
|
|
20
|
+
};
|
|
21
|
+
|
|
14
22
|
xcodeProjectAddNse(
|
|
15
|
-
"XcodeTestProj",
|
|
16
|
-
|
|
17
|
-
"com.onesignal.XcodeTestProj",
|
|
18
|
-
"99SW8E36CT",
|
|
23
|
+
"XcodeTestProj",
|
|
24
|
+
options,
|
|
19
25
|
"../../repos/onesignal-expo-plugin/support/serviceExtensionFiles/"
|
|
20
|
-
);
|
|
26
|
+
);
|