onesignal-expo-plugin 2.0.3 → 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.
Files changed (41) hide show
  1. package/README.md +44 -36
  2. package/build/onesignal/withOneSignalAndroid.js +6 -12
  3. package/build/onesignal/withOneSignalIos.js +35 -25
  4. package/build/support/FileManager.js +22 -8
  5. package/build/support/NseUpdaterManager.js +1 -1
  6. package/build/support/eas/getEasManagedCredentialsConfigExtra.js +8 -9
  7. package/build/support/helpers.js +1 -2
  8. package/build/support/updatePodfile.js +1 -2
  9. package/build/types/types.js +1 -1
  10. package/package.json +12 -11
  11. package/.eslintignore +0 -6
  12. package/.eslintrc.js +0 -18
  13. package/.github/ISSUE_TEMPLATE/ask-question.yml +0 -50
  14. package/.github/ISSUE_TEMPLATE/bug-report.yml +0 -71
  15. package/.github/ISSUE_TEMPLATE/general-feedback.yml +0 -27
  16. package/.github/os_probot_metadata.js +0 -58
  17. package/.github/pull_request_template.md +0 -46
  18. package/.github/release-drafter.yml +0 -27
  19. package/.github/set_response_times.js +0 -47
  20. package/.github/workflows/Zapier.yml +0 -34
  21. package/.github/workflows/release-drafter.yml +0 -42
  22. package/.github/workflows/set_response_time.yml +0 -32
  23. package/CHANGELOG.md +0 -83
  24. package/EAS.md +0 -21
  25. package/IOS_CREDENTIALS_EAS.md +0 -170
  26. package/onesignal/withOneSignal.ts +0 -28
  27. package/onesignal/withOneSignalAndroid.ts +0 -147
  28. package/onesignal/withOneSignalIos.ts +0 -235
  29. package/support/FileManager.ts +0 -42
  30. package/support/NseUpdaterManager.ts +0 -40
  31. package/support/OneSignalLog.ts +0 -9
  32. package/support/eas/getEasManagedCredentialsConfigExtra.ts +0 -33
  33. package/support/helpers.ts +0 -41
  34. package/support/iosConstants.ts +0 -25
  35. package/support/serviceExtensionFiles/NotificationService.h +0 -8
  36. package/support/serviceExtensionFiles/NotificationService.m +0 -29
  37. package/support/serviceExtensionFiles/OneSignalNotificationServiceExtension-Info.plist +0 -31
  38. package/support/serviceExtensionFiles/OneSignalNotificationServiceExtension.entitlements +0 -10
  39. package/support/updatePodfile.ts +0 -19
  40. package/tsconfig.json +0 -16
  41. package/types/types.ts +0 -58
