customerio-expo-plugin 1.0.0-beta.1 → 1.0.0-beta.10
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 +5 -166
- package/lib/commonjs/android/withAndroidManifestUpdates.js +37 -0
- package/lib/commonjs/android/withAndroidManifestUpdates.js.map +1 -0
- package/lib/commonjs/android/withAppGoogleServices.js.map +1 -1
- package/lib/commonjs/android/withCIOAndroid.js +4 -0
- package/lib/commonjs/android/withCIOAndroid.js.map +1 -1
- package/lib/commonjs/android/withGistMavenRepository.js.map +1 -1
- package/lib/commonjs/android/withGoogleServicesJSON.js.map +1 -1
- package/lib/commonjs/android/withProjectGoogleServices.js.map +1 -1
- package/lib/commonjs/helpers/constants/android.js.map +1 -1
- package/lib/commonjs/helpers/constants/ios.js +27 -4
- package/lib/commonjs/helpers/constants/ios.js.map +1 -1
- package/lib/commonjs/helpers/native-files/ios/PushService.swift +1 -13
- package/lib/commonjs/helpers/utils/codeInjection.js.map +1 -1
- package/lib/commonjs/helpers/utils/fileManagement.js.map +1 -1
- package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ios/withAppDelegateModifications.js +8 -4
- package/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -1
- package/lib/commonjs/ios/withCIOIos.js.map +1 -1
- package/lib/commonjs/ios/withNotificationsXcodeProject.js +48 -27
- package/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -1
- package/lib/commonjs/ios/withXcodeProject.js.map +1 -1
- package/lib/commonjs/postInstall.js.map +1 -1
- package/lib/commonjs/postInstallHelper.js.map +1 -1
- package/lib/commonjs/types/cio-types.js.map +1 -1
- package/lib/module/android/withAndroidManifestUpdates.js +30 -0
- package/lib/module/android/withAndroidManifestUpdates.js.map +1 -0
- package/lib/module/android/withAppGoogleServices.js.map +1 -1
- package/lib/module/android/withCIOAndroid.js +4 -0
- package/lib/module/android/withCIOAndroid.js.map +1 -1
- package/lib/module/android/withGistMavenRepository.js.map +1 -1
- package/lib/module/android/withGoogleServicesJSON.js.map +1 -1
- package/lib/module/android/withProjectGoogleServices.js.map +1 -1
- package/lib/module/helpers/constants/ios.js +25 -3
- package/lib/module/helpers/constants/ios.js.map +1 -1
- package/lib/module/helpers/native-files/ios/PushService.swift +1 -13
- package/lib/module/helpers/utils/codeInjection.js.map +1 -1
- package/lib/module/helpers/utils/fileManagement.js.map +1 -1
- package/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/ios/withAppDelegateModifications.js +8 -4
- package/lib/module/ios/withAppDelegateModifications.js.map +1 -1
- package/lib/module/ios/withCIOIos.js.map +1 -1
- package/lib/module/ios/withNotificationsXcodeProject.js +49 -27
- package/lib/module/ios/withNotificationsXcodeProject.js.map +1 -1
- package/lib/module/ios/withXcodeProject.js.map +1 -1
- package/lib/module/postInstall.js.map +1 -1
- package/lib/module/postInstallHelper.js.map +1 -1
- package/lib/module/types/cio-types.js.map +1 -1
- package/lib/typescript/android/withAndroidManifestUpdates.d.ts +3 -0
- package/lib/typescript/helpers/constants/ios.d.ts +5 -4
- package/lib/typescript/ios/withAppDelegateModifications.d.ts +2 -1
- package/lib/typescript/types/cio-types.d.ts +2 -0
- package/package.json +5 -2
- package/src/android/withAndroidManifestUpdates.ts +49 -0
- package/src/android/withCIOAndroid.ts +4 -0
- package/src/helpers/constants/ios.ts +31 -3
- package/src/helpers/native-files/ios/PushService.swift +1 -13
- package/src/ios/withAppDelegateModifications.ts +14 -6
- package/src/ios/withNotificationsXcodeProject.ts +76 -28
- package/src/types/cio-types.ts +2 -0
package/README.md
CHANGED
|
@@ -5,180 +5,19 @@
|
|
|
5
5
|
<p align="center">Power automated communication that people like to receive.</p>
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
|
-

|
|
9
|
-

