onesignal-expo-plugin 2.0.3-beta.0 → 2.0.4
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 +44 -36
- package/build/onesignal/withOneSignalAndroid.js +6 -12
- package/build/onesignal/withOneSignalIos.js +35 -25
- package/build/support/FileManager.js +22 -8
- package/build/support/NseUpdaterManager.js +1 -1
- package/build/support/eas/getEasManagedCredentialsConfigExtra.js +8 -9
- package/build/support/helpers.js +1 -2
- package/build/support/updatePodfile.js +1 -2
- package/build/types/types.js +1 -1
- package/package.json +12 -11
- package/.eslintignore +0 -6
- package/.eslintrc.js +0 -18
- package/.github/ISSUE_TEMPLATE/ask-question.yml +0 -50
- package/.github/ISSUE_TEMPLATE/bug-report.yml +0 -71
- package/.github/ISSUE_TEMPLATE/general-feedback.yml +0 -27
- package/.github/os_probot_metadata.js +0 -58
- package/.github/pull_request_template.md +0 -46
- package/.github/release-drafter.yml +0 -27
- package/.github/set_response_times.js +0 -47
- package/.github/workflows/Zapier.yml +0 -34
- package/.github/workflows/release-drafter.yml +0 -42
- package/.github/workflows/set_response_time.yml +0 -32
- package/CHANGELOG.md +0 -83
- package/EAS.md +0 -21
- package/IOS_CREDENTIALS_EAS.md +0 -170
- package/onesignal/withOneSignal.ts +0 -28
- package/onesignal/withOneSignalAndroid.ts +0 -147
- package/onesignal/withOneSignalIos.ts +0 -235
- package/support/FileManager.ts +0 -42
- package/support/NseUpdaterManager.ts +0 -40
- package/support/OneSignalLog.ts +0 -9
- package/support/eas/getEasManagedCredentialsConfigExtra.ts +0 -33
- package/support/helpers.ts +0 -41
- package/support/iosConstants.ts +0 -25
- package/support/serviceExtensionFiles/NotificationService.h +0 -8
- package/support/serviceExtensionFiles/NotificationService.m +0 -29
- package/support/serviceExtensionFiles/OneSignalNotificationServiceExtension-Info.plist +0 -31
- package/support/serviceExtensionFiles/OneSignalNotificationServiceExtension.entitlements +0 -10
- package/support/updatePodfile.ts +0 -19
- package/tsconfig.json +0 -16
- package/types/types.ts +0 -58
package/README.md
CHANGED
|
@@ -16,44 +16,40 @@
|
|
|
16
16
|
|
|
17
17
|
> The OneSignal Expo plugin allows you to use OneSignal without leaving the managed workflow. Developed in collaboration with SweetGreen.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
- 🏠 [Homepage](https://github.com/OneSignal/onesignal-expo-plugin#readme)
|
|
20
|
+
- 🖤 [npm](https://www.npmjs.com/package/onesignal-expo-plugin)
|
|
21
21
|
|
|
22
22
|
## Overview
|
|
23
|
+
|
|
23
24
|
This plugin is an [Expo Config Plugin](https://docs.expo.dev/guides/config-plugins/). It extends the Expo config to allow customizing the prebuild phase of managed workflow builds (no need to eject to a bare workflow). For the purposes of OneSignal integration, the plugin facilitates automatically generating/configuring the necessary native code files needed to get the [OneSignal React-Native SDK](https://github.com/OneSignal/react-native-onesignal) to work. You can think of adding a plugin as adding custom native code.
|
|
24
25
|
|
|
25
26
|
## Supported environments:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
|
|
28
|
+
- [The Expo run commands](https://docs.expo.dev/workflow/customizing/) (`expo run:[android|ios]`)
|
|
29
|
+
- [Custom clients](https://blog.expo.dev/introducing-custom-development-clients-5a2c79a9ddf8)
|
|
30
|
+
- [EAS Build](https://docs.expo.dev/build/introduction/)
|
|
29
31
|
|
|
30
32
|
---
|
|
31
33
|
|
|
32
34
|
## Install
|
|
33
|
-
You need both the `onesignal-expo-plugin` *and* the `react-native-onesignal` npm package.
|
|
34
|
-
|
|
35
|
-
```sh
|
|
36
|
-
npx expo install onesignal-expo-plugin
|
|
37
|
-
|
|
38
|
-
# npm
|
|
39
|
-
npm install react-native-onesignal
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
yarn add react-native-onesignal
|
|
43
|
-
```
|
|
36
|
+
See the [Setup Guide](https://documentation.onesignal.com/docs/en/react-native-expo-sdk-setup) for setup instructions.
|
|
44
37
|
|
|
45
38
|
## Configuration in app.json / app.config.js
|
|
39
|
+
|
|
46
40
|
### Plugin
|
|
41
|
+
|
|
47
42
|
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:
|
|
48
43
|
|
|
49
44
|
**app.json**
|
|
45
|
+
|
|
50
46
|
```json
|
|
51
47
|
{
|
|
52
48
|
"plugins": [
|
|
53
49
|
[
|
|
54
50
|
"onesignal-expo-plugin",
|
|
55
51
|
{
|
|
56
|
-
"mode": "development"
|
|
52
|
+
"mode": "development"
|
|
57
53
|
}
|
|
58
54
|
]
|
|
59
55
|
]
|
|
@@ -63,6 +59,7 @@ Add the plugin to the **front** of the [plugin array](https://docs.expo.dev/vers
|
|
|
63
59
|
or
|
|
64
60
|
|
|
65
61
|
**app.config.js**
|
|
62
|
+
|
|
66
63
|
```js
|
|
67
64
|
export default {
|
|
68
65
|
...
|
|
@@ -78,22 +75,25 @@ export default {
|
|
|
78
75
|
```
|
|
79
76
|
|
|
80
77
|
#### Plugin Prop
|
|
78
|
+
|
|
81
79
|
You can pass props to the plugin config object to configure:
|
|
82
80
|
|
|
83
|
-
| Plugin Prop |
|
|
84
|
-
|
|
85
|
-
| `mode` | **required** | Used to configure
|
|
86
|
-
| `devTeam` | optional
|
|
87
|
-
| `iPhoneDeploymentTarget` | optional
|
|
88
|
-
| `smallIcons` | optional
|
|
89
|
-
| `largeIcons` | optional
|
|
90
|
-
| `smallIconAccentColor`
|
|
91
|
-
| `iosNSEFilePath` | optional
|
|
81
|
+
| Plugin Prop | | |
|
|
82
|
+
| ------------------------ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
83
|
+
| `mode` | **required** | Used to configure [APNs environment](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment) entitlement. `"development"` or `"production"` |
|
|
84
|
+
| `devTeam` | optional | Used to configure Apple Team ID. You can find your Apple Team ID by running `expo credentials:manager` e.g: `"91SW8A37CR"` |
|
|
85
|
+
| `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"`. |
|
|
86
|
+
| `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. |
|
|
87
|
+
| `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. |
|
|
88
|
+
| `smallIconAccentColor` | optional | The accent color to use for notification icons on Android. Must be a valid hex value, e.g: `"#FF0000"` |
|
|
89
|
+
| `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"`. |
|
|
92
90
|
|
|
93
91
|
### OneSignal App ID
|
|
92
|
+
|
|
94
93
|
Add your OneSignal App ID to your [Expo constants via the `extra` param](https://docs.expo.dev/versions/latest/config/app/#extra):
|
|
95
94
|
|
|
96
95
|
**Example:**
|
|
96
|
+
|
|
97
97
|
```json
|
|
98
98
|
{
|
|
99
99
|
"extra": {
|
|
@@ -105,7 +105,7 @@ Add your OneSignal App ID to your [Expo constants via the `extra` param](https:/
|
|
|
105
105
|
You can then access the value to pass to the `initialize` function:
|
|
106
106
|
|
|
107
107
|
```js
|
|
108
|
-
import { OneSignal } from
|
|
108
|
+
import { OneSignal } from "react-native-onesignal";
|
|
109
109
|
import Constants from "expo-constants";
|
|
110
110
|
OneSignal.initialize(Constants.expoConfig.extra.oneSignalAppId);
|
|
111
111
|
```
|
|
@@ -117,31 +117,37 @@ OneSignal.initialize("YOUR-ONESIGNAL-APP-ID");
|
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
### Versioning
|
|
120
|
+
|
|
120
121
|
In your configuration file, make sure you set:
|
|
121
122
|
|
|
122
|
-
| Property
|
|
123
|
-
|
|
124
|
-
| `version`
|
|
125
|
-
| `ios.buildNumber`
|
|
126
|
-
| `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
|
|
123
|
+
| Property | Details |
|
|
124
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
125
|
+
| `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. |
|
|
126
|
+
| `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. |
|
|
127
|
+
| `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. |
|
|
127
128
|
|
|
128
129
|
\* NSE = Notification Service Extension. Learn more about the NSE [here](https://documentation.onesignal.com/docs/service-extensions).
|
|
129
130
|
|
|
130
131
|
## EAS (Expo Application Services)
|
|
132
|
+
|
|
131
133
|
See our [EAS documentation](EAS.md) for help with EAS.
|
|
132
134
|
|
|
133
135
|
### iOS Credentials: OneSignal + EAS
|
|
136
|
+
|
|
134
137
|
To distribute your iOS application via EAS, you will need to ensure your credentials are set up correctly. See our [credentials setup guide for instructions](IOS_CREDENTIALS_EAS.md).
|
|
135
138
|
|
|
136
139
|
## Prebuild (optional)
|
|
140
|
+
|
|
137
141
|
Prebuilding in Expo will result in the generation of the native runtime code for the project (and `ios` and `android` directories being built). By prebuilding, we automatically link and configure the native modules that have implemented CocoaPods, autolinking, and other config plugins. You can think of prebuild like a native code bundler.
|
|
138
142
|
|
|
139
143
|
When you run `expo prebuild` we enter into a custom managed workflow which provides most of the benefits of bare workflows and managed workflows at the same time.
|
|
140
144
|
|
|
141
145
|
#### Why should I prebuild?
|
|
146
|
+
|
|
142
147
|
It may make sense to prebuild locally to inspect config plugin changes and help in debugging issues.
|
|
143
148
|
|
|
144
149
|
#### Run
|
|
150
|
+
|
|
145
151
|
```sh
|
|
146
152
|
npx expo prebuild
|
|
147
153
|
```
|
|
@@ -154,7 +160,9 @@ npx expo prebuild --clean
|
|
|
154
160
|
**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.
|
|
155
161
|
|
|
156
162
|
## Run
|
|
157
|
-
|
|
163
|
+
|
|
164
|
+
The following commands will prebuild _and_ run your application. Note that for iOS, push notifications will **not** work in the Simulator.
|
|
165
|
+
|
|
158
166
|
```sh
|
|
159
167
|
# Build and run your native iOS project
|
|
160
168
|
npx expo run:ios
|
|
@@ -175,10 +183,10 @@ Give a ⭐️ if this project helped you!
|
|
|
175
183
|
|
|
176
184
|
## OneSignal
|
|
177
185
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
186
|
+
- Website: https://onesignal.com
|
|
187
|
+
- Twitter: [@onesignal](https://twitter.com/onesignal)
|
|
188
|
+
- Github: [@OneSignal](https://github.com/OneSignal)
|
|
189
|
+
- LinkedIn: [@onesignal](https://linkedin.com/company/onesignal)
|
|
182
190
|
|
|
183
191
|
## 📝 License
|
|
184
192
|
|
|
@@ -24,16 +24,14 @@ const LARGE_ICON_DIRS_TO_SIZE = {
|
|
|
24
24
|
'drawable-xxxhdpi': 256
|
|
25
25
|
};
|
|
26
26
|
const withSmallIcons = (config, onesignalProps) => {
|
|
27
|
-
|
|
28
|
-
if (!onesignalProps.smallIcons && !((_a = config.notification) === null || _a === void 0 ? void 0 : _a.icon)) {
|
|
27
|
+
if (!onesignalProps.smallIcons && !config.notification?.icon) {
|
|
29
28
|
return config;
|
|
30
29
|
}
|
|
31
30
|
// we are modifying the android build (adding files) without a base mod
|
|
32
31
|
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
33
32
|
'android',
|
|
34
33
|
async (config) => {
|
|
35
|
-
|
|
36
|
-
if ((_a = config.notification) === null || _a === void 0 ? void 0 : _a.icon) {
|
|
34
|
+
if (config.notification?.icon) {
|
|
37
35
|
await saveIconAsync(config.notification.icon, config.modRequest.projectRoot, SMALL_ICON_DIRS_TO_SIZE);
|
|
38
36
|
}
|
|
39
37
|
if (onesignalProps.smallIcons) {
|
|
@@ -63,15 +61,11 @@ const withSmallIconAccentColor = (config, onesignalProps) => {
|
|
|
63
61
|
return config;
|
|
64
62
|
}
|
|
65
63
|
return (0, config_plugins_1.withStringsXml)(config, (config) => {
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
const strings = (_b = config.modResults.resources.string) !== null && _b !== void 0 ? _b : [];
|
|
64
|
+
const colorInARGB = `FF${onesignalProps.smallIconAccentColor?.replace('#', '')}`;
|
|
65
|
+
const strings = config.modResults.resources.string ?? [];
|
|
69
66
|
// Check if the accent color entry already exists
|
|
70
|
-
const hasAccentColor = strings.some((stringEntry) =>
|
|
71
|
-
|
|
72
|
-
return ((_a = stringEntry.$) === null || _a === void 0 ? void 0 : _a.name) === 'onesignal_notification_accent_color' &&
|
|
73
|
-
stringEntry._ === colorInARGB;
|
|
74
|
-
});
|
|
67
|
+
const hasAccentColor = strings.some((stringEntry) => stringEntry.$?.name === 'onesignal_notification_accent_color' &&
|
|
68
|
+
stringEntry._ === colorInARGB);
|
|
75
69
|
if (!hasAccentColor) {
|
|
76
70
|
const accentColorEntry = {
|
|
77
71
|
$: { name: 'onesignal_notification_accent_color' },
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
7
|
if (k2 === undefined) k2 = k;
|
|
8
|
-
Object.
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
9
13
|
}) : (function(o, m, k, k2) {
|
|
10
14
|
if (k2 === undefined) k2 = k;
|
|
11
15
|
o[k2] = m[k];
|
|
@@ -15,13 +19,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
19
|
}) : function(o, v) {
|
|
16
20
|
o["default"] = v;
|
|
17
21
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
25
39
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
40
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
41
|
};
|
|
@@ -43,7 +57,7 @@ const getEasManagedCredentialsConfigExtra_1 = __importDefault(require("../suppor
|
|
|
43
57
|
*/
|
|
44
58
|
const withAppEnvironment = (config, onesignalProps) => {
|
|
45
59
|
return (0, config_plugins_1.withEntitlementsPlist)(config, (newConfig) => {
|
|
46
|
-
if (
|
|
60
|
+
if (onesignalProps?.mode == null) {
|
|
47
61
|
throw new Error(`
|
|
48
62
|
Missing required "mode" key in your app.json or app.config.js file for "onesignal-expo-plugin".
|
|
49
63
|
"mode" can be either "development" or "production".
|
|
@@ -78,12 +92,11 @@ const withRemoteNotificationsPermissions = (config) => {
|
|
|
78
92
|
const withAppGroupPermissions = (config) => {
|
|
79
93
|
const APP_GROUP_KEY = "com.apple.security.application-groups";
|
|
80
94
|
return (0, config_plugins_1.withEntitlementsPlist)(config, newConfig => {
|
|
81
|
-
var _a;
|
|
82
95
|
if (!Array.isArray(newConfig.modResults[APP_GROUP_KEY])) {
|
|
83
96
|
newConfig.modResults[APP_GROUP_KEY] = [];
|
|
84
97
|
}
|
|
85
98
|
const modResultsArray = newConfig.modResults[APP_GROUP_KEY];
|
|
86
|
-
const entitlement = `group.${
|
|
99
|
+
const entitlement = `group.${newConfig?.ios?.bundleIdentifier || ""}.onesignal`;
|
|
87
100
|
if (modResultsArray.indexOf(entitlement) !== -1) {
|
|
88
101
|
return newConfig;
|
|
89
102
|
}
|
|
@@ -92,8 +105,7 @@ const withAppGroupPermissions = (config) => {
|
|
|
92
105
|
});
|
|
93
106
|
};
|
|
94
107
|
const withEasManagedCredentials = (config) => {
|
|
95
|
-
|
|
96
|
-
(0, assert_1.default)((_a = config.ios) === null || _a === void 0 ? void 0 : _a.bundleIdentifier, "Missing 'ios.bundleIdentifier' in app config.");
|
|
108
|
+
(0, assert_1.default)(config.ios?.bundleIdentifier, "Missing 'ios.bundleIdentifier' in app config.");
|
|
97
109
|
config.extra = (0, getEasManagedCredentialsConfigExtra_1.default)(config);
|
|
98
110
|
return config;
|
|
99
111
|
};
|
|
@@ -115,7 +127,6 @@ const withOneSignalNSE = (config, props) => {
|
|
|
115
127
|
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
116
128
|
'ios',
|
|
117
129
|
async (config) => {
|
|
118
|
-
var _a, _b, _c, _d, _e;
|
|
119
130
|
const iosPath = path.join(config.modRequest.projectRoot, "ios");
|
|
120
131
|
/* COPY OVER EXTENSION FILES */
|
|
121
132
|
fs.mkdirSync(`${iosPath}/${iosConstants_1.NSE_TARGET_NAME}`, { recursive: true });
|
|
@@ -125,23 +136,22 @@ const withOneSignalNSE = (config, props) => {
|
|
|
125
136
|
await FileManager_1.FileManager.copyFile(`${sourceDir}${extFile}`, targetFile);
|
|
126
137
|
}
|
|
127
138
|
// Copy NSE source file either from configuration-provided location, falling back to the default one.
|
|
128
|
-
const sourcePath =
|
|
139
|
+
const sourcePath = props.iosNSEFilePath ?? `${sourceDir}${iosConstants_1.NSE_SOURCE_FILE}`;
|
|
129
140
|
const targetFile = `${iosPath}/${iosConstants_1.NSE_TARGET_NAME}/${iosConstants_1.NSE_SOURCE_FILE}`;
|
|
130
141
|
await FileManager_1.FileManager.copyFile(`${sourcePath}`, targetFile);
|
|
131
142
|
/* MODIFY COPIED EXTENSION FILES */
|
|
132
143
|
const nseUpdater = new NseUpdaterManager_1.default(iosPath);
|
|
133
|
-
await nseUpdater.updateNSEEntitlements(`group.${
|
|
134
|
-
await nseUpdater.updateNSEBundleVersion(
|
|
135
|
-
await nseUpdater.updateNSEBundleShortVersion(
|
|
144
|
+
await nseUpdater.updateNSEEntitlements(`group.${config.ios?.bundleIdentifier}.onesignal`);
|
|
145
|
+
await nseUpdater.updateNSEBundleVersion(config.ios?.buildNumber ?? iosConstants_1.DEFAULT_BUNDLE_VERSION);
|
|
146
|
+
await nseUpdater.updateNSEBundleShortVersion(config?.version ?? iosConstants_1.DEFAULT_BUNDLE_SHORT_VERSION);
|
|
136
147
|
return config;
|
|
137
148
|
},
|
|
138
149
|
]);
|
|
139
150
|
};
|
|
140
151
|
const withOneSignalXcodeProject = (config, props) => {
|
|
141
152
|
return (0, config_plugins_1.withXcodeProject)(config, newConfig => {
|
|
142
|
-
var _a, _b;
|
|
143
153
|
const xcodeProject = newConfig.modResults;
|
|
144
|
-
if (
|
|
154
|
+
if (xcodeProject.pbxTargetByName(iosConstants_1.NSE_TARGET_NAME)) {
|
|
145
155
|
OneSignalLog_1.OneSignalLog.log(`${iosConstants_1.NSE_TARGET_NAME} already exists in project. Skipping...`);
|
|
146
156
|
return newConfig;
|
|
147
157
|
}
|
|
@@ -164,7 +174,7 @@ const withOneSignalXcodeProject = (config, props) => {
|
|
|
164
174
|
projObjects['PBXContainerItemProxy'] = projObjects['PBXTargetDependency'] || {};
|
|
165
175
|
// Add the NSE target
|
|
166
176
|
// This adds PBXTargetDependency and PBXContainerItemProxy for you
|
|
167
|
-
const nseTarget = xcodeProject.addTarget(iosConstants_1.NSE_TARGET_NAME, "app_extension", iosConstants_1.NSE_TARGET_NAME, `${
|
|
177
|
+
const nseTarget = xcodeProject.addTarget(iosConstants_1.NSE_TARGET_NAME, "app_extension", iosConstants_1.NSE_TARGET_NAME, `${config.ios?.bundleIdentifier}.${iosConstants_1.NSE_TARGET_NAME}`);
|
|
168
178
|
// Add build phases to the new target
|
|
169
179
|
xcodeProject.addBuildPhase(["NotificationService.m"], "PBXSourcesBuildPhase", "Sources", nseTarget.uuid);
|
|
170
180
|
xcodeProject.addBuildPhase([], "PBXResourcesBuildPhase", "Resources", nseTarget.uuid);
|
|
@@ -176,16 +186,16 @@ const withOneSignalXcodeProject = (config, props) => {
|
|
|
176
186
|
if (typeof configurations[key].buildSettings !== "undefined" &&
|
|
177
187
|
configurations[key].buildSettings.PRODUCT_NAME == `"${iosConstants_1.NSE_TARGET_NAME}"`) {
|
|
178
188
|
const buildSettingsObj = configurations[key].buildSettings;
|
|
179
|
-
buildSettingsObj.DEVELOPMENT_TEAM = props
|
|
180
|
-
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =
|
|
189
|
+
buildSettingsObj.DEVELOPMENT_TEAM = props?.devTeam;
|
|
190
|
+
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = props?.iPhoneDeploymentTarget ?? iosConstants_1.IPHONEOS_DEPLOYMENT_TARGET;
|
|
181
191
|
buildSettingsObj.TARGETED_DEVICE_FAMILY = iosConstants_1.TARGETED_DEVICE_FAMILY;
|
|
182
192
|
buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${iosConstants_1.NSE_TARGET_NAME}/${iosConstants_1.NSE_TARGET_NAME}.entitlements`;
|
|
183
193
|
buildSettingsObj.CODE_SIGN_STYLE = "Automatic";
|
|
184
194
|
}
|
|
185
195
|
}
|
|
186
196
|
// Add development teams to both your target and the original project
|
|
187
|
-
xcodeProject.addTargetAttribute("DevelopmentTeam", props
|
|
188
|
-
xcodeProject.addTargetAttribute("DevelopmentTeam", props
|
|
197
|
+
xcodeProject.addTargetAttribute("DevelopmentTeam", props?.devTeam, nseTarget);
|
|
198
|
+
xcodeProject.addTargetAttribute("DevelopmentTeam", props?.devTeam);
|
|
189
199
|
return newConfig;
|
|
190
200
|
});
|
|
191
201
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -11,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
11
15
|
}) : function(o, v) {
|
|
12
16
|
o["default"] = v;
|
|
13
17
|
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
21
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
36
|
exports.FileManager = void 0;
|
|
23
37
|
const fs = __importStar(require("fs"));
|
|
@@ -6,8 +6,8 @@ const iosConstants_1 = require("./iosConstants");
|
|
|
6
6
|
const entitlementsFileName = `OneSignalNotificationServiceExtension.entitlements`;
|
|
7
7
|
const plistFileName = `OneSignalNotificationServiceExtension-Info.plist`;
|
|
8
8
|
class NseUpdaterManager {
|
|
9
|
+
nsePath = '';
|
|
9
10
|
constructor(iosPath) {
|
|
10
|
-
this.nsePath = '';
|
|
11
11
|
this.nsePath = `${iosPath}/${iosConstants_1.NSE_TARGET_NAME}`;
|
|
12
12
|
}
|
|
13
13
|
async updateNSEEntitlements(groupIdentifier) {
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = getEasManagedCredentialsConfigExtra;
|
|
3
4
|
const iosConstants_1 = require("../iosConstants");
|
|
4
5
|
function getEasManagedCredentialsConfigExtra(config) {
|
|
5
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
6
6
|
return {
|
|
7
7
|
...config.extra,
|
|
8
8
|
eas: {
|
|
9
|
-
...
|
|
9
|
+
...config.extra?.eas,
|
|
10
10
|
build: {
|
|
11
|
-
...
|
|
11
|
+
...config.extra?.eas?.build,
|
|
12
12
|
experimental: {
|
|
13
|
-
...
|
|
13
|
+
...config.extra?.eas?.build?.experimental,
|
|
14
14
|
ios: {
|
|
15
|
-
...
|
|
15
|
+
...config.extra?.eas?.build?.experimental?.ios,
|
|
16
16
|
appExtensions: [
|
|
17
|
-
...(
|
|
17
|
+
...(config.extra?.eas?.build?.experimental?.ios?.appExtensions ?? []),
|
|
18
18
|
{
|
|
19
19
|
// keep in sync with native changes in NSE
|
|
20
20
|
targetName: iosConstants_1.NSE_TARGET_NAME,
|
|
21
|
-
bundleIdentifier: `${
|
|
21
|
+
bundleIdentifier: `${config?.ios?.bundleIdentifier}.${iosConstants_1.NSE_TARGET_NAME}`,
|
|
22
22
|
entitlements: {
|
|
23
23
|
'com.apple.security.application-groups': [
|
|
24
|
-
`group.${
|
|
24
|
+
`group.${config?.ios?.bundleIdentifier}.onesignal`
|
|
25
25
|
]
|
|
26
26
|
},
|
|
27
27
|
}
|
|
@@ -32,4 +32,3 @@ function getEasManagedCredentialsConfigExtra(config) {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
exports.default = getEasManagedCredentialsConfigExtra;
|
package/build/support/helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validatePluginProps =
|
|
3
|
+
exports.validatePluginProps = validatePluginProps;
|
|
4
4
|
const types_1 = require("../types/types");
|
|
5
5
|
function validatePluginProps(props) {
|
|
6
6
|
// check the type of each property
|
|
@@ -33,4 +33,3 @@ function validatePluginProps(props) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
exports.validatePluginProps = validatePluginProps;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.updatePodfile =
|
|
6
|
+
exports.updatePodfile = updatePodfile;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const iosConstants_1 = require("./iosConstants");
|
|
9
9
|
const OneSignalLog_1 = require("./OneSignalLog");
|
|
@@ -22,4 +22,3 @@ async function updatePodfile(iosPath) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
exports.updatePodfile = updatePodfile;
|
package/build/types/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onesignal-expo-plugin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
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
|
+
"files": [
|
|
7
|
+
"build",
|
|
8
|
+
"app.plugin.js"
|
|
9
|
+
],
|
|
6
10
|
"scripts": {
|
|
7
11
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
-
"build": "
|
|
9
|
-
"lint": "
|
|
10
|
-
"
|
|
12
|
+
"build": "bun run lint && rm -rf build && tsc && cp -a src/support/serviceExtensionFiles build/support/",
|
|
13
|
+
"lint": "oxlint src examples",
|
|
14
|
+
"lint:fix": "oxlint src examples --fix"
|
|
11
15
|
},
|
|
12
16
|
"repository": {
|
|
13
17
|
"type": "git",
|
|
@@ -34,14 +38,11 @@
|
|
|
34
38
|
},
|
|
35
39
|
"homepage": "https://github.com/OneSignal/onesignal-expo-plugin#readme",
|
|
36
40
|
"devDependencies": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"expo-module-scripts": "^2.0.0",
|
|
41
|
-
"readme-md-generator": "^1.0.0",
|
|
42
|
-
"typescript": "^4.5.5"
|
|
41
|
+
"expo-module-scripts": "^5.0.8",
|
|
42
|
+
"oxlint": "^1.43.0",
|
|
43
|
+
"typescript": "^5.9.3"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
|
-
"@expo/image-utils": "^0.
|
|
46
|
+
"@expo/image-utils": "^0.8.8"
|
|
46
47
|
}
|
|
47
48
|
}
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
parser: '@typescript-eslint/parser',
|
|
4
|
-
plugins: [
|
|
5
|
-
'@typescript-eslint',
|
|
6
|
-
],
|
|
7
|
-
parserOptions: {
|
|
8
|
-
project: "tsconfig.json",
|
|
9
|
-
},
|
|
10
|
-
extends: [
|
|
11
|
-
'eslint:recommended',
|
|
12
|
-
'plugin:@typescript-eslint/recommended',
|
|
13
|
-
],
|
|
14
|
-
rules: {
|
|
15
|
-
"@typescript-eslint/no-floating-promises": "error",
|
|
16
|
-
"no-extra-boolean-cast": "off"
|
|
17
|
-
}
|
|
18
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
name: 🙋♂️ Ask a question
|
|
2
|
-
description: Tell us what's on your mind
|
|
3
|
-
title: "[question]: "
|
|
4
|
-
labels: ["triage"]
|
|
5
|
-
# assignees:
|
|
6
|
-
# - assign your sdk team e.g., onesignal/unity
|
|
7
|
-
body:
|
|
8
|
-
- type: markdown
|
|
9
|
-
attributes:
|
|
10
|
-
value: |
|
|
11
|
-
Having issues integrating this SDK?
|
|
12
|
-
- type: textarea
|
|
13
|
-
id: question
|
|
14
|
-
attributes:
|
|
15
|
-
label: How can we help?
|
|
16
|
-
description: Specific question regarding integrating this SDK.
|
|
17
|
-
placeholder: How do I...?
|
|
18
|
-
validations:
|
|
19
|
-
required: true
|
|
20
|
-
- type: textarea
|
|
21
|
-
id: expo-sdk-version
|
|
22
|
-
attributes:
|
|
23
|
-
label: OneSignal Expo SDK version
|
|
24
|
-
description: The version of the OneSignal Expo SDK you have a question for.
|
|
25
|
-
placeholder: 1.0.0
|
|
26
|
-
validations:
|
|
27
|
-
required: true
|
|
28
|
-
- type: dropdown
|
|
29
|
-
id: platform
|
|
30
|
-
attributes:
|
|
31
|
-
label: Platform
|
|
32
|
-
description: Which platform are you having an issue with?
|
|
33
|
-
multiple: true
|
|
34
|
-
options:
|
|
35
|
-
- iOS
|
|
36
|
-
- Android
|
|
37
|
-
- type: textarea
|
|
38
|
-
id: logs
|
|
39
|
-
attributes:
|
|
40
|
-
label: Relevant log output
|
|
41
|
-
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
|
42
|
-
render: Shell
|
|
43
|
-
- type: checkboxes
|
|
44
|
-
id: terms
|
|
45
|
-
attributes:
|
|
46
|
-
label: Code of Conduct
|
|
47
|
-
description: By submitting this issue, you agree to follow our [Code of Conduct](#insert-project-code-of-conduct-here)
|
|
48
|
-
options:
|
|
49
|
-
- label: I agree to follow this project's Code of Conduct
|
|
50
|
-
required: true
|