@@ -1,71 +0,0 @@
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
@@ -1,27 +0,0 @@
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
@@ -1,58 +0,0 @@
1
- /**
2
- * Based on probot-metadata - https://github.com/probot/metadata
3
- */
4
- const regex = /\n\n<!-- probot = (.*) -->/
5
-
6
- const { Octokit } = require("@octokit/action")
7
-
8
- const octokit = new Octokit()
9
-
10
- module.exports = (context, issue = null) => {
11
- console.log(context)
12
- const prefix = "onesignal-probot"
13
-
14
- if (!issue) issue = context.payload.issue
15
-
16
- return {
17
- async get (key = null) {
18
- let body = issue.body
19
-
20
- if (!body) {
21
- body = (await octokit.issues.get(issue)).data.body || ''
22
- }
23
-
24
- const match = body.match(regex)
25
-
26
- if (match) {
27
- const data = JSON.parse(match[1])[prefix]
28
- return key ? data && data[key] : data
29
- }
30
- },
31
-
32
- async set (key, value) {
33
- let body = issue.body
34
- let data = {}
35
-
36
- if (!body) body = (await octokit.issues.get(issue)).data.body || ''
37
-
38
- body = body.replace(regex, (_, json) => {
39
- data = JSON.parse(json)
40
- return ''
41
- })
42
-
43
- if (!data[prefix]) data[prefix] = {}
44
-
45
- if (typeof key === 'object') {
46
- Object.assign(data[prefix], key)
47
- } else {
48
- data[prefix][key] = value
49
- }
50
-
51
- body = `${body}\n\n<!-- probot = ${JSON.stringify(data)} -->`
52
-
53
- const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/")
54
- const issue_number = context.payload.issue.number
55
- return octokit.issues.update({ owner, repo, issue_number, body })
56
- }
57
- }
58
- }
@@ -1,46 +0,0 @@
1
- <!-- START -->
2
- # READ AND DELETE THIS SECTION BEFORE SUBMITTING PR
3
- * **Fill out each _REQUIRED_ section**
4
- * **Fill out _OPTIONAL_ sections, remove section if it doesn't apply to your PR**
5
- * **Read and fill out each of the checklists below**
6
- * **Remove this section after reading**
7
- <!-- END -->
8
-
9
- # Description
10
- ## One Line Summary
11
- **REQUIRED** - Very short description that summaries the changes in this PR.
12
-
13
- ## Details
14
-
15
- ### Motivation
16
- **REQUIRED -** Why is this code change being made? Or what is the goal of this PR? Examples: Fixes a specific bug, provides additional logging to debug future issues, feature to allow X.
17
-
18
- ### Scope
19
- **RECOMMEND - OPTIONAL -** What is intended to be effected. What is known not to change. Example: Notifications are grouped when parameter X is set, not enabled by default.
20
-
21
- ### OPTIONAL - Other
22
- **OPTIONAL -** Feel free to add any other sections or sub-sections that can explain your PR better.
23
-
24
- # Testing
25
-
26
- ## Manual testing
27
- **REQUIRED -** Explain what scenarios were tested and the environment.
28
-
29
-
30
- # Checklist
31
- ## Overview
32
- - [ ] I have filled out all **REQUIRED** sections above
33
- - [ ] PR does one thing
34
- - If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
35
- - [ ] Any Public API changes are explained in the PR details and conform to existing APIs
36
-
37
- ## Testing
38
- - [ ] I have personally tested this on my device, or explained why that is not possible
39
- - [ ] I have tested this on the latest version of the plugin
40
- - [ ] I have tested this on both Android and iOS, or explained why that is not possible
41
-
42
- ## Final pass
43
- - [ ] Code is as readable as possible.
44
- - Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
45
- - [ ] I have reviewed this PR myself, ensuring it meets each checklist item
46
- - WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.
@@ -1,27 +0,0 @@
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
@@ -1,47 +0,0 @@
1
- function calcResponseTimeForIssueCreatedAt(createdAt) {
2
- const issueOpenedDate = new Date(createdAt);
3
- const issueTriagedDate = new Date();
4
- const businessDaysResponseTime = calcBusinessDaysBetweenDates(issueOpenedDate, issueTriagedDate);
5
- return businessDaysResponseTime;
6
- }
7
-
8
- function calcBusinessDaysBetweenDates(openedDate, triagedDate) {
9
- let differenceInWeeks, responseTime;
10
- if (triagedDate < openedDate)
11
- return -1; // error code if dates transposed
12
- let openedDay = openedDate.getDay(); // day of week
13
- let triagedDay = triagedDate.getDay();
14
- openedDay = (openedDay == 0) ? 7 : openedDay; // change Sunday from 0 to 7
15
- triagedDay = (triagedDay == 0) ? 7 : triagedDay;
16
- openedDay = (openedDay > 5) ? 5 : openedDay; // only count weekdays
17
- triagedDay = (triagedDay > 5) ? 5 : triagedDay;
18
- // calculate differnece in weeks (1000mS * 60sec * 60min * 24hrs * 7 days = 604800000)
19
- differenceInWeeks = Math.floor((triagedDate.getTime() - openedDate.getTime()) / 604800000);
20
- if (openedDay < triagedDay) { //Equal to makes it reduce 5 days
21
- responseTime = (differenceInWeeks * 5) + (triagedDay - openedDay);
22
- }
23
- else if (openedDay == triagedDay) {
24
- responseTime = differenceInWeeks * 5;
25
- }
26
- else {
27
- responseTime = ((differenceInWeeks + 1) * 5) - (openedDay - triagedDay);
28
- }
29
- return (responseTime);
30
- }
31
-
32
- module.exports = async(context, osmetadata) => {
33
- const foundResponseTime = await osmetadata(context).get('response_time_in_business_days');
34
- if (foundResponseTime) {
35
- const foundString = "already found response time in business days: " + foundResponseTime
36
- console.log(foundString);
37
- return foundString;
38
- }
39
- if (context.payload.comment && context.payload.comment.author_association != "MEMBER" && context.payload.comment.author_association != "OWNER" && context.payload.comment.author_association != "CONTRIBUTOR") {
40
- return;
41
- }
42
- const businessDaysResponseTime = calcResponseTimeForIssueCreatedAt(context.payload.issue.created_at);
43
- console.log("response time in business days: " + businessDaysResponseTime);
44
- const result = osmetadata(context, context.payload.issue).set('response_time_in_business_days', businessDaysResponseTime)
45
- console.log("osmetadata update result: " + result);
46
- return "set response time in business days: " + businessDaysResponseTime;
47
- }
@@ -1,34 +0,0 @@
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
- permissions:
12
- issues: read
13
-
14
- # A workflow run is made up of one or more jobs that can run sequentially or in parallel
15
- jobs:
16
- # This workflow contains a single job called "build"
17
- build:
18
- # The type of runner that the job will run on
19
- runs-on: ubuntu-latest
20
-
21
- # Steps represent a sequence of tasks that will be executed as part of the job
22
- steps:
23
- # Runs a set of commands using the runners shell
24
- - name: Call Zapier web hook to close Asana task
25
- if: ${{ !github.event.issue.pull_request }}
26
- env:
27
- ISSUE_TITLE: ${{ github.event.issue.title }}
28
- run: |
29
- curl --location --request POST 'https://hooks.zapier.com/hooks/catch/12728683/b7009qc/' \
30
- --header 'Content-Type: application/json' \
31
- --header 'Accept: application/json' \
32
- --data-raw '{
33
- "task_name" : "$ISSUE_TITLE"
34
- }'
@@ -1,42 +0,0 @@
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 }}
@@ -1,32 +0,0 @@
1
- name: Set Response Time
2
- on:
3
- issue_comment:
4
- types:
5
- - created
6
- issues:
7
- types:
8
- - closed
9
- jobs:
10
- calculate:
11
- name: set reponse time for the issue
12
- if: github.event.issue.pull_request == null
13
- runs-on: ubuntu-latest
14
- permissions:
15
- issues: write
16
- steps:
17
- - uses: actions/checkout@v3
18
- with:
19
- token: ${{ secrets.GITHUB_TOKEN }}
20
- - run: npm install @octokit/action@6.0.6
21
- - uses: actions/github-script@v6
22
- id: set-time
23
- with:
24
- result-encoding: string
25
- script: |
26
- const os_probot_metadata = require('./.github/os_probot_metadata.js')
27
- const set_response_time = require('./.github/set_response_times.js')
28
- return await set_response_time(context, os_probot_metadata)
29
- env:
30
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31
- - name: Get result
32
- run: echo "${{steps.set-time.outputs.result}}" >> $GITHUB_STEP_SUMMARY
package/CHANGELOG.md DELETED
@@ -1,83 +0,0 @@
1
- # Changelog
2
- All notable changes to this project will be documented in this file.
3
-
4
- ## April 2023
5
- ### `1.3.2` - 04/18/23
6
- #### Changes
7
- - Update iOS generation to write xcode project via expo mod rather than directly to file system.
8
- - Bump qs from 6.5.2 to 6.5.3
9
- - Bump decode-uri-component from 0.2.0 to 0.2.2
10
- - Bump @xmldom/xmldom from 0.7.5 to 0.7.10
11
- - Bump multiple dependency versions in OneSignal Example App (ua-parser-js, decode-uri-component, @sideway/formula, @xmldom/xmldom)
12
-
13
- ## March 2023
14
- ### `1.3.1` - 03/03/23
15
- #### Changes
16
- - Update monorepo logic to rely on the more reliable `require.resolve` to find the `onesignal-expo-plugin` package.
17
-
18
- ## November 2022
19
- ### `1.3.0` - 11/30/22
20
- #### Changes
21
- - Add `iosNSEFilePath` configuration options to the plugin, which allows an app to specify a custom iOS Notification Service Extension.
22
-
23
- ## October 2022
24
- ### `1.2.0` - 10/25/22
25
- #### Changes
26
- - Add `smallIcons` and `largeIcons` configuration options to the plugin, which allows an app to specify large and small notification icons to package within the Android build.
27
- - Bump jpeg-js from 0.4.3 to 0.4.4
28
- - Bump simple-plist from 1.3.0 to 1.3.1
29
-
30
- ### `1.1.2` - 10/04/22
31
- #### Fixes
32
- - Specify `use_frameworks` on `OneSignalNotificationServiceExtension` target in iOS Podfile when applicable (i.e. the app target also specifies `use_frameworks`).
33
-
34
- ## September 2022
35
- ### `1.1.1` - 09/06/22
36
- #### Fixes
37
- - Fix issue where EAS release builds were no longer successfully building due to log statement
38
-
39
- ### `1.1.0` - 09/01/22
40
- #### Changes
41
- - No longer inject the OneSignal Gradle plugin on Android builds
42
- #### Fixes
43
- - Fix issue where plugin does not support monorepos
44
-
45
- ## April 2022
46
- ### `1.0.1` - 04/11/22
47
-
48
- #### Changes
49
- - Add more info regarding the `expo prebuild` command to README.
50
- #### Fixes
51
- - 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).
52
-
53
- ## March 2022
54
- ### `1.0.0` - 03/28/22
55
-
56
- #### Fixes
57
- - Upgrade dependencies (via dependabot)
58
- #### Changes
59
- - Add credentials guide and update README
60
- - Advance to General Availability
61
-
62
- ## February 2022
63
- ### `1.0.0-beta11` - 02/18/2022
64
- #### Added
65
- - Linting
66
- - 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).
67
- - iOS constants file
68
-
69
- #### Fixes
70
- - Import cleanups
71
- - Linting errors
72
- - 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).
73
-
74
- ## January 2022
75
-
76
- ### `1.0.0-beta10` - 01/24/2022
77
- #### Added
78
- - ability to configure version numbers used in the NSE target's plist file.
79
- - `OneSignalLog` class for better console logging.
80
- - this changelog file.
81
-
82
- #### Fixed
83
- - re-running `expo prebuild` will no longer result in duplicate entitlements and dependencies added to native files.
package/EAS.md DELETED
@@ -1,21 +0,0 @@
1
- # Expo Application Services
2
- EAS is Expo's cloud-build service.
3
-
4
- ## [EAS Homepage](https://expo.dev/eas)
5
-
6
- ## EAS + OneSignal Setup
7
- To get OneSignal push notifications working in an EAS-built app, see our guide on how to configure your [iOS credentials](IOS_CREDENTIALS_EAS.md).
8
-
9
- ## How to run an iOS EAS-built app
10
- ### Run in a production environment
11
- For production builds, your generated ipa file should to be distributed to the App Store or Testflight.
12
-
13
-
14
- ### Run in custom development client
15
- For development/internal distribution builds, you will need to install a [development client](https://docs.expo.dev/development/getting-started/) on your iOS device.
16
-
17
- 1. Scan the QR code shown in the terminal after EAS build success and install the development client application to your device.
18
- 2. In the terminal, run `expo start --dev-client` to be able to serve the application to the client.
19
- 3. Scan the generated QR code to open the dev client and fetch the app bundle from the running Expo process.
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 metro bundler working. As soon as the bundle is complete, your working app should open!
@@ -1,170 +0,0 @@
1
- # iOS Credentials Guide: OneSignal + EAS
2
- ## Overview
3
- To distribute your iOS application, you must set up all the credentials required by Apple. The 3 primary iOS credentials are:
4
- * Distribution certificate
5
- * Provisioning profiles
6
- * Push notification certificate
7
-
8
- If you are using EAS, you may be letting Expo handle all your credentials. This is fine for your distribution and provisioning credentials. However, the push notification certificate *must* be set up separately since you are using OneSignal.
9
-
10
- ### Push Notification Certificate
11
- To set up OneSignal on iOS, you will need a [push notification certificate](https://documentation.onesignal.com/docs/generate-an-ios-push-certificate). The push certificate is used to send notifications to devices and has nothing to do with the build process. After you have uploaded the certificate to OneSignal, it should just work.
12
-
13
- ### Capabilities
14
- As of eas-cli `v0.52.0`, the previous capabilities issues should now be resolved. See the [release notes](https://github.com/expo/eas-cli/releases/tag/v0.52.0) for details.
15
-
16
- You can still view the old instructions by clicking below.
17
-
18
- <details>
19
- <summary>Click to expand</summary>
20
-
21
- ---
22
- To receive notifications, you must add the `aps-environment` capability (Push Notifications) to your app at build time. The OneSignal plugin tries to facilitate this as much as possible but there could be complications if you added other capabilities/entitlements or another config plugin did. This is because EAS doesn't currently respect entitlement files on a per-target basis. If there are more than one entitlements files, it simply picks one and applies it to both targets.
23
-
24
- Due to this, there are two setup paths:
25
- 1. A **simple setup** is one in which the only [capability](https://docs.expo.dev/build-reference/ios-capabilities/) on your main target is "Push Notifications."
26
- 2. A more **complex setup** is one in which you have other capabilities.
27
-
28
- This also affects how you should set up your credentials. Use the following table to know whether to proceed with local or managed credentials:
29
- | Push Notification capability only | |
30
- |-----------------------------------|-----------------------------------------------------------------------|
31
- | Local credentials | Works but unnecessary to go through extra effort to use local signing |
32
- | Managed credentials | Works (simple setup) |
33
-
34
- | Multiple capabilities | |
35
- |-----------------------|----------------------------------|
36
- | Local credentials | Works but requires complex setup |
37
- | Managed credentials | Works unreliably |
38
-
39
- If you are unsure, run `expo prebuild` and look at the native entitlements file of your main target (in `ios` directory). Other config plugins may be adding capabilities here. Or check the full [capabilities](https://docs.expo.dev/build-reference/ios-capabilities/#supported-capabilities) list supported by Expo.
40
-
41
-
42
- #### Simple setup explanation
43
- Since there is only one capability (Push Notifications) required by your app, everything should just work. OneSignal will automatically add the capability to your app along with the necessary App Groups and EAS should sync them with your Apple Developer account. You can choose to use managed signing on EAS without a problem. This works because OneSignal will add the capability to both targets' entitlements files.
44
-
45
- #### Complex setup explanation
46
- Having additional capabilities on your app will result in a more complex setup, including having to use local credentials. The following is an explanation of why. It is not imperative to understand but we have included it for context.
47
-
48
- The OneSignal plugin will create an additional target: `OneSignalNotificationServiceExtension`. This target is the iOS service extension that adds support for Confirmed Deliveries, badges, media attachments, action buttons, and influenced opens (Firebase Analytics). Learn more [here](https://documentation.onesignal.com/docs/service-extensions). The plugin will automatically add app groups to both targets' entitlements files which are required if you want to make use of these features. They allow your app to execute code when a notification is received, even if your app is not active.
49
-
50
- Each target has an entitlement file. If there are multiple entitlements files per project, EAS will randomly pick one and apply it to both targets. To mitigate this, we have added the push capability entilement to both files (even though it's really only necessary in the main target). This can still pose a problem if it picks the NSE's entitlements file since it *could* break any other capabilities in your project, given that file will not have capabilities added to your main target by yourself or other plugins.
51
-
52
- The following section details how to mitigate these issues and not break your other capabilities.
53
-
54
- ## Complex Setup
55
-
56
- ### 1. Credentials setup
57
- To build successfully, you will need to create and use local credentials (one for production and development). Add `"credentialsSource": "local"` to your `eas.json` file.
58
-
59
- **Example:**
60
- ```json
61
- {
62
- "build": {
63
- "release": {
64
- "android": {
65
- "gradleCommand": ":app:bundleRelease"
66
- },
67
- "ios": {
68
- "credentialsSource": "local",
69
- "buildConfiguration": "Release"
70
- }
71
- },
72
- "development": {
73
- "developmentClient": true,
74
- "distribution": "internal",
75
- "credentialsSource": "local"
76
- }
77
- }
78
- }
79
- ```
80
-
81
- ### 2. Identifiers
82
- In your [Apple developer console](https://developer.apple.com) create two identifiers with the following format:
83
- - `<com.example.app>` <-- you likely already have this one
84
- - `<com.example.app>.OneSignalNotificationServiceExtension`
85
-
86
- #### When modifying your existing main app identifier:
87
- - add the App Groups capability like so: `group.<identifier>.onesignal`
88
- - keep / add the "Push Notifications" capability
89
-
90
- #### When creating a new identifier for `OneSignalNotificationServiceExtension`:
91
- - select AppId from the list of identifier types
92
- - select App when choosing between App and App Clip
93
- - add the App Groups capability like so: `group.<identifier>.onesignal`
94
- - do not add the "Push Notifications" capability
95
-
96
- #### Note on App Groups at Build Time:
97
- Make sure to build with both identifiers containing the AppGroup simultaneously. To troubleshoot, remove them both and then rebuild with both identifiers' AppGroup capabilities enabled.
98
-
99
- ### 3. Provisioning
100
- Create AdHoc (local development) and AppStore (production) provisioning profiles with both identifiers (four provisioning profiles total). Both provisioning profiles should use the same distribution certificate that is used by your app. Download the profiles.
101
-
102
- ### 4. Add the profiles to your `credentials.json` file:
103
- Use the same distribution certificate for the `OneSignalNotificationServiceExtension` as is used for your app (no need to create a new cert).
104
-
105
- We recommend creating a `certs` directory in your project with subdirectories for each build type (e.g: `certs/adhoc` & `certs/appstore`). Doing so, you can more easily switch which provisioning profiles get used at build time.
106
-
107
- **Directory structure:**
108
- ```
109
- /certs
110
- - /adhoc
111
- - /appstore
112
- ```
113
-
114
- **Example `credentials.json`:**
115
- ```json
116
- {
117
- "ios": {
118
- "<PROJECT>": {
119
- "distributionCertificate": {
120
- "path": "certs/ios_distribution_certificate.p12",
121
- "password": "***"
122
- },
123
- "provisioningProfilePath": "certs/adhoc/***mobileappprofile.mobileprovision"
124
- },
125
- "OneSignalNotificationServiceExtension": {
126
- "distributionCertificate": {
127
- "path": "certs/ios_distribution_certificate.p12",
128
- "password": "***"
129
- },
130
- "provisioningProfilePath": "certs/adhoc/***onesignalprofile.mobileprovision"
131
- }
132
- }
133
- }
134
- ```
135
-
136
- **Note:** your push certificate (p12) file should not appear anywhere in the `credentials.json` file.
137
-
138
- ## Build (complex setup continued)
139
-
140
- **IMPORTANT**: run the `eas build` command with `EXPO_NO_CAPABILITY_SYNC` if you want to prevent EAS from syncing capabilities (e.g: overwriting the steps you took in the complex setup).
141
-
142
- ### Release
143
- If you are ready for a production build, you should use the AppStore provisioning profiles you created. Make sure your `credentials.json` file is using the correct profiles.
144
-
145
- ### Development
146
- The development build will use the AdHoc provisioning profiles you created. Make sure your `credentials.json` file is using the correct profiles.
147
-
148
- ---
149
- </details>
150
-
151
- ### Expo development client
152
- If you haven't already, add the expo development client to your project:
153
-
154
- ```sh
155
- expo install expo-dev-client
156
- ```
157
-
158
- Make sure `"developmentClient": true,` is set in your `eas.json` development build profile.
159
-
160
- ### Run the EAS build command
161
- ```sh
162
- eas build --profile <build profile> --platform ios
163
- ```
164
- where `<build profile>` refers to the build profile in your `eas.json` file (e.g: "development" vs "release").
165
-
166
- ### Build success
167
- At this point, your build should succeed. You can check its progress by opening the build link in the terminal.
168
-
169
- ## How to run on your device
170
- See our [EAS guide](EAS.md) for instructions.