|
|
10
8
|
[](code_of_conduct.md)
|
|
11
|
-
[](https://codecov.io/gh/customerio/customerio-expo-plugin)
|
|
12
9
|
|
|
13
10
|
# Customer.io Expo Plugin
|
|
14
11
|
|
|
15
12
|
This is the official Customer.io Expo plugin, supporting mobile apps.
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
The Expo plugin takes advantage of our [React Native SDK](https://github.com/customerio/customerio-reactnative), and requires very little setup. It extends the Expo config to let you customize the pre-build phase of managed workflow builds, which means you don't need to eject to a bare workflow.
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
After you add the plugin to your project, you'll need to install our React Native SDK and run pre-build. The plugin automatically generates and configures the necessary native code files required to make our React Native SDK to work on your project.
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
# Getting started
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# Install and configure the plugin
|
|
26
|
-
|
|
27
|
-
1. Run an installation command:
|
|
28
|
-
* `expo install customerio-expo-plugin`
|
|
29
|
-
* `npm install customerio-expo-plugin`
|
|
30
|
-
* `yarn add customerio-expo-plugin`
|
|
31
|
-
|
|
32
|
-
1. Add `customerio-expo-plugin` plugin in your `app.json` or `app.config.js` and set configuration options. In most cases, you'll want to stick to our default options. When you configure the plugin, you can [pass options](#plugin-configuration-options). In most cases, you'll want to stick with the defaults, which enables all the SDK features. However you might want to disable rich push for `iOS`.
|
|
33
|
-
```json
|
|
34
|
-
// app.json
|
|
35
|
-
{
|
|
36
|
-
...
|
|
37
|
-
"plugins": [
|
|
38
|
-
...
|
|
39
|
-
[
|
|
40
|
-
"customerio-expo-plugin",
|
|
41
|
-
{
|
|
42
|
-
"android": {
|
|
43
|
-
"googleServicesFile": "./files/google-services.json",
|
|
44
|
-
},
|
|
45
|
-
"ios": {
|
|
46
|
-
"pushNotification": {
|
|
47
|
-
"useRichPush": true
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
1. Set the iOS build target. Our React Native SDK requires iOS deployment target `13`. You can install `expo-build-properties` and add the following to `app.json` or `app.plugin.js` to set your build target.
|
|
56
|
-
|
|
57
|
-
```json
|
|
58
|
-
{
|
|
59
|
-
...
|
|
60
|
-
"plugins": [
|
|
61
|
-
...
|
|
62
|
-
[
|
|
63
|
-
"expo-build-properties",
|
|
64
|
-
{
|
|
65
|
-
"ios": {
|
|
66
|
-
"deploymentTarget": "13.0"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
1. Add an import statement to your project for the react native library. We haven't included it below, but you can import `CioLogLevel` to set log outputs to something other than `error`; this may help you debug your application.
|
|
75
|
-
```javascript
|
|
76
|
-
import { CustomerIO, CustomerioConfig, CustomerIOEnv, Region } from ‘customerio-reactnative’;
|
|
77
|
-
```
|
|
78
|
-
1. In `useEffect`, initialize the package with your `CustomerioConfig` options and `CustomerIOEnv` variables. You can find your Site ID and API Key credentials—or create new ones—under *Data & Integrations* > *Integrations* > *Customer.io API*:
|
|
79
|
-
```javascript
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
const data = new CustomerioConfig()
|
|
82
|
-
data.logLevel = CioLogLevel.debug
|
|
83
|
-
|
|
84
|
-
const env = new CustomerIOEnv()
|
|
85
|
-
env.siteId = Env.siteId
|
|
86
|
-
env.apiKey = Env.apiKey
|
|
87
|
-
env.organizationId = Env.organizationId
|
|
88
|
-
//organizationId is used to send in-app messages.
|
|
89
|
-
env.region = Region.US
|
|
90
|
-
//Region is optional, defaults to Region.US. Use Region.EU for EU-based workspaces.
|
|
91
|
-
|
|
92
|
-
CustomerIO.initialize(env, data)
|
|
93
|
-
}, [])
|
|
94
|
-
```
|
|
95
|
-
## Plugin configuration options
|
|
96
|
-
|
|
97
|
-
The `customerio-expo-plugin` supports the following configuration options. In most cases, you'll want to use the [default options shown in the installation instructions](#install-and-configure-the-plugin).
|
|
98
|
-
|
|
99
|
-
<table class="settings-table mrg-t-lg">
|
|
100
|
-
<thead>
|
|
101
|
-
<tr>
|
|
102
|
-
<td>Option</td>
|
|
103
|
-
<td>Type</td>
|
|
104
|
-
<td>Default</td>
|
|
105
|
-
<td>Description</td>
|
|
106
|
-
</tr>
|
|
107
|
-
</thead>
|
|
108
|
-
<tbody>
|
|
109
|
-
<tr>
|
|
110
|
-
<td><code>android</code></td>
|
|
111
|
-
<td>object</td>
|
|
112
|
-
<td><code>undefined</code></td>
|
|
113
|
-
<td>Required if you want to setup Android even if it is empty. Eg (<code>"android": {}</code>).</td>
|
|
114
|
-
</tr>
|
|
115
|
-
<tr>
|
|
116
|
-
<td><code>ios</code></td>
|
|
117
|
-
<td>object</td>
|
|
118
|
-
<td><code>undefined</code></td>
|
|
119
|
-
<td>Required if you want to setup iOS even if it is empty. Eg (<code>"ios": {}</code>).</td>
|
|
120
|
-
</tr>
|
|
121
|
-
<tr>
|
|
122
|
-
<td><code>android.googleServicesFile</code></td>
|
|
123
|
-
<td>string</td>
|
|
124
|
-
<td><code>undefined</code></td>
|
|
125
|
-
<td>Set the path to the folder that contains your <code>google-services.json</code> file with a trailing slash (<code>/</code>).</td>
|
|
126
|
-
</tr>
|
|
127
|
-
<tr>
|
|
128
|
-
<td><code>ios.pushNotification</code></td>
|
|
129
|
-
<td>object</td>
|
|
130
|
-
<td style="white-space:nowrap;"><code>undefined</code></td>
|
|
131
|
-
<td>Enables push notifications for iOS, even if it is an empty object</td>
|
|
132
|
-
</tr>
|
|
133
|
-
<tr>
|
|
134
|
-
<td style="white-space:nowrap;"><code>ios.pushNotification.useRichPush</code></td>
|
|
135
|
-
<td>boolean</td>
|
|
136
|
-
<td><code>false</code></td>
|
|
137
|
-
<td>Enables rich push for iOS</td>
|
|
138
|
-
</tr>
|
|
139
|
-
<tr>
|
|
140
|
-
<td style="white-space:nowrap;"><code>ios.useFrameworks</code></td>
|
|
141
|
-
<td>string</td>
|
|
142
|
-
<td><code>undefined</code></td>
|
|
143
|
-
<td>This is optional, it allows the plugin to work with static libraries. Options are <code>static</code> and <code>dynamic</code></td>
|
|
144
|
-
</tr>
|
|
145
|
-
</tbody>
|
|
146
|
-
</table>
|
|
147
|
-
|
|
148
|
-
# Run the prebuild
|
|
149
|
-
|
|
150
|
-
After you [install and configure the plugin](#install-and-configure-the-plugin), run the prebuild.
|
|
151
|
-
|
|
152
|
-
```shell
|
|
153
|
-
# Run prebuild
|
|
154
|
-
expo prebuild
|
|
155
|
-
|
|
156
|
-
# Delete ios and android folders before prebuild
|
|
157
|
-
expo prebuild --clean
|
|
158
|
-
```
|
|
159
|
-
Now your project is ready to use the React Native SDK.
|
|
160
|
-
|
|
161
|
-
## Enable Rich Push on iOS
|
|
162
|
-
For now, you'll need to add a short workaround to take advantage of rich push features. Add the following to `ios/NotificationService/NotificationService.swift` after you run `prebuild --clean`.
|
|
163
|
-
|
|
164
|
-
```swift
|
|
165
|
-
...
|
|
166
|
-
import CioTracking // <== Add import
|
|
167
|
-
|
|
168
|
-
@objc
|
|
169
|
-
public class NotificationServiceCioManager : NSObject {
|
|
170
|
-
|
|
171
|
-
public override init() {}
|
|
172
|
-
|
|
173
|
-
@objc(didReceive:withContentHandler:)
|
|
174
|
-
public func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
|
175
|
-
CustomerIO.initialize(siteId: "<YourSiteId>", apiKey: "<YourApiKey>", region: Region.US) // <== Workaround code
|
|
176
|
-
...
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
# More information
|
|
180
|
-
|
|
181
|
-
See our complete SDK documentation at [https://customer.io/docs/sdk/expo/](https://customer.io/docs/sdk/expo/)
|
|
20
|
+
You'll find our [complete SDK documentation at https://customer.io/docs/sdk/expo](https://customer.io/docs/sdk/expo/).
|
|
182
21
|
|
|
183
22
|
# Contributing
|
|
184
23
|
|
|
@@ -188,4 +27,4 @@ We value an open, welcoming, diverse, inclusive, and healthy community for this
|
|
|
188
27
|
|
|
189
28
|
# License
|
|
190
29
|
|
|
191
|
-
[MIT](LICENSE)
|
|
30
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withAndroidManifestUpdates = void 0;
|
|
7
|
+
var _configPlugins = require("@expo/config-plugins");
|
|
8
|
+
const withAndroidManifestUpdates = configOuter => {
|
|
9
|
+
return (0, _configPlugins.withAndroidManifest)(configOuter, props => {
|
|
10
|
+
const application = props.modResults.manifest.application;
|
|
11
|
+
const customerIOMessagingpush = 'io.customer.messagingpush.CustomerIOFirebaseMessagingService';
|
|
12
|
+
if (!application[0]['service']) {
|
|
13
|
+
application[0]['service'] = [];
|
|
14
|
+
}
|
|
15
|
+
const hasService = application[0]['service'].some(service => service['$']['android:name'] === customerIOMessagingpush);
|
|
16
|
+
if (!hasService) {
|
|
17
|
+
application[0]['service'].push({
|
|
18
|
+
'$': {
|
|
19
|
+
'android:name': customerIOMessagingpush,
|
|
20
|
+
'android:exported': 'false'
|
|
21
|
+
},
|
|
22
|
+
'intent-filter': [{
|
|
23
|
+
action: [{
|
|
24
|
+
$: {
|
|
25
|
+
'android:name': 'com.google.firebase.MESSAGING_EVENT'
|
|
26
|
+
}
|
|
27
|
+
}]
|
|
28
|
+
}]
|
|
29
|
+
});
|
|
30
|
+
console.log('Successfully set CustomerIO push handler as priority in AndroidManifest.xml');
|
|
31
|
+
}
|
|
32
|
+
props.modResults.manifest.application = application;
|
|
33
|
+
return props;
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
exports.withAndroidManifestUpdates = withAndroidManifestUpdates;
|
|
37
|
+
//# sourceMappingURL=withAndroidManifestUpdates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","withAndroidManifestUpdates","configOuter","withAndroidManifest","props","application","modResults","manifest","customerIOMessagingpush","hasService","some","service","push","action","$","console","log","exports"],"sources":["withAndroidManifestUpdates.ts"],"sourcesContent":["import { ConfigPlugin, withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAndroidManifestUpdates: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAndroidManifest(configOuter, (props) => {\n const application = props.modResults.manifest\n .application as ManifestApplication[];\n const customerIOMessagingpush =\n 'io.customer.messagingpush.CustomerIOFirebaseMessagingService';\n\n if (!application[0]['service']) {\n application[0]['service'] = [];\n }\n\n const hasService = application[0]['service'].some(\n (service) => service['$']['android:name'] === customerIOMessagingpush\n );\n\n if (!hasService) {\n application[0]['service'].push({\n '$': {\n 'android:name': customerIOMessagingpush,\n 'android:exported': 'false',\n },\n 'intent-filter': [\n {\n action: [\n {\n $: {\n 'android:name': 'com.google.firebase.MESSAGING_EVENT',\n },\n },\n ],\n },\n ],\n });\n console.log(\n 'Successfully set CustomerIO push handler as priority in AndroidManifest.xml'\n );\n }\n\n props.modResults.manifest.application = application;\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAKO,MAAMC,0BAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,kCAAmB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACjD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAC1CF,WAAoC;IACvC,MAAMG,uBAAuB,GAC3B,8DAA8D;IAEhE,IAAI,CAACH,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;MAC9BA,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;IAChC;IAEA,MAAMI,UAAU,GAAGJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACK,IAAI,CAC9CC,OAAO,IAAKA,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAKH,uBAChD,CAAC;IAED,IAAI,CAACC,UAAU,EAAE;MACfJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACO,IAAI,CAAC;QAC7B,GAAG,EAAE;UACH,cAAc,EAAEJ,uBAAuB;UACvC,kBAAkB,EAAE;QACtB,CAAC;QACD,eAAe,EAAE,CACf;UACEK,MAAM,EAAE,CACN;YACEC,CAAC,EAAE;cACD,cAAc,EAAE;YAClB;UACF,CAAC;QAEL,CAAC;MAEL,CAAC,CAAC;MACFC,OAAO,CAACC,GAAG,CACT,6EACF,CAAC;IACH;IAEAZ,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACa,OAAA,CAAAhB,0BAAA,GAAAA,0BAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withAppGoogleServices","configOuter","withAppBuildGradle","props","regex","RegExp","CIO_APP_GOOGLE_SNIPPET","match","modResults","contents","replace","CIO_APP_APPLY_REGEX","console","log"],"sources":["withAppGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withAppBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_APP_APPLY_REGEX,\n CIO_APP_GOOGLE_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAppGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAppBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_APP_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_APP_APPLY_REGEX,\n `$1\\n${CIO_APP_GOOGLE_SNIPPET}`\n );\n } else {\n console.log('app/build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAMO,
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_android","withAppGoogleServices","configOuter","withAppBuildGradle","props","regex","RegExp","CIO_APP_GOOGLE_SNIPPET","match","modResults","contents","replace","CIO_APP_APPLY_REGEX","console","log","exports"],"sources":["withAppGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withAppBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_APP_APPLY_REGEX,\n CIO_APP_GOOGLE_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAppGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAppBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_APP_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_APP_APPLY_REGEX,\n `$1\\n${CIO_APP_GOOGLE_SNIPPET}`\n );\n } else {\n console.log('app/build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAMO,MAAME,qBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,iCAAkB,EAACD,WAAW,EAAGE,KAAK,IAAK;IAChD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACC,+BAAsB,CAAC;IAChD,MAAMC,KAAK,GAAGJ,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACH,KAAK,CAAC;IACpD,IAAI,CAACG,KAAK,EAAE;MACVJ,KAAK,CAACK,UAAU,CAACC,QAAQ,GAAGN,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DC,4BAAmB,EAClB,OAAML,+BAAuB,EAChC,CAAC;IACH,CAAC,MAAM;MACLM,OAAO,CAACC,GAAG,CAAC,sDAAsD,CAAC;IACrE;IAEA,OAAOV,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACW,OAAA,CAAAd,qBAAA,GAAAA,qBAAA"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.withCIOAndroid = withCIOAndroid;
|
|
7
|
+
var _withAndroidManifestUpdates = require("./withAndroidManifestUpdates");
|
|
7
8
|
var _withAppGoogleServices = require("./withAppGoogleServices");
|
|
8
9
|
var _withGistMavenRepository = require("./withGistMavenRepository");
|
|
9
10
|
var _withGoogleServicesJSON = require("./withGoogleServicesJSON");
|
|
@@ -13,6 +14,9 @@ function withCIOAndroid(config, props) {
|
|
|
13
14
|
config = (0, _withProjectGoogleServices.withProjectGoogleServices)(config, props);
|
|
14
15
|
config = (0, _withAppGoogleServices.withAppGoogleServices)(config, props);
|
|
15
16
|
config = (0, _withGoogleServicesJSON.withGoogleServicesJSON)(config, props);
|
|
17
|
+
if (props.setHighPriorityPushHandler) {
|
|
18
|
+
config = (0, _withAndroidManifestUpdates.withAndroidManifestUpdates)(config, props);
|
|
19
|
+
}
|
|
16
20
|
return config;
|
|
17
21
|
}
|
|
18
22
|
//# sourceMappingURL=withCIOAndroid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withCIOAndroid","config","props","withGistMavenRepository","withProjectGoogleServices","withAppGoogleServices","withGoogleServicesJSON"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\n\nexport function withCIOAndroid(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsAndroid\n): ExpoConfig {\n config = withGistMavenRepository(config, props);\n config = withProjectGoogleServices(config, props);\n config = withAppGoogleServices(config, props);\n config = withGoogleServicesJSON(config, props);\n\n return config;\n}\n"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;AAEO,
|
|
1
|
+
{"version":3,"names":["_withAndroidManifestUpdates","require","_withAppGoogleServices","_withGistMavenRepository","_withGoogleServicesJSON","_withProjectGoogleServices","withCIOAndroid","config","props","withGistMavenRepository","withProjectGoogleServices","withAppGoogleServices","withGoogleServicesJSON","setHighPriorityPushHandler","withAndroidManifestUpdates"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\nimport { withAndroidManifestUpdates } from './withAndroidManifestUpdates';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\n\nexport function withCIOAndroid(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsAndroid\n): ExpoConfig {\n config = withGistMavenRepository(config, props);\n config = withProjectGoogleServices(config, props);\n config = withAppGoogleServices(config, props);\n config = withGoogleServicesJSON(config, props);\n if (props.setHighPriorityPushHandler) {\n config = withAndroidManifestUpdates(config, props);\n }\n\n return config;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,2BAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AAEO,SAASK,cAAcA,CAC5BC,MAAkB,EAClBC,KAAqC,EACzB;EACZD,MAAM,GAAG,IAAAE,gDAAuB,EAACF,MAAM,EAAEC,KAAK,CAAC;EAC/CD,MAAM,GAAG,IAAAG,oDAAyB,EAACH,MAAM,EAAEC,KAAK,CAAC;EACjDD,MAAM,GAAG,IAAAI,4CAAqB,EAACJ,MAAM,EAAEC,KAAK,CAAC;EAC7CD,MAAM,GAAG,IAAAK,8CAAsB,EAACL,MAAM,EAAEC,KAAK,CAAC;EAC9C,IAAIA,KAAK,CAACK,0BAA0B,EAAE;IACpCN,MAAM,GAAG,IAAAO,sDAA0B,EAACP,MAAM,EAAEC,KAAK,CAAC;EACpD;EAEA,OAAOD,MAAM;AACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withGistMavenRepository","configOuter","withProjectBuildGradle","props","targetMatch","modResults","contents","match","CIO_GIST_MAVEN_REGEX","replace","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","console","log"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport {\n CIO_GIST_MAVEN_REGEX,\n CIO_PROJECT_ALLPROJECTS_REGEX,\n CIO_PROJECT_GIST_MAVEN_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGistMavenRepository: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const targetMatch = props.modResults.contents.match(CIO_GIST_MAVEN_REGEX);\n if (!targetMatch) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_ALLPROJECTS_REGEX,\n `$1\\n${CIO_PROJECT_GIST_MAVEN_SNIPPET}`\n );\n } else {\n console.log('build.gradle snippet alreade exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAOO,
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_android","withGistMavenRepository","configOuter","withProjectBuildGradle","props","targetMatch","modResults","contents","match","CIO_GIST_MAVEN_REGEX","replace","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","console","log","exports"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport {\n CIO_GIST_MAVEN_REGEX,\n CIO_PROJECT_ALLPROJECTS_REGEX,\n CIO_PROJECT_GIST_MAVEN_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGistMavenRepository: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const targetMatch = props.modResults.contents.match(CIO_GIST_MAVEN_REGEX);\n if (!targetMatch) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_ALLPROJECTS_REGEX,\n `$1\\n${CIO_PROJECT_GIST_MAVEN_SNIPPET}`\n );\n } else {\n console.log('build.gradle snippet alreade exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAOO,MAAME,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,qCAAsB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACC,KAAK,CAACC,6BAAoB,CAAC;IACzE,IAAI,CAACJ,WAAW,EAAE;MAChBD,KAAK,CAACE,UAAU,CAACC,QAAQ,GAAGH,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACG,OAAO,CAC3DC,sCAA6B,EAC5B,OAAMC,uCAA+B,EACxC,CAAC;IACH,CAAC,MAAM;MACLC,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;IACjE;IAEA,OAAOV,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACW,OAAA,CAAAd,uBAAA,GAAAA,uBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withGoogleServicesJSON","configOuter","cioProps","withProjectBuildGradle","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","FileManagement","exists","copyFile","e","console","log"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGoogleServicesJSON: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter, cioProps) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const options: CustomerIOPluginOptionsAndroid = {\n androidPath: props.modRequest.platformProjectRoot,\n googleServicesFile: cioProps?.googleServicesFile,\n };\n const { androidPath, googleServicesFile } = options;\n if (!FileManagement.exists(`${androidPath}/app/google-services.json`)) {\n if (googleServicesFile && FileManagement.exists(googleServicesFile)) {\n try {\n FileManagement.copyFile(\n googleServicesFile,\n `${androidPath}/app/google-services.json`\n );\n } catch (e) {\n console.log(\n `There was an error copying your google-services.json file. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAGO,
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_fileManagement","withGoogleServicesJSON","configOuter","cioProps","withProjectBuildGradle","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","FileManagement","exists","copyFile","e","console","log","exports"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGoogleServicesJSON: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter, cioProps) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const options: CustomerIOPluginOptionsAndroid = {\n androidPath: props.modRequest.platformProjectRoot,\n googleServicesFile: cioProps?.googleServicesFile,\n };\n const { androidPath, googleServicesFile } = options;\n if (!FileManagement.exists(`${androidPath}/app/google-services.json`)) {\n if (googleServicesFile && FileManagement.exists(googleServicesFile)) {\n try {\n FileManagement.copyFile(\n googleServicesFile,\n `${androidPath}/app/google-services.json`\n );\n } catch (e) {\n console.log(\n `There was an error copying your google-services.json file. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAGO,MAAME,sBAEZ,GAAGA,CAACC,WAAW,EAAEC,QAAQ,KAAK;EAC7B,OAAO,IAAAC,qCAAsB,EAACF,WAAW,EAAGG,KAAK,IAAK;IACpD,MAAMC,OAAuC,GAAG;MAC9CC,WAAW,EAAEF,KAAK,CAACG,UAAU,CAACC,mBAAmB;MACjDC,kBAAkB,EAAEP,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEO;IAChC,CAAC;IACD,MAAM;MAAEH,WAAW;MAAEG;IAAmB,CAAC,GAAGJ,OAAO;IACnD,IAAI,CAACK,8BAAc,CAACC,MAAM,CAAE,GAAEL,WAAY,2BAA0B,CAAC,EAAE;MACrE,IAAIG,kBAAkB,IAAIC,8BAAc,CAACC,MAAM,CAACF,kBAAkB,CAAC,EAAE;QACnE,IAAI;UACFC,8BAAc,CAACE,QAAQ,CACrBH,kBAAkB,EACjB,GAAEH,WAAY,2BACjB,CAAC;QACH,CAAC,CAAC,OAAOO,CAAC,EAAE;UACVC,OAAO,CAACC,GAAG,CACR,4FAA2FT,WAAY,2BAC1G,CAAC;QACH;MACF,CAAC,MAAM;QACLQ,OAAO,CAACC,GAAG,CACR,wCAAuCN,kBAAmB,yDAAwDH,WAAY,2BACjI,CAAC;MACH;IACF,CAAC,MAAM;MACLQ,OAAO,CAACC,GAAG,CACR,wBAAuBT,WAAY,wCACtC,CAAC;IACH;IAEA,OAAOF,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACY,OAAA,CAAAhB,sBAAA,GAAAA,sBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withProjectGoogleServices","configOuter","withProjectBuildGradle","props","regex","RegExp","CIO_PROJECT_GOOGLE_SNIPPET","match","modResults","contents","replace","CIO_PROJECT_BUILDSCRIPTS_REGEX"],"sources":["withProjectGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n CIO_PROJECT_GOOGLE_SNIPPET,\n} from './../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withProjectGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAMO,
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_android","withProjectGoogleServices","configOuter","withProjectBuildGradle","props","regex","RegExp","CIO_PROJECT_GOOGLE_SNIPPET","match","modResults","contents","replace","CIO_PROJECT_BUILDSCRIPTS_REGEX","exports"],"sources":["withProjectGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n CIO_PROJECT_GOOGLE_SNIPPET,\n} from './../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withProjectGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n }\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAMO,MAAME,yBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAO,IAAAC,qCAAsB,EAACD,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACC,mCAA0B,CAAC;IACpD,MAAMC,KAAK,GAAGJ,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACH,KAAK,CAAC;IACpD,IAAI,CAACG,KAAK,EAAE;MACVJ,KAAK,CAACK,UAAU,CAACC,QAAQ,GAAGN,KAAK,CAACK,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DC,uCAA8B,EAC7B,OAAML,mCAA2B,EACpC,CAAC;IACH;IAEA,OAAOH,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACS,OAAA,CAAAZ,yBAAA,GAAAA,yBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_APP_APPLY_REGEX","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","CIO_APP_GOOGLE_SNIPPET","CIO_PROJECT_GOOGLE_SNIPPET"],"sources":["android.ts"],"sourcesContent":["export const CIO_PROJECT_BUILDSCRIPTS_REGEX =\n /(buildscript\\s*\\{(.|\\n)*dependencies\\s*\\{)/;\nexport const CIO_APP_APPLY_REGEX = /(apply plugin: \"com.android.application\")/;\nexport const CIO_GIST_MAVEN_REGEX =\n /maven { url \"https:\\/\\/maven.gist.build\" }/;\nexport const CIO_PROJECT_ALLPROJECTS_REGEX =\n /(allprojects\\s*\\{(.|\\n){1,500}repositories\\s*\\{)/;\n\nexport const CIO_PROJECT_GIST_MAVEN_SNIPPET =\n ' maven { url \"https://maven.gist.build\" }';\nexport const CIO_APP_GOOGLE_SNIPPET =\n 'apply plugin: \"com.google.gms.google-services\" // Google Services plugin';\nexport const CIO_PROJECT_GOOGLE_SNIPPET =\n ' classpath \"com.google.gms:google-services:4.3.13\" // Google Services plugin';\n"],"mappings":";;;;;;AAAO,MAAMA,8BAA8B,GACzC,4CAA4C;
|
|
1
|
+
{"version":3,"names":["CIO_PROJECT_BUILDSCRIPTS_REGEX","exports","CIO_APP_APPLY_REGEX","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","CIO_APP_GOOGLE_SNIPPET","CIO_PROJECT_GOOGLE_SNIPPET"],"sources":["android.ts"],"sourcesContent":["export const CIO_PROJECT_BUILDSCRIPTS_REGEX =\n /(buildscript\\s*\\{(.|\\n)*dependencies\\s*\\{)/;\nexport const CIO_APP_APPLY_REGEX = /(apply plugin: \"com.android.application\")/;\nexport const CIO_GIST_MAVEN_REGEX =\n /maven { url \"https:\\/\\/maven.gist.build\" }/;\nexport const CIO_PROJECT_ALLPROJECTS_REGEX =\n /(allprojects\\s*\\{(.|\\n){1,500}repositories\\s*\\{)/;\n\nexport const CIO_PROJECT_GIST_MAVEN_SNIPPET =\n ' maven { url \"https://maven.gist.build\" }';\nexport const CIO_APP_GOOGLE_SNIPPET =\n 'apply plugin: \"com.google.gms.google-services\" // Google Services plugin';\nexport const CIO_PROJECT_GOOGLE_SNIPPET =\n ' classpath \"com.google.gms:google-services:4.3.13\" // Google Services plugin';\n"],"mappings":";;;;;;AAAO,MAAMA,8BAA8B,GACzC,4CAA4C;AAACC,OAAA,CAAAD,8BAAA,GAAAA,8BAAA;AACxC,MAAME,mBAAmB,GAAG,2CAA2C;AAACD,OAAA,CAAAC,mBAAA,GAAAA,mBAAA;AACxE,MAAMC,oBAAoB,GAC/B,4CAA4C;AAACF,OAAA,CAAAE,oBAAA,GAAAA,oBAAA;AACxC,MAAMC,6BAA6B,GACxC,kDAAkD;AAACH,OAAA,CAAAG,6BAAA,GAAAA,6BAAA;AAE9C,MAAMC,8BAA8B,GACzC,kDAAkD;AAACJ,OAAA,CAAAI,8BAAA,GAAAA,8BAAA;AAC9C,MAAMC,sBAAsB,GACjC,2EAA2E;AAACL,OAAA,CAAAK,sBAAA,GAAAA,sBAAA;AACvE,MAAMC,0BAA0B,GACrC,sFAAsF;AAACN,OAAA,CAAAM,0BAAA,GAAAA,0BAAA"}
|
|
@@ -3,12 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.LOCAL_PATH_TO_CIO_NSE_FILES = exports.IOS_DEPLOYMENT_TARGET = exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = exports.DEFAULT_BUNDLE_VERSION = exports.DEFAULT_BUNDLE_SHORT_VERSION = exports.CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET = exports.CIO_TARGET_NAME = exports.CIO_SDK_VERSION = exports.CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = exports.CIO_PODFILE_SNIPPET = exports.CIO_PODFILE_REGEX = exports.CIO_PODFILE_POST_INSTALL_REGEX = exports.CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET = exports.CIO_PODFILE_NOTIFICATION_SNIPPET = exports.CIO_PODFILE_NOTIFICATION_REGEX = exports.CIO_NOTIFICATION_TARGET_NAME = exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX = exports.CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET = exports.CIO_DIDFINISHLAUNCHINGMETHOD_REGEX = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX = exports.CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = exports.CIO_CIO_TARGET_REGEX = exports.CIO_APPDELEGATEHEADER_SNIPPET = exports.CIO_APPDELEGATEHEADER_REGEX = exports.CIO_APPDELEGATEDECLARATION_REGEX = exports.BUNDLE_VERSION_TEMPLATE_REGEX = exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = void 0;
|
|
7
|
-
const
|
|
6
|
+
exports.LOCAL_PATH_TO_CIO_NSE_FILES = exports.IOS_DEPLOYMENT_TARGET = exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = exports.DEFAULT_BUNDLE_VERSION = exports.DEFAULT_BUNDLE_SHORT_VERSION = exports.CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET = exports.CIO_TARGET_NAME = exports.CIO_SDK_VERSION = exports.CIO_REGISTER_PUSHNOTIFICATION_SNIPPET = exports.CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = exports.CIO_PODFILE_SNIPPET = exports.CIO_PODFILE_REGEX = exports.CIO_PODFILE_POST_INSTALL_REGEX = exports.CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET = exports.CIO_PODFILE_NOTIFICATION_SNIPPET = exports.CIO_PODFILE_NOTIFICATION_REGEX = exports.CIO_NOTIFICATION_TARGET_NAME = exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX = exports.CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET = exports.CIO_DIDFINISHLAUNCHINGMETHOD_REGEX = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX = exports.CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = exports.CIO_CIO_TARGET_REGEX = exports.CIO_APPDELEGATEHEADER_SNIPPET = exports.CIO_APPDELEGATEHEADER_REGEX = exports.CIO_APPDELEGATEDECLARATION_REGEX = exports.BUNDLE_VERSION_TEMPLATE_REGEX = exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = void 0;
|
|
7
|
+
const finder = require('find-package-json');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const f = finder(__dirname);
|
|
10
|
+
let pluginPackageRoot = f.next().filename;
|
|
11
|
+
// This is the path to the root of the customerio-expo-plugin package
|
|
12
|
+
pluginPackageRoot = path.dirname(pluginPackageRoot);
|
|
13
|
+
const LOCAL_PATH_TO_CIO_NSE_FILES = path.join(pluginPackageRoot, 'src/helpers/native-files/ios');
|
|
8
14
|
exports.LOCAL_PATH_TO_CIO_NSE_FILES = LOCAL_PATH_TO_CIO_NSE_FILES;
|
|
9
15
|
const IOS_DEPLOYMENT_TARGET = '13.0';
|
|
10
16
|
exports.IOS_DEPLOYMENT_TARGET = IOS_DEPLOYMENT_TARGET;
|
|
11
|
-
const CIO_SDK_VERSION = '~> 2.0
|
|
17
|
+
const CIO_SDK_VERSION = "'~> 2.0'";
|
|
12
18
|
exports.CIO_SDK_VERSION = CIO_SDK_VERSION;
|
|
13
19
|
const CIO_PODFILE_REGEX = /pod 'CustomerIO\/MessagingPushAPN'/;
|
|
14
20
|
exports.CIO_PODFILE_REGEX = CIO_PODFILE_REGEX;
|
|
@@ -55,10 +61,12 @@ CIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler
|
|
|
55
61
|
`;
|
|
56
62
|
exports.CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET;
|
|
57
63
|
const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = `
|
|
64
|
+
[super application:application didFailToRegisterForRemoteNotificationsWithError:error];
|
|
58
65
|
[pnHandlerObj application:application error:error];
|
|
59
66
|
`;
|
|
60
67
|
exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET;
|
|
61
68
|
const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = `
|
|
69
|
+
[super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
|
|
62
70
|
return [pnHandlerObj application:application deviceToken:deviceToken];
|
|
63
71
|
`;
|
|
64
72
|
exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET;
|
|
@@ -82,7 +90,7 @@ const CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET = `
|
|
|
82
90
|
completionHandler( UNNotificationPresentationOptionAlert + UNNotificationPresentationOptionSound);
|
|
83
91
|
}`;
|
|
84
92
|
exports.CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET = CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET;
|
|
85
|
-
const CIO_PODFILE_SNIPPET = ` pod 'CustomerIO/MessagingPushAPN',
|
|
93
|
+
const CIO_PODFILE_SNIPPET = ` pod 'CustomerIO/MessagingPushAPN', ${CIO_SDK_VERSION}`;
|
|
86
94
|
exports.CIO_PODFILE_SNIPPET = CIO_PODFILE_SNIPPET;
|
|
87
95
|
const CIO_PODFILE_NOTIFICATION_SNIPPET = `
|
|
88
96
|
target '${CIO_NOTIFICATION_TARGET_NAME}' do
|
|
@@ -95,4 +103,19 @@ target '${CIO_NOTIFICATION_TARGET_NAME}' do
|
|
|
95
103
|
${CIO_PODFILE_SNIPPET}
|
|
96
104
|
end`;
|
|
97
105
|
exports.CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET = CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET;
|
|
106
|
+
const CIO_REGISTER_PUSHNOTIFICATION_SNIPPET = `
|
|
107
|
+
@objc(registerPushNotification:)
|
|
108
|
+
public func registerPushNotification(withNotificationDelegate notificationDelegate: UNUserNotificationCenterDelegate) {
|
|
109
|
+
|
|
110
|
+
let center = UNUserNotificationCenter.current()
|
|
111
|
+
center.delegate = notificationDelegate
|
|
112
|
+
center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
|
|
113
|
+
if error == nil{
|
|
114
|
+
DispatchQueue.main.async {
|
|
115
|
+
UIApplication.shared.registerForRemoteNotifications()
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}`;
|
|
120
|
+
exports.CIO_REGISTER_PUSHNOTIFICATION_SNIPPET = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;
|
|
98
121
|
//# sourceMappingURL=ios.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LOCAL_PATH_TO_CIO_NSE_FILES","IOS_DEPLOYMENT_TARGET","CIO_SDK_VERSION","CIO_PODFILE_REGEX","CIO_CIO_TARGET_REGEX","CIO_PODFILE_NOTIFICATION_REGEX","CIO_PODFILE_POST_INSTALL_REGEX","GROUP_IDENTIFIER_TEMPLATE_REGEX","BUNDLE_SHORT_VERSION_TEMPLATE_REGEX","BUNDLE_VERSION_TEMPLATE_REGEX","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_APPDELEGATEDECLARATION_REGEX","CIO_APPDELEGATEHEADER_REGEX","DEFAULT_BUNDLE_VERSION","DEFAULT_BUNDLE_SHORT_VERSION","CIO_TARGET_NAME","CIO_NOTIFICATION_TARGET_NAME","CIO_APPDELEGATEHEADER_SNIPPET","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET","CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET","CIO_PODFILE_SNIPPET","CIO_PODFILE_NOTIFICATION_SNIPPET","CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET"],"sources":["ios.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["finder","require","path","f","__dirname","pluginPackageRoot","next","filename","dirname","LOCAL_PATH_TO_CIO_NSE_FILES","join","exports","IOS_DEPLOYMENT_TARGET","CIO_SDK_VERSION","CIO_PODFILE_REGEX","CIO_CIO_TARGET_REGEX","CIO_PODFILE_NOTIFICATION_REGEX","CIO_PODFILE_POST_INSTALL_REGEX","GROUP_IDENTIFIER_TEMPLATE_REGEX","BUNDLE_SHORT_VERSION_TEMPLATE_REGEX","BUNDLE_VERSION_TEMPLATE_REGEX","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_APPDELEGATEDECLARATION_REGEX","CIO_APPDELEGATEHEADER_REGEX","DEFAULT_BUNDLE_VERSION","DEFAULT_BUNDLE_SHORT_VERSION","CIO_TARGET_NAME","CIO_NOTIFICATION_TARGET_NAME","CIO_APPDELEGATEHEADER_SNIPPET","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET","CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET","CIO_PODFILE_SNIPPET","CIO_PODFILE_NOTIFICATION_SNIPPET","CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET"],"sources":["ios.ts"],"sourcesContent":["const finder = require('find-package-json');\nconst path = require('path');\n\nconst f = finder(__dirname);\nlet pluginPackageRoot = f.next().filename;\n// This is the path to the root of the customerio-expo-plugin package\npluginPackageRoot = path.dirname(pluginPackageRoot);\n\nexport const LOCAL_PATH_TO_CIO_NSE_FILES = path.join(\n pluginPackageRoot,\n 'src/helpers/native-files/ios'\n);\nexport const IOS_DEPLOYMENT_TARGET = '13.0';\nexport const CIO_SDK_VERSION = \"'~> 2.0'\";\nexport const CIO_PODFILE_REGEX = /pod 'CustomerIO\\/MessagingPushAPN'/;\nexport const CIO_CIO_TARGET_REGEX = /cio_target_names/;\nexport const CIO_PODFILE_NOTIFICATION_REGEX = /target 'NotificationService' do/;\nexport const CIO_PODFILE_POST_INSTALL_REGEX = /post_install do \\|installer\\|/;\nexport const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;\nexport const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;\nexport const BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;\nexport const CIO_DIDFINISHLAUNCHINGMETHOD_REGEX =\n /(- \\(BOOL\\)application:\\(UIApplication \\*\\)application didFinishLaunchingWithOptions:\\(NSDictionary \\*\\)launchOptions(\\s|\\n)*?\\{)((.|\\n)*)\\[super(\\s)application:application(\\s)didFinishLaunchingWithOptions:launchOptions\\];/;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX =\n /return \\[super application:application didFailToRegisterForRemoteNotificationsWithError:error\\];/;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX =\n /(- \\(void\\)application:\\(UIApplication \\*\\)application didFailToRegisterForRemoteNotificationsWithError:\\(NSError \\*\\)error(\\s|\\n)*?\\{)(.|\\n){2}.*\\n\\}/;\n\nexport const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX =\n /return \\[super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken\\];/;\n\nexport const CIO_APPDELEGATEDECLARATION_REGEX =\n /@implementation AppDelegate(.|\\n)/;\n\nexport const CIO_APPDELEGATEHEADER_REGEX =\n /@interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate>/;\nexport const DEFAULT_BUNDLE_VERSION = '1';\nexport const DEFAULT_BUNDLE_SHORT_VERSION = '1.0';\nexport const CIO_TARGET_NAME = 'CustomerIOSDK';\nexport const CIO_NOTIFICATION_TARGET_NAME = 'NotificationService';\nexport const CIO_APPDELEGATEHEADER_SNIPPET = `\n#import <UserNotifications/UserNotifications.h>\n\n@interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate, UNUserNotificationCenterDelegate>\n`;\n\nexport const CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = `\nCIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler alloc] init];\n`;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = `\n [super application:application didFailToRegisterForRemoteNotificationsWithError:error];\n [pnHandlerObj application:application error:error];\n`;\n\nexport const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = `\n [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];\n return [pnHandlerObj application:application deviceToken:deviceToken];\n`;\n\nexport const CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = `\n // Register for push notifications\n [pnHandlerObj registerPushNotification:self];\n`;\n\n// Enable push handling - notification response\nexport const CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET = `\n- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {\n [pnHandlerObj userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];\n}`;\n\n// Foreground push handling\nexport const CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET = `\n// show push when the app is in foreground\n- (void)userNotificationCenter:(UNUserNotificationCenter* )center willPresentNotification:(UNNotification* )notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {\n completionHandler( UNNotificationPresentationOptionAlert + UNNotificationPresentationOptionSound);\n}`;\nexport const CIO_PODFILE_SNIPPET = ` pod 'CustomerIO/MessagingPushAPN', ${CIO_SDK_VERSION}`;\nexport const CIO_PODFILE_NOTIFICATION_SNIPPET = `\ntarget '${CIO_NOTIFICATION_TARGET_NAME}' do\n${CIO_PODFILE_SNIPPET}\nend`;\nexport const CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET = `\ntarget '${CIO_NOTIFICATION_TARGET_NAME}' do\n use_frameworks! :linkage => :static\n${CIO_PODFILE_SNIPPET}\nend`;\n\nexport const CIO_REGISTER_PUSHNOTIFICATION_SNIPPET = `\n@objc(registerPushNotification:)\n public func registerPushNotification(withNotificationDelegate notificationDelegate: UNUserNotificationCenterDelegate) {\n\n let center = UNUserNotificationCenter.current()\n center.delegate = notificationDelegate\n center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in\n if error == nil{\n DispatchQueue.main.async {\n UIApplication.shared.registerForRemoteNotifications()\n }\n }\n }\n }`;\n"],"mappings":";;;;;;AAAA,MAAMA,MAAM,GAAGC,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAMC,IAAI,GAAGD,OAAO,CAAC,MAAM,CAAC;AAE5B,MAAME,CAAC,GAAGH,MAAM,CAACI,SAAS,CAAC;AAC3B,IAAIC,iBAAiB,GAAGF,CAAC,CAACG,IAAI,CAAC,CAAC,CAACC,QAAQ;AACzC;AACAF,iBAAiB,GAAGH,IAAI,CAACM,OAAO,CAACH,iBAAiB,CAAC;AAE5C,MAAMI,2BAA2B,GAAGP,IAAI,CAACQ,IAAI,CAClDL,iBAAiB,EACjB,8BACF,CAAC;AAACM,OAAA,CAAAF,2BAAA,GAAAA,2BAAA;AACK,MAAMG,qBAAqB,GAAG,MAAM;AAACD,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AACrC,MAAMC,eAAe,GAAG,UAAU;AAACF,OAAA,CAAAE,eAAA,GAAAA,eAAA;AACnC,MAAMC,iBAAiB,GAAG,oCAAoC;AAACH,OAAA,CAAAG,iBAAA,GAAAA,iBAAA;AAC/D,MAAMC,oBAAoB,GAAG,kBAAkB;AAACJ,OAAA,CAAAI,oBAAA,GAAAA,oBAAA;AAChD,MAAMC,8BAA8B,GAAG,iCAAiC;AAACL,OAAA,CAAAK,8BAAA,GAAAA,8BAAA;AACzE,MAAMC,8BAA8B,GAAG,+BAA+B;AAACN,OAAA,CAAAM,8BAAA,GAAAA,8BAAA;AACvE,MAAMC,+BAA+B,GAAG,wBAAwB;AAACP,OAAA,CAAAO,+BAAA,GAAAA,+BAAA;AACjE,MAAMC,mCAAmC,GAAG,4BAA4B;AAACR,OAAA,CAAAQ,mCAAA,GAAAA,mCAAA;AACzE,MAAMC,6BAA6B,GAAG,sBAAsB;AAACT,OAAA,CAAAS,6BAAA,GAAAA,6BAAA;AAC7D,MAAMC,kCAAkC,GAC7C,gOAAgO;AAACV,OAAA,CAAAU,kCAAA,GAAAA,kCAAA;AAE5N,MAAMC,0DAA0D,GACrE,kGAAkG;AAACX,OAAA,CAAAW,0DAAA,GAAAA,0DAAA;AAE9F,MAAMC,8DAA8D,GACzE,wJAAwJ;AAACZ,OAAA,CAAAY,8DAAA,GAAAA,8DAAA;AAEpJ,MAAMC,0DAA0D,GACrE,wGAAwG;AAACb,OAAA,CAAAa,0DAAA,GAAAA,0DAAA;AAEpG,MAAMC,gCAAgC,GAC3C,mCAAmC;AAACd,OAAA,CAAAc,gCAAA,GAAAA,gCAAA;AAE/B,MAAMC,2BAA2B,GACtC,mEAAmE;AAACf,OAAA,CAAAe,2BAAA,GAAAA,2BAAA;AAC/D,MAAMC,sBAAsB,GAAG,GAAG;AAAChB,OAAA,CAAAgB,sBAAA,GAAAA,sBAAA;AACnC,MAAMC,4BAA4B,GAAG,KAAK;AAACjB,OAAA,CAAAiB,4BAAA,GAAAA,4BAAA;AAC3C,MAAMC,eAAe,GAAG,eAAe;AAAClB,OAAA,CAAAkB,eAAA,GAAAA,eAAA;AACxC,MAAMC,4BAA4B,GAAG,qBAAqB;AAACnB,OAAA,CAAAmB,4BAAA,GAAAA,4BAAA;AAC3D,MAAMC,6BAA6B,GAAI;AAC9C;AACA;AACA;AACA,CAAC;AAACpB,OAAA,CAAAoB,6BAAA,GAAAA,6BAAA;AAEK,MAAMC,8CAA8C,GAAI;AAC/D;AACA,CAAC;AAACrB,OAAA,CAAAqB,8CAAA,GAAAA,8CAAA;AAEK,MAAMC,4DAA4D,GAAI;AAC7E;AACA;AACA,CAAC;AAACtB,OAAA,CAAAsB,4DAAA,GAAAA,4DAAA;AAEK,MAAMC,4DAA4D,GAAI;AAC7E;AACA;AACA,CAAC;AAACvB,OAAA,CAAAuB,4DAAA,GAAAA,4DAAA;AAEK,MAAMC,2CAA2C,GAAI;AAC5D;AACA;AACA,CAAC;;AAED;AAAAxB,OAAA,CAAAwB,2CAAA,GAAAA,2CAAA;AACO,MAAMC,iDAAiD,GAAI;AAClE;AACA;AACA,EAAE;;AAEF;AAAAzB,OAAA,CAAAyB,iDAAA,GAAAA,iDAAA;AACO,MAAMC,0CAA0C,GAAI;AAC3D;AACA;AACA;AACA,EAAE;AAAC1B,OAAA,CAAA0B,0CAAA,GAAAA,0CAAA;AACI,MAAMC,mBAAmB,GAAI,wCAAuCzB,eAAgB,EAAC;AAACF,OAAA,CAAA2B,mBAAA,GAAAA,mBAAA;AACtF,MAAMC,gCAAgC,GAAI;AACjD,UAAUT,4BAA6B;AACvC,EAAEQ,mBAAoB;AACtB,IAAI;AAAC3B,OAAA,CAAA4B,gCAAA,GAAAA,gCAAA;AACE,MAAMC,iDAAiD,GAAI;AAClE,UAAUV,4BAA6B;AACvC;AACA,EAAEQ,mBAAoB;AACtB,IAAI;AAAC3B,OAAA,CAAA6B,iDAAA,GAAAA,iDAAA;AAEE,MAAMC,qCAAqC,GAAI;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AAAC9B,OAAA,CAAA8B,qCAAA,GAAAA,qCAAA"}
|
|
@@ -9,19 +9,7 @@ public class CIOAppPushNotificationsHandler : NSObject {
|
|
|
9
9
|
|
|
10
10
|
public override init() {}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
public func registerPushNotification(withNotificationDelegate notificationDelegate: UNUserNotificationCenterDelegate) {
|
|
14
|
-
|
|
15
|
-
let center = UNUserNotificationCenter.current()
|
|
16
|
-
center.delegate = notificationDelegate
|
|
17
|
-
center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
|
|
18
|
-
if error == nil{
|
|
19
|
-
DispatchQueue.main.async {
|
|
20
|
-
UIApplication.shared.registerForRemoteNotifications()
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
12
|
+
{{REGISTER_SNIPPET}}
|
|
25
13
|
|
|
26
14
|
@objc(application:deviceToken:)
|
|
27
15
|
public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["injectCodeByRegex","fileContent","lineRegex","snippet","lines","split","index","findIndex","line","test","content","slice","injectCodeByMultiLineRegex","replace","replaceCodeByRegex","injectCodeByMultiLineRegexAndReplaceLine","injectCodeByLineNumber"],"sources":["codeInjection.ts"],"sourcesContent":["export function injectCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n const index = lines.findIndex((line) => lineRegex.test(line));\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content;\n}\n\nexport function injectCodeByMultiLineRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `$&\\n${snippet}`);\n}\n\nexport function replaceCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, snippet);\n}\n\nexport function injectCodeByMultiLineRegexAndReplaceLine(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `${snippet}`);\n}\n\nexport function injectCodeByLineNumber(\n fileContent: string,\n index: number,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content;\n}\n"],"mappings":";;;;;;;;;;AAAO,SAASA,
|
|
1
|
+
{"version":3,"names":["injectCodeByRegex","fileContent","lineRegex","snippet","lines","split","index","findIndex","line","test","content","slice","injectCodeByMultiLineRegex","replace","replaceCodeByRegex","injectCodeByMultiLineRegexAndReplaceLine","injectCodeByLineNumber"],"sources":["codeInjection.ts"],"sourcesContent":["export function injectCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n const index = lines.findIndex((line) => lineRegex.test(line));\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content;\n}\n\nexport function injectCodeByMultiLineRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `$&\\n${snippet}`);\n}\n\nexport function replaceCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, snippet);\n}\n\nexport function injectCodeByMultiLineRegexAndReplaceLine(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `${snippet}`);\n}\n\nexport function injectCodeByLineNumber(\n fileContent: string,\n index: number,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content;\n}\n"],"mappings":";;;;;;;;;;AAAO,SAASA,iBAAiBA,CAC/BC,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,MAAMC,KAAK,GAAGH,WAAW,CAACI,KAAK,CAAC,IAAI,CAAC;EACrC,MAAMC,KAAK,GAAGF,KAAK,CAACG,SAAS,CAAEC,IAAI,IAAKN,SAAS,CAACO,IAAI,CAACD,IAAI,CAAC,CAAC;EAC7D,IAAIE,OAAiB,GAAGN,KAAK;EAE7B,IAAIE,KAAK,GAAG,CAAC,CAAC,EAAE;IACdI,OAAO,GAAG,CAAC,GAAGN,KAAK,CAACO,KAAK,CAAC,CAAC,EAAEL,KAAK,CAAC,EAAEH,OAAO,EAAE,GAAGC,KAAK,CAACO,KAAK,CAACL,KAAK,CAAC,CAAC;EACtE;EAEA,OAAOI,OAAO;AAChB;AAEO,SAASE,0BAA0BA,CACxCX,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,OAAMC,OAAQ,EAAC,CAAC;AACzD;AAEO,SAASW,kBAAkBA,CAChCb,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAEC,OAAO,CAAC;AAChD;AAEO,SAASY,wCAAwCA,CACtDd,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,GAAEC,OAAQ,EAAC,CAAC;AACrD;AAEO,SAASa,sBAAsBA,CACpCf,WAAmB,EACnBK,KAAa,EACbH,OAAe,EACf;EACA,MAAMC,KAAK,GAAGH,WAAW,CAACI,KAAK,CAAC,IAAI,CAAC;EACrC,IAAIK,OAAiB,GAAGN,KAAK;EAE7B,IAAIE,KAAK,GAAG,CAAC,CAAC,EAAE;IACdI,OAAO,GAAG,CAAC,GAAGN,KAAK,CAACO,KAAK,CAAC,CAAC,EAAEL,KAAK,CAAC,EAAEH,OAAO,EAAE,GAAGC,KAAK,CAACO,KAAK,CAACL,KAAK,CAAC,CAAC;EACtE;EAEA,OAAOI,OAAO;AAChB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FileManagement","read","path","Promise","resolve","reject","readFile","err","data","write","contents","writeFile","append","appendFile","exists","existsSync","copyFile","src","dest","copyFileSync","console","log","mkdir","options","mkdirSync","writeFileSync","readFileSync"],"sources":["fileManagement.ts"],"sourcesContent":["import {\n readFile,\n writeFile,\n appendFile,\n existsSync,\n copyFileSync,\n mkdirSync,\n writeFileSync,\n readFileSync,\n MakeDirectoryOptions,\n} from 'fs';\n\nexport class FileManagement {\n static async read(path: string): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n readFile(path, 'utf8', (err, data) => {\n if (err || !data) {\n reject(err);\n return;\n }\n resolve(data);\n });\n });\n }\n\n static async write(path: string, contents: string): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n writeFile(path, contents, 'utf8', (err) => {\n if (err) {\n reject(err);\n return;\n }\n resolve();\n });\n });\n }\n\n static async append(path: string, contents: string): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n appendFile(path, contents, 'utf8', (err) => {\n if (err) {\n reject(err);\n return;\n }\n resolve();\n });\n });\n }\n\n static exists(path: string) {\n return existsSync(path);\n }\n\n static copyFile(src: string, dest: string) {\n try {\n copyFileSync(src, dest);\n } catch (err) {\n console.log(`Error copying file from ${src} to ${dest}: `, err);\n }\n }\n\n static mkdir(path: string, options: MakeDirectoryOptions) {\n try {\n mkdirSync(path, options);\n } catch (err) {\n console.log(`Error creating directory ${path}: `, err);\n }\n }\n\n static writeFile(path: string, data: string) {\n try {\n writeFileSync(path, data);\n } catch (err) {\n console.log(`Error writing to file ${path}: `, err);\n }\n }\n\n static readFile(path: string) {\n try {\n return readFileSync(path, 'utf-8');\n } catch (err) {\n console.log(`Error reading file ${path}: `, err);\n }\n\n return '';\n }\n}\n"],"mappings":";;;;;;AAAA;AAYO,
|
|
1
|
+
{"version":3,"names":["_fs","require","FileManagement","read","path","Promise","resolve","reject","readFile","err","data","write","contents","writeFile","append","appendFile","exists","existsSync","copyFile","src","dest","copyFileSync","console","log","mkdir","options","mkdirSync","writeFileSync","readFileSync","exports"],"sources":["fileManagement.ts"],"sourcesContent":["import {\n readFile,\n writeFile,\n appendFile,\n existsSync,\n copyFileSync,\n mkdirSync,\n writeFileSync,\n readFileSync,\n MakeDirectoryOptions,\n} from 'fs';\n\nexport class FileManagement {\n static async read(path: string): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n readFile(path, 'utf8', (err, data) => {\n if (err || !data) {\n reject(err);\n return;\n }\n resolve(data);\n });\n });\n }\n\n static async write(path: string, contents: string): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n writeFile(path, contents, 'utf8', (err) => {\n if (err) {\n reject(err);\n return;\n }\n resolve();\n });\n });\n }\n\n static async append(path: string, contents: string): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n appendFile(path, contents, 'utf8', (err) => {\n if (err) {\n reject(err);\n return;\n }\n resolve();\n });\n });\n }\n\n static exists(path: string) {\n return existsSync(path);\n }\n\n static copyFile(src: string, dest: string) {\n try {\n copyFileSync(src, dest);\n } catch (err) {\n console.log(`Error copying file from ${src} to ${dest}: `, err);\n }\n }\n\n static mkdir(path: string, options: MakeDirectoryOptions) {\n try {\n mkdirSync(path, options);\n } catch (err) {\n console.log(`Error creating directory ${path}: `, err);\n }\n }\n\n static writeFile(path: string, data: string) {\n try {\n writeFileSync(path, data);\n } catch (err) {\n console.log(`Error writing to file ${path}: `, err);\n }\n }\n\n static readFile(path: string) {\n try {\n return readFileSync(path, 'utf-8');\n } catch (err) {\n console.log(`Error reading file ${path}: `, err);\n }\n\n return '';\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AAYO,MAAMC,cAAc,CAAC;EAC1B,aAAaC,IAAIA,CAACC,IAAY,EAAmB;IAC/C,OAAO,IAAIC,OAAO,CAAS,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC9C,IAAAC,YAAQ,EAACJ,IAAI,EAAE,MAAM,EAAE,CAACK,GAAG,EAAEC,IAAI,KAAK;QACpC,IAAID,GAAG,IAAI,CAACC,IAAI,EAAE;UAChBH,MAAM,CAACE,GAAG,CAAC;UACX;QACF;QACAH,OAAO,CAACI,IAAI,CAAC;MACf,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,aAAaC,KAAKA,CAACP,IAAY,EAAEQ,QAAgB,EAAiB;IAChE,OAAO,IAAIP,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC5C,IAAAM,aAAS,EAACT,IAAI,EAAEQ,QAAQ,EAAE,MAAM,EAAGH,GAAG,IAAK;QACzC,IAAIA,GAAG,EAAE;UACPF,MAAM,CAACE,GAAG,CAAC;UACX;QACF;QACAH,OAAO,CAAC,CAAC;MACX,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,aAAaQ,MAAMA,CAACV,IAAY,EAAEQ,QAAgB,EAAiB;IACjE,OAAO,IAAIP,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC5C,IAAAQ,cAAU,EAACX,IAAI,EAAEQ,QAAQ,EAAE,MAAM,EAAGH,GAAG,IAAK;QAC1C,IAAIA,GAAG,EAAE;UACPF,MAAM,CAACE,GAAG,CAAC;UACX;QACF;QACAH,OAAO,CAAC,CAAC;MACX,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,OAAOU,MAAMA,CAACZ,IAAY,EAAE;IAC1B,OAAO,IAAAa,cAAU,EAACb,IAAI,CAAC;EACzB;EAEA,OAAOc,QAAQA,CAACC,GAAW,EAAEC,IAAY,EAAE;IACzC,IAAI;MACF,IAAAC,gBAAY,EAACF,GAAG,EAAEC,IAAI,CAAC;IACzB,CAAC,CAAC,OAAOX,GAAG,EAAE;MACZa,OAAO,CAACC,GAAG,CAAE,2BAA0BJ,GAAI,OAAMC,IAAK,IAAG,EAAEX,GAAG,CAAC;IACjE;EACF;EAEA,OAAOe,KAAKA,CAACpB,IAAY,EAAEqB,OAA6B,EAAE;IACxD,IAAI;MACF,IAAAC,aAAS,EAACtB,IAAI,EAAEqB,OAAO,CAAC;IAC1B,CAAC,CAAC,OAAOhB,GAAG,EAAE;MACZa,OAAO,CAACC,GAAG,CAAE,4BAA2BnB,IAAK,IAAG,EAAEK,GAAG,CAAC;IACxD;EACF;EAEA,OAAOI,SAASA,CAACT,IAAY,EAAEM,IAAY,EAAE;IAC3C,IAAI;MACF,IAAAiB,iBAAa,EAACvB,IAAI,EAAEM,IAAI,CAAC;IAC3B,CAAC,CAAC,OAAOD,GAAG,EAAE;MACZa,OAAO,CAACC,GAAG,CAAE,yBAAwBnB,IAAK,IAAG,EAAEK,GAAG,CAAC;IACrD;EACF;EAEA,OAAOD,QAAQA,CAACJ,IAAY,EAAE;IAC5B,IAAI;MACF,OAAO,IAAAwB,gBAAY,EAACxB,IAAI,EAAE,OAAO,CAAC;IACpC,CAAC,CAAC,OAAOK,GAAG,EAAE;MACZa,OAAO,CAACC,GAAG,CAAE,sBAAqBnB,IAAK,IAAG,EAAEK,GAAG,CAAC;IAClD;IAEA,OAAO,EAAE;EACX;AACF;AAACoB,OAAA,CAAA3B,cAAA,GAAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["injectCIOPodfileCode","iosPath","filename","podfile","FileManagement","read","matches","match","CIO_PODFILE_REGEX","targetMatch","CIO_CIO_TARGET_REGEX","lines","split","index","findIndex","line","CIO_PODFILE_POST_INSTALL_REGEX","test","content","slice","CIO_PODFILE_SNIPPET","write","join","console","log","injectCIONotificationPodfileCode","useFrameworks","CIO_PODFILE_NOTIFICATION_REGEX","snippet","CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET","CIO_PODFILE_NOTIFICATION_SNIPPET","append"],"sources":["injectCIOPodfileCode.ts"],"sourcesContent":["import type { CustomerIOPluginOptionsIOS } from '../../types/cio-types';\nimport {\n CIO_PODFILE_REGEX,\n CIO_PODFILE_SNIPPET,\n CIO_PODFILE_NOTIFICATION_SNIPPET,\n CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET,\n CIO_PODFILE_NOTIFICATION_REGEX,\n CIO_CIO_TARGET_REGEX,\n CIO_PODFILE_POST_INSTALL_REGEX,\n} from '../constants/ios';\nimport { FileManagement } from './fileManagement';\n\nexport async function injectCIOPodfileCode(iosPath: string) {\n const filename = `${iosPath}/Podfile`;\n const podfile = await FileManagement.read(filename);\n const matches = podfile.match(CIO_PODFILE_REGEX);\n const targetMatch = podfile.match(CIO_CIO_TARGET_REGEX);\n\n if (!targetMatch) {\n const lines = podfile.split('\\n');\n const index = lines.findIndex((line) =>\n CIO_PODFILE_POST_INSTALL_REGEX.test(line)\n );\n let content: string[] = lines;\n if (index > -1) {\n content = [\n ...lines.slice(0, index - 1),\n !matches ? CIO_PODFILE_SNIPPET : '',\n ...lines.slice(index - 1),\n ];\n }\n\n FileManagement.write(filename, content.join('\\n'));\n } else {\n console.log('Customerio Podfile snippets already exists. Skipping...');\n }\n}\n\nexport async function injectCIONotificationPodfileCode(\n iosPath: string,\n useFrameworks: CustomerIOPluginOptionsIOS['useFrameworks']\n) {\n const filename = `${iosPath}/Podfile`;\n const podfile = await FileManagement.read(filename);\n const matches = podfile.match(CIO_PODFILE_NOTIFICATION_REGEX);\n\n if (!matches) {\n const snippet =\n useFrameworks === 'static'\n ? CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET\n : CIO_PODFILE_NOTIFICATION_SNIPPET;\n FileManagement.append(filename, snippet);\n }\n}\n"],"mappings":";;;;;;;AACA;AASA;AAEO,
|
|
1
|
+
{"version":3,"names":["_ios","require","_fileManagement","injectCIOPodfileCode","iosPath","filename","podfile","FileManagement","read","matches","match","CIO_PODFILE_REGEX","targetMatch","CIO_CIO_TARGET_REGEX","lines","split","index","findIndex","line","CIO_PODFILE_POST_INSTALL_REGEX","test","content","slice","CIO_PODFILE_SNIPPET","write","join","console","log","injectCIONotificationPodfileCode","useFrameworks","CIO_PODFILE_NOTIFICATION_REGEX","snippet","CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET","CIO_PODFILE_NOTIFICATION_SNIPPET","append"],"sources":["injectCIOPodfileCode.ts"],"sourcesContent":["import type { CustomerIOPluginOptionsIOS } from '../../types/cio-types';\nimport {\n CIO_PODFILE_REGEX,\n CIO_PODFILE_SNIPPET,\n CIO_PODFILE_NOTIFICATION_SNIPPET,\n CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET,\n CIO_PODFILE_NOTIFICATION_REGEX,\n CIO_CIO_TARGET_REGEX,\n CIO_PODFILE_POST_INSTALL_REGEX,\n} from '../constants/ios';\nimport { FileManagement } from './fileManagement';\n\nexport async function injectCIOPodfileCode(iosPath: string) {\n const filename = `${iosPath}/Podfile`;\n const podfile = await FileManagement.read(filename);\n const matches = podfile.match(CIO_PODFILE_REGEX);\n const targetMatch = podfile.match(CIO_CIO_TARGET_REGEX);\n\n if (!targetMatch) {\n const lines = podfile.split('\\n');\n const index = lines.findIndex((line) =>\n CIO_PODFILE_POST_INSTALL_REGEX.test(line)\n );\n let content: string[] = lines;\n if (index > -1) {\n content = [\n ...lines.slice(0, index - 1),\n !matches ? CIO_PODFILE_SNIPPET : '',\n ...lines.slice(index - 1),\n ];\n }\n\n FileManagement.write(filename, content.join('\\n'));\n } else {\n console.log('Customerio Podfile snippets already exists. Skipping...');\n }\n}\n\nexport async function injectCIONotificationPodfileCode(\n iosPath: string,\n useFrameworks: CustomerIOPluginOptionsIOS['useFrameworks']\n) {\n const filename = `${iosPath}/Podfile`;\n const podfile = await FileManagement.read(filename);\n const matches = podfile.match(CIO_PODFILE_NOTIFICATION_REGEX);\n\n if (!matches) {\n const snippet =\n useFrameworks === 'static'\n ? CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET\n : CIO_PODFILE_NOTIFICATION_SNIPPET;\n FileManagement.append(filename, snippet);\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AASA,IAAAC,eAAA,GAAAD,OAAA;AAEO,eAAeE,oBAAoBA,CAACC,OAAe,EAAE;EAC1D,MAAMC,QAAQ,GAAI,GAAED,OAAQ,UAAS;EACrC,MAAME,OAAO,GAAG,MAAMC,8BAAc,CAACC,IAAI,CAACH,QAAQ,CAAC;EACnD,MAAMI,OAAO,GAAGH,OAAO,CAACI,KAAK,CAACC,sBAAiB,CAAC;EAChD,MAAMC,WAAW,GAAGN,OAAO,CAACI,KAAK,CAACG,yBAAoB,CAAC;EAEvD,IAAI,CAACD,WAAW,EAAE;IAChB,MAAME,KAAK,GAAGR,OAAO,CAACS,KAAK,CAAC,IAAI,CAAC;IACjC,MAAMC,KAAK,GAAGF,KAAK,CAACG,SAAS,CAAEC,IAAI,IACjCC,mCAA8B,CAACC,IAAI,CAACF,IAAI,CAC1C,CAAC;IACD,IAAIG,OAAiB,GAAGP,KAAK;IAC7B,IAAIE,KAAK,GAAG,CAAC,CAAC,EAAE;MACdK,OAAO,GAAG,CACR,GAAGP,KAAK,CAACQ,KAAK,CAAC,CAAC,EAAEN,KAAK,GAAG,CAAC,CAAC,EAC5B,CAACP,OAAO,GAAGc,wBAAmB,GAAG,EAAE,EACnC,GAAGT,KAAK,CAACQ,KAAK,CAACN,KAAK,GAAG,CAAC,CAAC,CAC1B;IACH;IAEAT,8BAAc,CAACiB,KAAK,CAACnB,QAAQ,EAAEgB,OAAO,CAACI,IAAI,CAAC,IAAI,CAAC,CAAC;EACpD,CAAC,MAAM;IACLC,OAAO,CAACC,GAAG,CAAC,yDAAyD,CAAC;EACxE;AACF;AAEO,eAAeC,gCAAgCA,CACpDxB,OAAe,EACfyB,aAA0D,EAC1D;EACA,MAAMxB,QAAQ,GAAI,GAAED,OAAQ,UAAS;EACrC,MAAME,OAAO,GAAG,MAAMC,8BAAc,CAACC,IAAI,CAACH,QAAQ,CAAC;EACnD,MAAMI,OAAO,GAAGH,OAAO,CAACI,KAAK,CAACoB,mCAA8B,CAAC;EAE7D,IAAI,CAACrB,OAAO,EAAE;IACZ,MAAMsB,OAAO,GACXF,aAAa,KAAK,QAAQ,GACtBG,sDAAiD,GACjDC,qCAAgC;IACtC1B,8BAAc,CAAC2B,MAAM,CAAC7B,QAAQ,EAAE0B,OAAO,CAAC;EAC1C;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withCustomerIOPlugin","config","props","ios","withCIOIos","android","withCIOAndroid"],"sources":["index.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport { withCIOAndroid } from './android/withCIOAndroid';\nimport { withCIOIos } from './ios/withCIOIos';\nimport type { CustomerIOPluginOptions } from './types/cio-types';\n\n// Entry point for config plugin\nfunction withCustomerIOPlugin(\n config: ExpoConfig,\n props: CustomerIOPluginOptions\n) {\n if (props.ios) {\n config = withCIOIos(config, props.ios);\n }\n\n if (props.android) {\n config = withCIOAndroid(config, props.android);\n }\n\n return config;\n}\n\nexport default withCustomerIOPlugin;\n"],"mappings":";;;;;;AAEA;AACA;AAGA;AACA,
|
|
1
|
+
{"version":3,"names":["_withCIOAndroid","require","_withCIOIos","withCustomerIOPlugin","config","props","ios","withCIOIos","android","withCIOAndroid","_default","exports","default"],"sources":["index.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport { withCIOAndroid } from './android/withCIOAndroid';\nimport { withCIOIos } from './ios/withCIOIos';\nimport type { CustomerIOPluginOptions } from './types/cio-types';\n\n// Entry point for config plugin\nfunction withCustomerIOPlugin(\n config: ExpoConfig,\n props: CustomerIOPluginOptions\n) {\n if (props.ios) {\n config = withCIOIos(config, props.ios);\n }\n\n if (props.android) {\n config = withCIOAndroid(config, props.android);\n }\n\n return config;\n}\n\nexport default withCustomerIOPlugin;\n"],"mappings":";;;;;;AAEA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAGA;AACA,SAASE,oBAAoBA,CAC3BC,MAAkB,EAClBC,KAA8B,EAC9B;EACA,IAAIA,KAAK,CAACC,GAAG,EAAE;IACbF,MAAM,GAAG,IAAAG,sBAAU,EAACH,MAAM,EAAEC,KAAK,CAACC,GAAG,CAAC;EACxC;EAEA,IAAID,KAAK,CAACG,OAAO,EAAE;IACjBJ,MAAM,GAAG,IAAAK,8BAAc,EAACL,MAAM,EAAEC,KAAK,CAACG,OAAO,CAAC;EAChD;EAEA,OAAOJ,MAAM;AACf;AAAC,IAAAM,QAAA,GAEcP,oBAAoB;AAAAQ,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -39,7 +39,7 @@ const addDidFailToRegisterForRemoteNotificationsWithError = stringContents => {
|
|
|
39
39
|
stringContents = (0, _codeInjection.injectCodeByMultiLineRegexAndReplaceLine)(stringContents, _ios.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX, _ios.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET);
|
|
40
40
|
return stringContents;
|
|
41
41
|
};
|
|
42
|
-
const
|
|
42
|
+
const addDidRegisterForRemoteNotificationsWithDeviceToken = stringContents => {
|
|
43
43
|
stringContents = (0, _codeInjection.injectCodeByMultiLineRegexAndReplaceLine)(stringContents, _ios.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX, _ios.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET);
|
|
44
44
|
return stringContents;
|
|
45
45
|
};
|
|
@@ -51,7 +51,7 @@ const addAppdelegateHeaderModification = stringContents => {
|
|
|
51
51
|
stringContents = (0, _codeInjection.injectCodeByMultiLineRegexAndReplaceLine)(stringContents, _ios.CIO_APPDELEGATEHEADER_REGEX, _ios.CIO_APPDELEGATEHEADER_SNIPPET);
|
|
52
52
|
return stringContents;
|
|
53
53
|
};
|
|
54
|
-
const withAppDelegateModifications = configOuter => {
|
|
54
|
+
const withAppDelegateModifications = (configOuter, props) => {
|
|
55
55
|
return (0, _configPlugins.withAppDelegate)(configOuter, async config => {
|
|
56
56
|
let stringContents = config.modResults.contents;
|
|
57
57
|
const regex = new RegExp(`#import <${config.modRequest.projectName}-Swift.h>`);
|
|
@@ -63,10 +63,14 @@ const withAppDelegateModifications = configOuter => {
|
|
|
63
63
|
_fileManagement.FileManagement.write(headerPath, headerContent);
|
|
64
64
|
stringContents = addImport(stringContents, config.modRequest.projectName);
|
|
65
65
|
stringContents = addNotificationHandlerDeclaration(stringContents);
|
|
66
|
-
|
|
66
|
+
|
|
67
|
+
// any other value would be treated as true, it has to be explicitly false to disable
|
|
68
|
+
if (props.disableNotificationRegistration !== undefined && props.disableNotificationRegistration === false) {
|
|
69
|
+
stringContents = addNotificationConfiguration(stringContents);
|
|
70
|
+
}
|
|
67
71
|
stringContents = addAdditionalMethodsForPushNotifications(stringContents);
|
|
68
72
|
stringContents = addDidFailToRegisterForRemoteNotificationsWithError(stringContents);
|
|
69
|
-
stringContents =
|
|
73
|
+
stringContents = addDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);
|
|
70
74
|
config.modResults.contents = stringContents;
|
|
71
75
|
} else {
|
|
72
76
|
console.log('Customerio AppDelegate changes already exist. Skipping...');
|