onesignal-expo-plugin 1.0.0 → 1.0.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.
@@ -0,0 +1,50 @@
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
@@ -0,0 +1,71 @@
1
+ name: 🪳 Bug Report
2
+ description: File a bug report
3
+ title: "[Bug]: "
4
+ labels: ["bug", "triage"]
5
+ # assignees:
6
+ # - assign your sdk team e.g., onesignal/unity
7
+ body:
8
+ - type: markdown
9
+ attributes:
10
+ value: |
11
+ Thanks for taking the time to fill out this bug report!
12
+ - type: textarea
13
+ id: what-happened
14
+ attributes:
15
+ label: What happened?
16
+ description: Provide a thorough description of whats going on.
17
+ placeholder: The latest version of the SDK causes my screen to go blank when I tap on the screen three times.
18
+ validations:
19
+ required: true
20
+ - type: textarea
21
+ id: reproduction-steps
22
+ attributes:
23
+ label: Steps to reproduce?
24
+ description: Provide as much detail as posible to reproduce the issue.
25
+ placeholder: |
26
+ 1. Install vX.Y.Z of dependency
27
+ 2. Launch the app on iOS device
28
+ 3. Tap the screen three times
29
+ 4. Note that the app crashes
30
+ render: Markdown
31
+ validations:
32
+ required: true
33
+ - type: textarea
34
+ id: what-are-expectations
35
+ attributes:
36
+ label: What did you expect to happen?
37
+ description: Also tell us, what did you expect to happen?
38
+ placeholder: I expected the app to continue running no matter how many times I tap the screen.
39
+ validations:
40
+ required: true
41
+ - type: textarea
42
+ id: expo-sdk-version
43
+ attributes:
44
+ label: OneSignal Expo SDK version
45
+ description: The version of the OneSignal Expo SDK used in your app.
46
+ placeholder: 1.0.0
47
+ validations:
48
+ required: true
49
+ - type: dropdown
50
+ id: platform
51
+ attributes:
52
+ label: Platform
53
+ description: Which platform are you having an issue with?
54
+ multiple: true
55
+ options:
56
+ - iOS
57
+ - Android
58
+ - type: textarea
59
+ id: logs
60
+ attributes:
61
+ label: Relevant log output
62
+ description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
63
+ render: Shell
64
+ - type: checkboxes
65
+ id: terms
66
+ attributes:
67
+ label: Code of Conduct
68
+ description: By submitting this issue, you agree to follow our [Code of Conduct](#insert-project-code-of-conduct-here)
69
+ options:
70
+ - label: I agree to follow this project's Code of Conduct
71
+ required: true
@@ -0,0 +1,27 @@
1
+ name: 📣 General feedback
2
+ description: Tell us what's on your mind
3
+ title: "[feedback]: "
4
+ labels: ["triage"]
5
+ # assignees:
6
+ # - assign your sdk team e.g., onesignal/unity
7
+ body:
8
+ - type: markdown
9
+ attributes:
10
+ value: |
11
+ Thanks for sharing your valuable feedback!
12
+ - type: textarea
13
+ id: feedback
14
+ attributes:
15
+ label: What's on your mind?
16
+ description: Feedback regarding this SDK.
17
+ placeholder: Share your feedback...
18
+ validations:
19
+ required: true
20
+ - type: checkboxes
21
+ id: terms
22
+ attributes:
23
+ label: Code of Conduct
24
+ description: By submitting this issue, you agree to follow our [Code of Conduct](#insert-project-code-of-conduct-here)
25
+ options:
26
+ - label: I agree to follow this project's Code of Conduct
27
+ required: true
package/CHANGELOG.md CHANGED
@@ -1,6 +1,35 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## April 2022
5
+ ### `1.0.1` - 04/11/22
6
+
7
+ #### Changes
8
+ - Add more info regarding the `expo prebuild` command to README.
9
+ #### Fixes
10
+ - Upstream EAS workaround for "Missing Push Capability on iOS" issue. Adds `aps-environment` entitlement to NSE template. Although it is **not** required in normal builds, there is an upstream limitation from EAS that is resolved by including the push entitlement in both target entitlement files. As of 4/8/22, EAS builds will randomly pick an entitlement file if there are multiple in a project without differentiating among targets. This is resulting in flaky builds where half the time they work and half the time they don't. This can be seen as a temporary fix. Note it carries no side-effects / repercussions (i.e: the entitlement is superfluous but not critical to remove in the future).
11
+
12
+ ## March 2022
13
+ ### `1.0.0` - 03/28/22
14
+
15
+ #### Fixes
16
+ - Upgrade dependencies (via dependabot)
17
+ #### Changes
18
+ - Add credentials guide and update README
19
+ - Advance to General Availability
20
+
21
+ ## February 2022
22
+ ### `1.0.0-beta11` - 02/18/2022
23
+ #### Added
24
+ - Linting
25
+ - Instead of creating a "WriterManager", we repurpose the ReaderManager class by renaming it to FileManager and adding a synchronized write helper function (synchronous in the sense that it block further execution until complete).
26
+ - iOS constants file
27
+
28
+ #### Fixes
29
+ - Import cleanups
30
+ - Linting errors
31
+ - Write safety issu. NSE updater helper functions were previously writing to the entitlements & plist files asynchronously. We should await on each to ensure we don't have multiple writes to the same file at once (which is unsafe).
32
+
4
33
  ## January 2022
5
34
 
6
35
  ### `1.0.0-beta10` - 01/24/2022
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-blue.svg?cacheSeconds=2592000" />
3
+ <img alt="Version" src="https://img.shields.io/badge/version-1.0.1-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>
@@ -125,11 +125,15 @@ See our [EAS documentation](EAS.md) for help with EAS.
125
125
  ### iOS Credentials: OneSignal + EAS
126
126
  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).
127
127
 
128
- ## Prebuild
129
- Since we are using custom native code (via the OneSignal plugin), we need to generate the native runtime code for the project. 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.
128
+ ## Prebuild (optional)
129
+ 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.
130
130
 
131
131
  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.
132
132
 
133
+ #### Why should I prebuild?
134
+ It may make sense to prebuild locally to inspect config plugin changes and help in debugging issues.
135
+
136
+ #### Run
133
137
  ```sh
134
138
  expo prebuild
135
139
  ```
@@ -139,6 +143,8 @@ expo prebuild
139
143
  expo prebuild --clean
140
144
  ```
141
145
 
146
+ **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.
147
+
142
148
  ## Run
143
149
  The following commands will prebuild *and* run your application. Note that for iOS, push notifications will **not** work in the Simulator.
144
150
  ```sh
@@ -36,7 +36,7 @@ const NseUpdaterManager_1 = __importDefault(require("../support/NseUpdaterManage
36
36
  const OneSignalLog_1 = require("../support/OneSignalLog");
37
37
  const FileManager_1 = require("../support/FileManager");
38
38
  /**
39
- * Add 'app-environment' record with current environment to '<project-name>.entitlements' file
39
+ * Add 'aps-environment' record with current environment to '<project-name>.entitlements' file
40
40
  * @see https://documentation.onesignal.com/docs/react-native-sdk-setup#step-4-install-for-ios-using-cocoapods-for-ios-apps
41
41
  */
42
42
  const withAppEnvironment = (config, onesignalProps) => {
@@ -98,6 +98,7 @@ const withOneSignalNSE = (config, onesignalProps) => {
98
98
  devTeam: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.devTeam,
99
99
  bundleVersion: (_b = props.ios) === null || _b === void 0 ? void 0 : _b.buildNumber,
100
100
  bundleShortVersion: props === null || props === void 0 ? void 0 : props.version,
101
+ mode: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.mode,
101
102
  iPhoneDeploymentTarget: onesignalProps === null || onesignalProps === void 0 ? void 0 : onesignalProps.iPhoneDeploymentTarget
102
103
  };
103
104
  xcodeProjectAddNse(props.modRequest.projectName || "", options, "node_modules/onesignal-expo-plugin/build/support/serviceExtensionFiles/");
@@ -113,7 +114,7 @@ const withOneSignalIos = (config, props) => {
113
114
  };
114
115
  exports.withOneSignalIos = withOneSignalIos;
115
116
  function xcodeProjectAddNse(appName, options, sourceDir) {
116
- const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget } = options;
117
+ const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget, mode } = options;
117
118
  // not awaiting in order to not block main thread
118
119
  (0, updatePodfile_1.updatePodfile)(iosPath).catch(err => { OneSignalLog_1.OneSignalLog.error(err); });
119
120
  const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`;
@@ -138,7 +139,7 @@ function xcodeProjectAddNse(appName, options, sourceDir) {
138
139
  }
139
140
  /* MODIFY COPIED EXTENSION FILES */
140
141
  const nseUpdater = new NseUpdaterManager_1.default(iosPath);
141
- await nseUpdater.updateNSEEntitlements(`group.${bundleIdentifier}.onesignal`);
142
+ await nseUpdater.updateNSEEntitlements(`group.${bundleIdentifier}.onesignal`, mode);
142
143
  await nseUpdater.updateNSEBundleVersion(bundleVersion !== null && bundleVersion !== void 0 ? bundleVersion : iosConstants_1.DEFAULT_BUNDLE_VERSION);
143
144
  await nseUpdater.updateNSEBundleShortVersion(bundleShortVersion !== null && bundleShortVersion !== void 0 ? bundleShortVersion : iosConstants_1.DEFAULT_BUNDLE_SHORT_VERSION);
144
145
  // Create new PBXGroup for the extension
@@ -10,9 +10,10 @@ class NseUpdaterManager {
10
10
  this.nsePath = '';
11
11
  this.nsePath = `${iosPath}/${iosConstants_1.NSE_TARGET_NAME}`;
12
12
  }
13
- async updateNSEEntitlements(groupIdentifier) {
13
+ async updateNSEEntitlements(groupIdentifier, mode) {
14
14
  const entitlementsFilePath = `${this.nsePath}/${entitlementsFileName}`;
15
15
  let entitlementsFile = await FileManager_1.FileManager.readFile(entitlementsFilePath);
16
+ entitlementsFile = entitlementsFile.replace(iosConstants_1.APS_ENVIRONMENT_MODE, mode);
16
17
  entitlementsFile = entitlementsFile.replace(iosConstants_1.GROUP_IDENTIFIER_TEMPLATE_REGEX, groupIdentifier);
17
18
  await FileManager_1.FileManager.writeFile(entitlementsFilePath, entitlementsFile);
18
19
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NSE_TARGET_NAME = exports.DEFAULT_BUNDLE_SHORT_VERSION = exports.DEFAULT_BUNDLE_VERSION = exports.BUNDLE_VERSION_TEMPLATE_REGEX = exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = exports.NSE_PODFILE_REGEX = exports.NSE_PODFILE_SNIPPET = exports.TARGETED_DEVICE_FAMILY = exports.IPHONEOS_DEPLOYMENT_TARGET = void 0;
3
+ exports.NSE_TARGET_NAME = exports.DEFAULT_BUNDLE_SHORT_VERSION = exports.DEFAULT_BUNDLE_VERSION = exports.BUNDLE_VERSION_TEMPLATE_REGEX = exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = exports.APS_ENVIRONMENT_MODE = exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = exports.NSE_PODFILE_REGEX = exports.NSE_PODFILE_SNIPPET = exports.TARGETED_DEVICE_FAMILY = exports.IPHONEOS_DEPLOYMENT_TARGET = void 0;
4
4
  exports.IPHONEOS_DEPLOYMENT_TARGET = "11.0";
5
5
  exports.TARGETED_DEVICE_FAMILY = `"1,2"`;
6
6
  exports.NSE_PODFILE_SNIPPET = `
@@ -9,6 +9,7 @@ target 'OneSignalNotificationServiceExtension' do
9
9
  end`;
10
10
  exports.NSE_PODFILE_REGEX = /target 'OneSignalNotificationServiceExtension'/;
11
11
  exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;
12
+ exports.APS_ENVIRONMENT_MODE = /{{APS_ENVIRONMENT_MODE}}/gm;
12
13
  exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;
13
14
  exports.BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;
14
15
  exports.DEFAULT_BUNDLE_VERSION = '1';
@@ -2,6 +2,8 @@
2
2
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
3
  <plist version="1.0">
4
4
  <dict>
5
+ <key>aps-environment</key>
6
+ <string>{{APS_ENVIRONMENT_MODE}}</string>
5
7
  <key>com.apple.security.application-groups</key>
6
8
  <array>
7
9
  <string>{{GROUP_IDENTIFIER}}</string>
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const withOneSignalIos_1 = require("./onesignal/withOneSignalIos");
4
+ const types_1 = require("./types/types");
4
5
  // Quick testing on any Xcode project
5
6
  // 1. Update values for your project
6
7
  // 2. Run `yarn build` from here
@@ -13,6 +14,7 @@ const withOneSignalIos_1 = require("./onesignal/withOneSignalIos");
13
14
  // even if your .xcodeproj is correct.
14
15
  const options = {
15
16
  iosPath: '.',
17
+ mode: types_1.Mode.Dev,
16
18
  bundleIdentifier: "com.onesignal.XcodeTestProj",
17
19
  devTeam: "99SW8E36CT",
18
20
  iPhoneDeploymentTarget: '12.0'
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Mode = void 0;
4
+ var Mode;
5
+ (function (Mode) {
6
+ Mode["Dev"] = "development";
7
+ Mode["Prod"] = "production";
8
+ })(Mode = exports.Mode || (exports.Mode = {}));
@@ -4,18 +4,10 @@
4
4
  */
5
5
 
6
6
  import { ConfigPlugin } from '@expo/config-plugins';
7
+ import { OneSignalPluginProps } from '../types/types';
7
8
  import { withOneSignalAndroid } from './withOneSignalAndroid';
8
9
  import { withOneSignalIos } from './withOneSignalIos';
9
10
 
10
- export type OneSignalPluginProps = {
11
- /**
12
- * (iOS only) Environment name and bundle identifier
13
- */
14
- mode: string;
15
- devTeam: string;
16
- iPhoneDeploymentTarget: string;
17
- };
18
-
19
11
  const withOneSignal: ConfigPlugin<OneSignalPluginProps> = (config, props) => {
20
12
  config = withOneSignalIos(config, props);
21
13
  config = withOneSignalAndroid(config, props);
@@ -6,7 +6,7 @@
6
6
  import { ConfigPlugin, withAppBuildGradle } from '@expo/config-plugins';
7
7
  import { ONESIGNAL_GRADLE } from '../support/androidConstants';
8
8
  import { OneSignalLog } from '../support/OneSignalLog';
9
- import { OneSignalPluginProps } from './withOneSignal';
9
+ import { OneSignalPluginProps } from '../types/types';
10
10
 
11
11
  const withGradleBuildConfig: ConfigPlugin<OneSignalPluginProps> = (config) => {
12
12
  return withAppBuildGradle(config, (newConfig) => {
@@ -9,7 +9,6 @@ import {
9
9
  withInfoPlist,
10
10
  withXcodeProject,
11
11
  } from "@expo/config-plugins";
12
- import { OneSignalPluginProps } from "./withOneSignal";
13
12
  import * as fs from 'fs';
14
13
  import xcode from 'xcode';
15
14
  import {
@@ -23,19 +22,10 @@ import { updatePodfile } from "../support/updatePodfile";
23
22
  import NseUpdaterManager from "../support/NseUpdaterManager";
24
23
  import { OneSignalLog } from "../support/OneSignalLog";
25
24
  import { FileManager } from "../support/FileManager";
26
-
27
- /* I N T E R F A C E S */
28
- interface PluginOptions {
29
- iosPath: string,
30
- devTeam?: string,
31
- bundleVersion?: string,
32
- bundleShortVersion?: string,
33
- bundleIdentifier?: string,
34
- iPhoneDeploymentTarget?: string
35
- }
25
+ import { OneSignalPluginProps, PluginOptions } from "../types/types";
36
26
 
37
27
  /**
38
- * Add 'app-environment' record with current environment to '<project-name>.entitlements' file
28
+ * Add 'aps-environment' record with current environment to '<project-name>.entitlements' file
39
29
  * @see https://documentation.onesignal.com/docs/react-native-sdk-setup#step-4-install-for-ios-using-cocoapods-for-ios-apps
40
30
  */
41
31
  const withAppEnvironment: ConfigPlugin<OneSignalPluginProps> = (
@@ -108,6 +98,7 @@ const withOneSignalNSE: ConfigPlugin<OneSignalPluginProps> = (config, onesignalP
108
98
  devTeam: onesignalProps?.devTeam,
109
99
  bundleVersion: props.ios?.buildNumber,
110
100
  bundleShortVersion: props?.version,
101
+ mode: onesignalProps?.mode,
111
102
  iPhoneDeploymentTarget: onesignalProps?.iPhoneDeploymentTarget
112
103
  };
113
104
 
@@ -137,7 +128,7 @@ export function xcodeProjectAddNse(
137
128
  options: PluginOptions,
138
129
  sourceDir: string
139
130
  ): void {
140
- const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget } = options;
131
+ const { iosPath, devTeam, bundleIdentifier, bundleVersion, bundleShortVersion, iPhoneDeploymentTarget, mode } = options;
141
132
 
142
133
  // not awaiting in order to not block main thread
143
134
  updatePodfile(iosPath).catch(err => { OneSignalLog.error(err) });
@@ -170,7 +161,7 @@ export function xcodeProjectAddNse(
170
161
 
171
162
  /* MODIFY COPIED EXTENSION FILES */
172
163
  const nseUpdater = new NseUpdaterManager(iosPath);
173
- await nseUpdater.updateNSEEntitlements(`group.${bundleIdentifier}.onesignal`)
164
+ await nseUpdater.updateNSEEntitlements(`group.${bundleIdentifier}.onesignal`, mode)
174
165
  await nseUpdater.updateNSEBundleVersion(bundleVersion ?? DEFAULT_BUNDLE_VERSION);
175
166
  await nseUpdater.updateNSEBundleShortVersion(bundleShortVersion ?? DEFAULT_BUNDLE_SHORT_VERSION);
176
167
 
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.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": {
@@ -1,5 +1,7 @@
1
+ import { Mode } from '../types/types';
1
2
  import { FileManager } from './FileManager';
2
3
  import {
4
+ APS_ENVIRONMENT_MODE,
3
5
  BUNDLE_SHORT_VERSION_TEMPLATE_REGEX,
4
6
  BUNDLE_VERSION_TEMPLATE_REGEX,
5
7
  GROUP_IDENTIFIER_TEMPLATE_REGEX,
@@ -16,9 +18,11 @@ export default class NseUpdaterManager {
16
18
  this.nsePath = `${iosPath}/${NSE_TARGET_NAME}`;
17
19
  }
18
20
 
19
- async updateNSEEntitlements(groupIdentifier: string): Promise<void> {
21
+ async updateNSEEntitlements(groupIdentifier: string, mode: Mode): Promise<void> {
20
22
  const entitlementsFilePath = `${this.nsePath}/${entitlementsFileName}`;
21
23
  let entitlementsFile = await FileManager.readFile(entitlementsFilePath);
24
+
25
+ entitlementsFile = entitlementsFile.replace(APS_ENVIRONMENT_MODE, mode);
22
26
  entitlementsFile = entitlementsFile.replace(GROUP_IDENTIFIER_TEMPLATE_REGEX, groupIdentifier);
23
27
  await FileManager.writeFile(entitlementsFilePath, entitlementsFile);
24
28
  }
@@ -9,6 +9,7 @@ end`;
9
9
  export const NSE_PODFILE_REGEX = /target 'OneSignalNotificationServiceExtension'/;
10
10
 
11
11
  export const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;
12
+ export const APS_ENVIRONMENT_MODE = /{{APS_ENVIRONMENT_MODE}}/gm;
12
13
  export const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;
13
14
  export const BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;
14
15
 
@@ -2,6 +2,8 @@
2
2
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
3
  <plist version="1.0">
4
4
  <dict>
5
+ <key>aps-environment</key>
6
+ <string>{{APS_ENVIRONMENT_MODE}}</string>
5
7
  <key>com.apple.security.application-groups</key>
6
8
  <array>
7
9
  <string>{{GROUP_IDENTIFIER}}</string>
package/testRuniOS.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { xcodeProjectAddNse } from "./onesignal/withOneSignalIos";
2
+ import { Mode } from "./types/types";
2
3
 
3
4
  // Quick testing on any Xcode project
4
5
 
@@ -14,6 +15,7 @@ import { xcodeProjectAddNse } from "./onesignal/withOneSignalIos";
14
15
 
15
16
  const options = {
16
17
  iosPath: '.',
18
+ mode: Mode.Dev,
17
19
  bundleIdentifier: "com.onesignal.XcodeTestProj",
18
20
  devTeam: "99SW8E36CT",
19
21
  iPhoneDeploymentTarget: '12.0'
package/types/types.ts ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * OneSignalPluginProps refer to the properties set by the user in their app config file (e.g: app.json)
3
+ */
4
+ export type OneSignalPluginProps = {
5
+ /**
6
+ * (iOS only) Environment name and bundle identifier
7
+ */
8
+ mode: Mode;
9
+ devTeam: string;
10
+ iPhoneDeploymentTarget: string;
11
+ };
12
+
13
+ /**
14
+ * Not to be confused with OneSignalPluginProps, PluginOptions are the *internal* properties used by the config plugin
15
+ * These include a combination of user-defined properties (from OneSignalPluginProps) and other data to pass between functions
16
+ */
17
+ export type PluginOptions = {
18
+ iosPath: string,
19
+ mode: Mode,
20
+ devTeam?: string,
21
+ bundleVersion?: string,
22
+ bundleShortVersion?: string,
23
+ bundleIdentifier?: string,
24
+ iPhoneDeploymentTarget?: string
25
+ }
26
+
27
+ export enum Mode {
28
+ Dev = "development",
29
+ Prod = "production"
30
+ }