customerio-expo-plugin 2.5.0 → 2.7.0
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/package.json +13 -31
- package/plugin/app.plugin.js +1 -1
- package/plugin/lib/commonjs/android/withAndroidManifestUpdates.js +56 -15
- package/plugin/lib/commonjs/android/withAndroidManifestUpdates.js.map +1 -1
- package/plugin/lib/commonjs/android/withCIOAndroid.js +7 -2
- package/plugin/lib/commonjs/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/commonjs/android/withGoogleServicesJSON.js +1 -1
- package/plugin/lib/commonjs/android/withGoogleServicesJSON.js.map +1 -1
- package/plugin/lib/commonjs/android/withMainApplicationModifications.js +45 -0
- package/plugin/lib/commonjs/android/withMainApplicationModifications.js.map +1 -0
- package/plugin/lib/commonjs/android/withNotificationChannelMetadata.js +1 -1
- package/plugin/lib/commonjs/android/withNotificationChannelMetadata.js.map +1 -1
- package/plugin/lib/commonjs/android/withProjectStrings.js +14 -7
- package/plugin/lib/commonjs/android/withProjectStrings.js.map +1 -1
- package/plugin/lib/commonjs/helpers/constants/android.js +7 -1
- package/plugin/lib/commonjs/helpers/constants/android.js.map +1 -1
- package/plugin/lib/commonjs/helpers/constants/common.js +18 -0
- package/plugin/lib/commonjs/helpers/constants/common.js.map +1 -0
- package/plugin/lib/commonjs/helpers/constants/ios.js +7 -7
- package/plugin/lib/commonjs/helpers/constants/ios.js.map +1 -1
- package/plugin/lib/commonjs/helpers/native-files/android/CustomerIOSDKInitializer.kt +64 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/CustomerIOSDKInitializer.swift +54 -0
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +2 -2
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/commonjs/helpers/utils/patchPluginNativeCode.js +62 -0
- package/plugin/lib/commonjs/helpers/utils/patchPluginNativeCode.js.map +1 -0
- package/plugin/lib/commonjs/index.js +13 -2
- package/plugin/lib/commonjs/index.js.map +1 -1
- package/plugin/lib/commonjs/ios/utils.js +1 -1
- package/plugin/lib/commonjs/ios/utils.js.map +1 -1
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js +1 -1
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -1
- package/plugin/lib/commonjs/ios/withCIOIos.js +17 -11
- package/plugin/lib/commonjs/ios/withCIOIos.js.map +1 -1
- package/plugin/lib/commonjs/ios/withCIOIosSwift.js +133 -49
- package/plugin/lib/commonjs/ios/withCIOIosSwift.js.map +1 -1
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js +1 -1
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js.map +1 -1
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js +17 -19
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/commonjs/ios/withXcodeProject.js +1 -1
- package/plugin/lib/commonjs/ios/withXcodeProject.js.map +1 -1
- package/plugin/lib/commonjs/postInstallHelper.js.map +1 -1
- package/plugin/lib/commonjs/types/cio-types.js.map +1 -1
- package/plugin/lib/commonjs/utils/android.js +109 -0
- package/plugin/lib/commonjs/utils/android.js.map +1 -0
- package/plugin/lib/commonjs/utils/config.js +43 -0
- package/plugin/lib/commonjs/utils/config.js.map +1 -0
- package/plugin/lib/commonjs/utils/plugin.js +49 -0
- package/plugin/lib/commonjs/utils/plugin.js.map +1 -0
- package/plugin/lib/commonjs/utils/validation.js +44 -0
- package/plugin/lib/commonjs/utils/validation.js.map +1 -0
- package/plugin/lib/commonjs/utils/xcode.js +67 -0
- package/plugin/lib/commonjs/utils/xcode.js.map +1 -0
- package/plugin/lib/module/android/withAndroidManifestUpdates.js +55 -14
- package/plugin/lib/module/android/withAndroidManifestUpdates.js.map +1 -1
- package/plugin/lib/module/android/withCIOAndroid.js +7 -2
- package/plugin/lib/module/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/module/android/withGoogleServicesJSON.js +1 -1
- package/plugin/lib/module/android/withGoogleServicesJSON.js.map +1 -1
- package/plugin/lib/module/android/withMainApplicationModifications.js +38 -0
- package/plugin/lib/module/android/withMainApplicationModifications.js.map +1 -0
- package/plugin/lib/module/android/withNotificationChannelMetadata.js +1 -1
- package/plugin/lib/module/android/withNotificationChannelMetadata.js.map +1 -1
- package/plugin/lib/module/android/withProjectStrings.js +13 -6
- package/plugin/lib/module/android/withProjectStrings.js.map +1 -1
- package/plugin/lib/module/helpers/constants/android.js +6 -0
- package/plugin/lib/module/helpers/constants/android.js.map +1 -1
- package/plugin/lib/module/helpers/constants/common.js +12 -0
- package/plugin/lib/module/helpers/constants/common.js.map +1 -0
- package/plugin/lib/module/helpers/constants/ios.js +6 -6
- package/plugin/lib/module/helpers/constants/ios.js.map +1 -1
- package/plugin/lib/module/helpers/native-files/android/CustomerIOSDKInitializer.kt +64 -0
- package/plugin/lib/module/helpers/native-files/ios/CustomerIOSDKInitializer.swift +54 -0
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js +2 -2
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/module/helpers/utils/patchPluginNativeCode.js +57 -0
- package/plugin/lib/module/helpers/utils/patchPluginNativeCode.js.map +1 -0
- package/plugin/lib/module/index.js +14 -2
- package/plugin/lib/module/index.js.map +1 -1
- package/plugin/lib/module/ios/utils.js +1 -2
- package/plugin/lib/module/ios/utils.js.map +1 -1
- package/plugin/lib/module/ios/withAppDelegateModifications.js +3 -3
- package/plugin/lib/module/ios/withAppDelegateModifications.js.map +1 -1
- package/plugin/lib/module/ios/withCIOIos.js +17 -11
- package/plugin/lib/module/ios/withCIOIos.js.map +1 -1
- package/plugin/lib/module/ios/withCIOIosSwift.js +134 -50
- package/plugin/lib/module/ios/withCIOIosSwift.js.map +1 -1
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js +2 -2
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js.map +1 -1
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js +18 -20
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/module/ios/withXcodeProject.js +1 -1
- package/plugin/lib/module/ios/withXcodeProject.js.map +1 -1
- package/plugin/lib/module/postInstallHelper.js.map +1 -1
- package/plugin/lib/module/types/cio-types.js.map +1 -1
- package/plugin/lib/module/utils/android.js +100 -0
- package/plugin/lib/module/utils/android.js.map +1 -0
- package/plugin/lib/module/utils/config.js +38 -0
- package/plugin/lib/module/utils/config.js.map +1 -0
- package/plugin/lib/module/utils/plugin.js +38 -0
- package/plugin/lib/module/utils/plugin.js.map +1 -0
- package/plugin/lib/module/utils/validation.js +39 -0
- package/plugin/lib/module/utils/validation.js.map +1 -0
- package/plugin/lib/module/utils/xcode.js +60 -0
- package/plugin/lib/module/utils/xcode.js.map +1 -0
- package/plugin/lib/typescript/android/withAndroidManifestUpdates.d.ts +1 -0
- package/plugin/lib/typescript/android/withCIOAndroid.d.ts +2 -2
- package/plugin/lib/typescript/android/withMainApplicationModifications.d.ts +3 -0
- package/plugin/lib/typescript/android/withProjectStrings.d.ts +2 -1
- package/plugin/lib/typescript/helpers/constants/android.d.ts +3 -0
- package/plugin/lib/typescript/helpers/constants/common.d.ts +11 -0
- package/plugin/lib/typescript/helpers/constants/ios.d.ts +3 -1
- package/plugin/lib/typescript/helpers/utils/patchPluginNativeCode.d.ts +7 -0
- package/plugin/lib/typescript/ios/utils.d.ts +2 -2
- package/plugin/lib/typescript/ios/withCIOIos.d.ts +2 -2
- package/plugin/lib/typescript/ios/withCIOIosSwift.d.ts +3 -3
- package/plugin/lib/typescript/types/cio-types.d.ts +46 -6
- package/plugin/lib/typescript/utils/android.d.ts +5 -0
- package/plugin/lib/typescript/utils/config.d.ts +8 -0
- package/plugin/lib/typescript/utils/plugin.d.ts +4 -0
- package/plugin/lib/typescript/utils/validation.d.ts +3 -0
- package/plugin/lib/typescript/utils/xcode.d.ts +28 -0
- package/plugin/src/android/withAndroidManifestUpdates.ts +70 -21
- package/plugin/src/android/withCIOAndroid.ts +8 -2
- package/plugin/src/android/withGoogleServicesJSON.ts +2 -2
- package/plugin/src/android/withMainApplicationModifications.ts +50 -0
- package/plugin/src/android/withNotificationChannelMetadata.ts +7 -3
- package/plugin/src/android/withProjectStrings.ts +20 -10
- package/plugin/src/helpers/constants/android.ts +7 -0
- package/plugin/src/helpers/constants/common.ts +12 -0
- package/plugin/src/helpers/constants/ios.ts +11 -13
- package/plugin/src/helpers/native-files/android/CustomerIOSDKInitializer.kt +64 -0
- package/plugin/src/helpers/native-files/ios/CustomerIOSDKInitializer.swift +54 -0
- package/plugin/src/helpers/utils/injectCIOPodfileCode.ts +8 -7
- package/plugin/src/helpers/utils/patchPluginNativeCode.ts +97 -0
- package/plugin/src/index.ts +18 -2
- package/plugin/src/ios/utils.ts +5 -5
- package/plugin/src/ios/withAppDelegateModifications.ts +11 -8
- package/plugin/src/ios/withCIOIos.ts +19 -11
- package/plugin/src/ios/withCIOIosSwift.ts +195 -73
- package/plugin/src/ios/withGoogleServicesJsonFile.ts +7 -10
- package/plugin/src/ios/withNotificationsXcodeProject.ts +25 -26
- package/plugin/src/ios/withXcodeProject.ts +1 -1
- package/plugin/src/postInstallHelper.js +1 -1
- package/plugin/src/types/cio-types.ts +48 -8
- package/plugin/src/utils/android.ts +112 -0
- package/plugin/src/utils/config.ts +53 -0
- package/plugin/src/utils/plugin.ts +46 -0
- package/plugin/src/utils/validation.ts +54 -0
- package/plugin/src/utils/xcode.ts +74 -0
- package/plugin/lib/commonjs/helpers/constants/globals.d.js +0 -2
- package/plugin/lib/commonjs/helpers/constants/globals.d.js.map +0 -1
- package/plugin/lib/commonjs/helpers/utils/pluginUtils.js +0 -26
- package/plugin/lib/commonjs/helpers/utils/pluginUtils.js.map +0 -1
- package/plugin/lib/module/helpers/constants/globals.d.js +0 -2
- package/plugin/lib/module/helpers/constants/globals.d.js.map +0 -1
- package/plugin/lib/module/helpers/utils/pluginUtils.js +0 -19
- package/plugin/lib/module/helpers/utils/pluginUtils.js.map +0 -1
- package/plugin/lib/typescript/helpers/utils/pluginUtils.d.ts +0 -4
- package/plugin/src/helpers/constants/globals.d.ts +0 -8
- package/plugin/src/helpers/utils/pluginUtils.ts +0 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "customerio-expo-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Expo config plugin for the Customer IO React Native SDK",
|
|
5
5
|
"main": "plugin/lib/commonjs/index",
|
|
6
6
|
"module": "plugin/lib/module/index",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"build": "npm run clean && tsc",
|
|
23
23
|
"clean": "rm -rf lib",
|
|
24
24
|
"expo-module": "expo-module",
|
|
25
|
-
"lint": "eslint
|
|
25
|
+
"lint": "eslint plugin --config plugin/eslint.config.js",
|
|
26
|
+
"lint:fix": "npm run lint -- --fix",
|
|
26
27
|
"typescript": "tsc --noEmit",
|
|
27
28
|
"prepare": "npm run clean && bob build",
|
|
28
29
|
"postinstall": "node plugin/src/postInstall.js",
|
|
@@ -36,7 +37,8 @@
|
|
|
36
37
|
"test-plugin": "bash scripts/test-plugin.sh",
|
|
37
38
|
"cleanAll": "bash scripts/clean-all.sh",
|
|
38
39
|
"buildAll": "bash scripts/build-all.sh",
|
|
39
|
-
"cleanAndBuildAll": "npm run cleanAll && npm run buildAll"
|
|
40
|
+
"cleanAndBuildAll": "npm run cleanAll && npm run buildAll",
|
|
41
|
+
"generate-api-docs": "bash scripts/generate-api-docs.sh"
|
|
40
42
|
},
|
|
41
43
|
"keywords": [
|
|
42
44
|
"react-native",
|
|
@@ -53,26 +55,25 @@
|
|
|
53
55
|
"registry": "https://registry.npmjs.org/"
|
|
54
56
|
},
|
|
55
57
|
"peerDependencies": {
|
|
56
|
-
"customerio-reactnative": "4.
|
|
58
|
+
"customerio-reactnative": "4.8.0"
|
|
57
59
|
},
|
|
58
60
|
"devDependencies": {
|
|
61
|
+
"@eslint/js": "^9.33.0",
|
|
59
62
|
"@expo/config-plugins": "^10.0.0",
|
|
60
63
|
"@expo/config-types": "^53.0.0",
|
|
64
|
+
"@microsoft/api-extractor": "^7.52.9",
|
|
61
65
|
"@types/jest": "^29.5.14",
|
|
62
|
-
"
|
|
63
|
-
"@typescript-eslint/parser": "^5.21.0",
|
|
64
|
-
"eslint": "^8.14.0",
|
|
65
|
-
"eslint-config-prettier": "^8.5.0",
|
|
66
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
66
|
+
"eslint": "^9.17.0",
|
|
67
67
|
"expo-build-properties": "^0.14.6",
|
|
68
|
-
"expo-module-scripts": "^3.
|
|
68
|
+
"expo-module-scripts": "^3.5.4",
|
|
69
69
|
"gradle-to-js": "^2.0.1",
|
|
70
70
|
"jest": "^29.2.1",
|
|
71
71
|
"jest-environment-jsdom": "^29.7.0",
|
|
72
|
-
"prettier": "^2.
|
|
72
|
+
"prettier": "^2.8.8",
|
|
73
73
|
"react-native-builder-bob": "^0.18.3",
|
|
74
74
|
"ts-jest": "^29.2.5",
|
|
75
|
-
"typescript": "^5.
|
|
75
|
+
"typescript": "^5.9.2",
|
|
76
|
+
"typescript-eslint": "^8.39.0",
|
|
76
77
|
"xcode": "^3.0.1"
|
|
77
78
|
},
|
|
78
79
|
"commitlint": {
|
|
@@ -80,25 +81,6 @@
|
|
|
80
81
|
"@commitlint/config-conventional"
|
|
81
82
|
]
|
|
82
83
|
},
|
|
83
|
-
"eslintConfig": {
|
|
84
|
-
"root": true,
|
|
85
|
-
"extends": [
|
|
86
|
-
"@react-native-community",
|
|
87
|
-
"prettier"
|
|
88
|
-
],
|
|
89
|
-
"rules": {
|
|
90
|
-
"prettier/prettier": [
|
|
91
|
-
"error",
|
|
92
|
-
{
|
|
93
|
-
"quoteProps": "consistent",
|
|
94
|
-
"singleQuote": true,
|
|
95
|
-
"tabWidth": 2,
|
|
96
|
-
"trailingComma": "es5",
|
|
97
|
-
"useTabs": false
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
84
|
"eslintIgnore": [
|
|
103
85
|
"node_modules/",
|
|
104
86
|
"plugin/lib/"
|
package/plugin/app.plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require(
|
|
1
|
+
module.exports = require('./lib/commonjs/index');
|
|
@@ -3,31 +3,72 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.withAndroidManifestUpdates = void 0;
|
|
6
|
+
exports.withAndroidManifestUpdates = exports.DEFAULT_LOW_PRIORITY = void 0;
|
|
7
7
|
var _configPlugins = require("@expo/config-plugins");
|
|
8
|
-
|
|
8
|
+
// Default low priority for Firebase messaging service when setHighPriorityPushHandler is false
|
|
9
|
+
const DEFAULT_LOW_PRIORITY = exports.DEFAULT_LOW_PRIORITY = -10;
|
|
10
|
+
const withAndroidManifestUpdates = (configOuter, options) => {
|
|
9
11
|
return (0, _configPlugins.withAndroidManifest)(configOuter, props => {
|
|
10
12
|
const application = props.modResults.manifest.application;
|
|
11
13
|
const customerIOMessagingpush = 'io.customer.messagingpush.CustomerIOFirebaseMessagingService';
|
|
12
|
-
if (!application[0]
|
|
13
|
-
application[0]
|
|
14
|
+
if (!application[0].service) {
|
|
15
|
+
application[0].service = [];
|
|
14
16
|
}
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
|
|
17
|
+
const existingServiceIndex = application[0].service.findIndex(service => service.$['android:name'] === customerIOMessagingpush);
|
|
18
|
+
if (existingServiceIndex === -1) {
|
|
19
|
+
// Intent filter structure for Firebase messaging service
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
+
const intentFilter = {
|
|
22
|
+
action: [{
|
|
23
|
+
$: {
|
|
24
|
+
'android:name': 'com.google.firebase.MESSAGING_EVENT'
|
|
25
|
+
}
|
|
26
|
+
}]
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// Handle priority based on setHighPriorityPushHandler value
|
|
30
|
+
if (options.setHighPriorityPushHandler === true) {
|
|
31
|
+
// High priority - no priority attribute means default high priority
|
|
32
|
+
console.log('Successfully set CustomerIO push handler as high priority in AndroidManifest.xml');
|
|
33
|
+
} else if (options.setHighPriorityPushHandler === false) {
|
|
34
|
+
// Low priority - set fixed priority
|
|
35
|
+
intentFilter.$ = {
|
|
36
|
+
'android:priority': DEFAULT_LOW_PRIORITY.toString()
|
|
37
|
+
};
|
|
38
|
+
console.log(`Successfully set CustomerIO push handler as low priority (${DEFAULT_LOW_PRIORITY}) in AndroidManifest.xml`);
|
|
39
|
+
}
|
|
40
|
+
application[0].service.push({
|
|
18
41
|
'$': {
|
|
19
42
|
'android:name': customerIOMessagingpush,
|
|
20
43
|
'android:exported': 'false'
|
|
21
44
|
},
|
|
22
|
-
'intent-filter': [
|
|
23
|
-
action: [{
|
|
24
|
-
$: {
|
|
25
|
-
'android:name': 'com.google.firebase.MESSAGING_EVENT'
|
|
26
|
-
}
|
|
27
|
-
}]
|
|
28
|
-
}]
|
|
45
|
+
'intent-filter': [intentFilter]
|
|
29
46
|
});
|
|
30
|
-
|
|
47
|
+
} else if (options.setHighPriorityPushHandler === true) {
|
|
48
|
+
// Service exists, need to ensure it becomes high priority (remove priority attribute)
|
|
49
|
+
const existingService = application[0].service[existingServiceIndex];
|
|
50
|
+
if (existingService['intent-filter'] && existingService['intent-filter'].length > 0) {
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
|
+
const intentFilter = existingService['intent-filter'][0];
|
|
53
|
+
if (intentFilter.$ && intentFilter.$['android:priority']) {
|
|
54
|
+
delete intentFilter.$['android:priority'];
|
|
55
|
+
console.log('Successfully updated existing CustomerIO push handler to high priority in AndroidManifest.xml');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} else if (options.setHighPriorityPushHandler === false) {
|
|
59
|
+
// Service exists, update to low priority
|
|
60
|
+
const existingService = application[0].service[existingServiceIndex];
|
|
61
|
+
|
|
62
|
+
// Update existing service intent-filter with fixed priority
|
|
63
|
+
if (existingService['intent-filter'] && existingService['intent-filter'].length > 0) {
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
|
+
const intentFilter = existingService['intent-filter'][0];
|
|
66
|
+
if (!intentFilter.$) {
|
|
67
|
+
intentFilter.$ = {};
|
|
68
|
+
}
|
|
69
|
+
intentFilter.$['android:priority'] = DEFAULT_LOW_PRIORITY.toString();
|
|
70
|
+
console.log(`Successfully updated existing CustomerIO push handler to low priority (${DEFAULT_LOW_PRIORITY}) in AndroidManifest.xml`);
|
|
71
|
+
}
|
|
31
72
|
}
|
|
32
73
|
props.modResults.manifest.application = application;
|
|
33
74
|
return props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_configPlugins","require","withAndroidManifestUpdates","configOuter","withAndroidManifest","props","application","modResults","manifest","customerIOMessagingpush","
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","DEFAULT_LOW_PRIORITY","exports","withAndroidManifestUpdates","configOuter","options","withAndroidManifest","props","application","modResults","manifest","customerIOMessagingpush","service","existingServiceIndex","findIndex","$","intentFilter","action","setHighPriorityPushHandler","console","log","toString","push","existingService","length"],"sources":["withAndroidManifestUpdates.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\n// Default low priority for Firebase messaging service when setHighPriorityPushHandler is false\nexport const DEFAULT_LOW_PRIORITY = -10;\n\n\nexport const withAndroidManifestUpdates: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter, options) => {\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 existingServiceIndex = application[0].service.findIndex(\n (service) => service.$['android:name'] === customerIOMessagingpush\n );\n\n if (existingServiceIndex === -1) {\n // Intent filter structure for Firebase messaging service\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const intentFilter: any = {\n action: [\n {\n $: {\n 'android:name': 'com.google.firebase.MESSAGING_EVENT',\n },\n },\n ],\n };\n\n // Handle priority based on setHighPriorityPushHandler value\n if (options.setHighPriorityPushHandler === true) {\n // High priority - no priority attribute means default high priority\n console.log(\n 'Successfully set CustomerIO push handler as high priority in AndroidManifest.xml'\n );\n } else if (options.setHighPriorityPushHandler === false) {\n // Low priority - set fixed priority\n intentFilter.$ = {\n 'android:priority': DEFAULT_LOW_PRIORITY.toString(),\n };\n console.log(\n `Successfully set CustomerIO push handler as low priority (${DEFAULT_LOW_PRIORITY}) in AndroidManifest.xml`\n );\n }\n\n application[0].service.push({\n '$': {\n 'android:name': customerIOMessagingpush,\n 'android:exported': 'false',\n },\n 'intent-filter': [intentFilter],\n });\n } else if (options.setHighPriorityPushHandler === true) {\n // Service exists, need to ensure it becomes high priority (remove priority attribute)\n const existingService = application[0].service[existingServiceIndex];\n\n if (existingService['intent-filter'] && existingService['intent-filter'].length > 0) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const intentFilter = existingService['intent-filter'][0] as any;\n if (intentFilter.$ && intentFilter.$['android:priority']) {\n delete intentFilter.$['android:priority'];\n console.log(\n 'Successfully updated existing CustomerIO push handler to high priority in AndroidManifest.xml'\n );\n }\n }\n } else if (options.setHighPriorityPushHandler === false) {\n // Service exists, update to low priority\n const existingService = application[0].service[existingServiceIndex];\n\n // Update existing service intent-filter with fixed priority\n if (existingService['intent-filter'] && existingService['intent-filter'].length > 0) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const intentFilter = existingService['intent-filter'][0] as any;\n if (!intentFilter.$) {\n intentFilter.$ = {};\n }\n intentFilter.$['android:priority'] = DEFAULT_LOW_PRIORITY.toString();\n console.log(\n `Successfully updated existing CustomerIO push handler to low priority (${DEFAULT_LOW_PRIORITY}) in AndroidManifest.xml`\n );\n }\n }\n\n props.modResults.manifest.application = application;\n return props;\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAKA;AACO,MAAMC,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,CAAC,EAAE;AAGhC,MAAME,0BAEZ,GAAGA,CAACC,WAAW,EAAEC,OAAO,KAAK;EAC5B,OAAO,IAAAC,kCAAmB,EAACF,WAAW,EAAGG,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,CAACI,OAAO,EAAE;MAC3BJ,WAAW,CAAC,CAAC,CAAC,CAACI,OAAO,GAAG,EAAE;IAC7B;IAEA,MAAMC,oBAAoB,GAAGL,WAAW,CAAC,CAAC,CAAC,CAACI,OAAO,CAACE,SAAS,CAC1DF,OAAO,IAAKA,OAAO,CAACG,CAAC,CAAC,cAAc,CAAC,KAAKJ,uBAC7C,CAAC;IAED,IAAIE,oBAAoB,KAAK,CAAC,CAAC,EAAE;MAC/B;MACA;MACA,MAAMG,YAAiB,GAAG;QACxBC,MAAM,EAAE,CACN;UACEF,CAAC,EAAE;YACD,cAAc,EAAE;UAClB;QACF,CAAC;MAEL,CAAC;;MAED;MACA,IAAIV,OAAO,CAACa,0BAA0B,KAAK,IAAI,EAAE;QAC/C;QACAC,OAAO,CAACC,GAAG,CACT,kFACF,CAAC;MACH,CAAC,MAAM,IAAIf,OAAO,CAACa,0BAA0B,KAAK,KAAK,EAAE;QACvD;QACAF,YAAY,CAACD,CAAC,GAAG;UACf,kBAAkB,EAAEd,oBAAoB,CAACoB,QAAQ,CAAC;QACpD,CAAC;QACDF,OAAO,CAACC,GAAG,CACT,6DAA6DnB,oBAAoB,0BACnF,CAAC;MACH;MAEAO,WAAW,CAAC,CAAC,CAAC,CAACI,OAAO,CAACU,IAAI,CAAC;QAC1B,GAAG,EAAE;UACH,cAAc,EAAEX,uBAAuB;UACvC,kBAAkB,EAAE;QACtB,CAAC;QACD,eAAe,EAAE,CAACK,YAAY;MAChC,CAAC,CAAC;IACJ,CAAC,MAAM,IAAIX,OAAO,CAACa,0BAA0B,KAAK,IAAI,EAAE;MACtD;MACA,MAAMK,eAAe,GAAGf,WAAW,CAAC,CAAC,CAAC,CAACI,OAAO,CAACC,oBAAoB,CAAC;MAEpE,IAAIU,eAAe,CAAC,eAAe,CAAC,IAAIA,eAAe,CAAC,eAAe,CAAC,CAACC,MAAM,GAAG,CAAC,EAAE;QACnF;QACA,MAAMR,YAAY,GAAGO,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC,CAAQ;QAC/D,IAAIP,YAAY,CAACD,CAAC,IAAIC,YAAY,CAACD,CAAC,CAAC,kBAAkB,CAAC,EAAE;UACxD,OAAOC,YAAY,CAACD,CAAC,CAAC,kBAAkB,CAAC;UACzCI,OAAO,CAACC,GAAG,CACT,+FACF,CAAC;QACH;MACF;IACF,CAAC,MAAM,IAAIf,OAAO,CAACa,0BAA0B,KAAK,KAAK,EAAE;MACvD;MACA,MAAMK,eAAe,GAAGf,WAAW,CAAC,CAAC,CAAC,CAACI,OAAO,CAACC,oBAAoB,CAAC;;MAEpE;MACA,IAAIU,eAAe,CAAC,eAAe,CAAC,IAAIA,eAAe,CAAC,eAAe,CAAC,CAACC,MAAM,GAAG,CAAC,EAAE;QACnF;QACA,MAAMR,YAAY,GAAGO,eAAe,CAAC,eAAe,CAAC,CAAC,CAAC,CAAQ;QAC/D,IAAI,CAACP,YAAY,CAACD,CAAC,EAAE;UACnBC,YAAY,CAACD,CAAC,GAAG,CAAC,CAAC;QACrB;QACAC,YAAY,CAACD,CAAC,CAAC,kBAAkB,CAAC,GAAGd,oBAAoB,CAACoB,QAAQ,CAAC,CAAC;QACpEF,OAAO,CAACC,GAAG,CACT,0EAA0EnB,oBAAoB,0BAChG,CAAC;MACH;IACF;IAEAM,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACL,OAAA,CAAAC,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
@@ -8,22 +8,27 @@ var _withAndroidManifestUpdates = require("./withAndroidManifestUpdates");
|
|
|
8
8
|
var _withAppGoogleServices = require("./withAppGoogleServices");
|
|
9
9
|
var _withGistMavenRepository = require("./withGistMavenRepository");
|
|
10
10
|
var _withGoogleServicesJSON = require("./withGoogleServicesJSON");
|
|
11
|
+
var _withMainApplicationModifications = require("./withMainApplicationModifications");
|
|
11
12
|
var _withNotificationChannelMetadata = require("./withNotificationChannelMetadata");
|
|
12
13
|
var _withProjectGoogleServices = require("./withProjectGoogleServices");
|
|
13
14
|
var _withProjectStrings = require("./withProjectStrings");
|
|
14
|
-
function withCIOAndroid(config, props) {
|
|
15
|
+
function withCIOAndroid(config, sdkConfig, props) {
|
|
15
16
|
var _props$pushNotificati;
|
|
16
17
|
config = (0, _withGistMavenRepository.withGistMavenRepository)(config, props);
|
|
17
18
|
config = (0, _withProjectGoogleServices.withProjectGoogleServices)(config, props);
|
|
18
19
|
config = (0, _withAppGoogleServices.withAppGoogleServices)(config, props);
|
|
19
20
|
config = (0, _withGoogleServicesJSON.withGoogleServicesJSON)(config, props);
|
|
20
21
|
config = (0, _withProjectStrings.withProjectStrings)(config);
|
|
21
|
-
if (props.setHighPriorityPushHandler) {
|
|
22
|
+
if (props.setHighPriorityPushHandler !== undefined) {
|
|
22
23
|
config = (0, _withAndroidManifestUpdates.withAndroidManifestUpdates)(config, props);
|
|
23
24
|
}
|
|
24
25
|
if ((_props$pushNotificati = props.pushNotification) !== null && _props$pushNotificati !== void 0 && _props$pushNotificati.channel) {
|
|
25
26
|
config = (0, _withNotificationChannelMetadata.withNotificationChannelMetadata)(config, props);
|
|
26
27
|
}
|
|
28
|
+
// Add auto initialization if sdkConfig is provided
|
|
29
|
+
if (sdkConfig) {
|
|
30
|
+
config = (0, _withMainApplicationModifications.withMainApplicationModifications)(config, sdkConfig);
|
|
31
|
+
}
|
|
27
32
|
return config;
|
|
28
33
|
}
|
|
29
34
|
//# sourceMappingURL=withCIOAndroid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_withAndroidManifestUpdates","require","_withAppGoogleServices","_withGistMavenRepository","_withGoogleServicesJSON","_withNotificationChannelMetadata","_withProjectGoogleServices","_withProjectStrings","withCIOAndroid","config","props","_props$pushNotificati","withGistMavenRepository","withProjectGoogleServices","withAppGoogleServices","withGoogleServicesJSON","withProjectStrings","setHighPriorityPushHandler","withAndroidManifestUpdates","pushNotification","channel","withNotificationChannelMetadata"],"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 { withNotificationChannelMetadata } from './withNotificationChannelMetadata';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\nimport { withProjectStrings } from './withProjectStrings';\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 config = withProjectStrings(config);\n if (props.setHighPriorityPushHandler) {\n config = withAndroidManifestUpdates(config, props);\n }\n if (props.pushNotification?.channel) {\n config = withNotificationChannelMetadata(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,
|
|
1
|
+
{"version":3,"names":["_withAndroidManifestUpdates","require","_withAppGoogleServices","_withGistMavenRepository","_withGoogleServicesJSON","_withMainApplicationModifications","_withNotificationChannelMetadata","_withProjectGoogleServices","_withProjectStrings","withCIOAndroid","config","sdkConfig","props","_props$pushNotificati","withGistMavenRepository","withProjectGoogleServices","withAppGoogleServices","withGoogleServicesJSON","withProjectStrings","setHighPriorityPushHandler","undefined","withAndroidManifestUpdates","pushNotification","channel","withNotificationChannelMetadata","withMainApplicationModifications"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid, NativeSDKConfig } from '../types/cio-types';\nimport { withAndroidManifestUpdates } from './withAndroidManifestUpdates';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withMainApplicationModifications } from './withMainApplicationModifications';\nimport { withNotificationChannelMetadata } from './withNotificationChannelMetadata';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\nimport { withProjectStrings } from './withProjectStrings';\n\nexport function withCIOAndroid(\n config: ExpoConfig,\n sdkConfig: NativeSDKConfig | undefined,\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 config = withProjectStrings(config);\n if (props.setHighPriorityPushHandler !== undefined) {\n config = withAndroidManifestUpdates(config, props);\n }\n if (props.pushNotification?.channel) {\n config = withNotificationChannelMetadata(config, props);\n }\n // Add auto initialization if sdkConfig is provided\n if (sdkConfig) {\n config = withMainApplicationModifications(config, sdkConfig);\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,iCAAA,GAAAJ,OAAA;AACA,IAAAK,gCAAA,GAAAL,OAAA;AACA,IAAAM,0BAAA,GAAAN,OAAA;AACA,IAAAO,mBAAA,GAAAP,OAAA;AAEO,SAASQ,cAAcA,CAC5BC,MAAkB,EAClBC,SAAsC,EACtCC,KAAqC,EACzB;EAAA,IAAAC,qBAAA;EACZH,MAAM,GAAG,IAAAI,gDAAuB,EAACJ,MAAM,EAAEE,KAAK,CAAC;EAC/CF,MAAM,GAAG,IAAAK,oDAAyB,EAACL,MAAM,EAAEE,KAAK,CAAC;EACjDF,MAAM,GAAG,IAAAM,4CAAqB,EAACN,MAAM,EAAEE,KAAK,CAAC;EAC7CF,MAAM,GAAG,IAAAO,8CAAsB,EAACP,MAAM,EAAEE,KAAK,CAAC;EAC9CF,MAAM,GAAG,IAAAQ,sCAAkB,EAACR,MAAM,CAAC;EACnC,IAAIE,KAAK,CAACO,0BAA0B,KAAKC,SAAS,EAAE;IAClDV,MAAM,GAAG,IAAAW,sDAA0B,EAACX,MAAM,EAAEE,KAAK,CAAC;EACpD;EACA,KAAAC,qBAAA,GAAID,KAAK,CAACU,gBAAgB,cAAAT,qBAAA,eAAtBA,qBAAA,CAAwBU,OAAO,EAAE;IACnCb,MAAM,GAAG,IAAAc,gEAA+B,EAACd,MAAM,EAAEE,KAAK,CAAC;EACzD;EACA;EACA,IAAID,SAAS,EAAE;IACbD,MAAM,GAAG,IAAAe,kEAAgC,EAACf,MAAM,EAAEC,SAAS,CAAC;EAC9D;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
|
|
@@ -20,7 +20,7 @@ const withGoogleServicesJSON = (configOuter, cioProps) => {
|
|
|
20
20
|
if (googleServicesFile && _fileManagement.FileManagement.exists(googleServicesFile)) {
|
|
21
21
|
try {
|
|
22
22
|
_fileManagement.FileManagement.copyFile(googleServicesFile, `${androidPath}/app/google-services.json`);
|
|
23
|
-
} catch
|
|
23
|
+
} catch {
|
|
24
24
|
console.log(`There was an error copying your google-services.json file. You can copy it manually into ${androidPath}/app/google-services.json`);
|
|
25
25
|
}
|
|
26
26
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_configPlugins","require","_fileManagement","withGoogleServicesJSON","configOuter","cioProps","withProjectBuildGradle","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","FileManagement","exists","copyFile","
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_fileManagement","withGoogleServicesJSON","configOuter","cioProps","withProjectBuildGradle","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","FileManagement","exists","copyFile","console","log","exports"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withProjectBuildGradle } 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 {\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":";;;;;;AACA,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,CAAC,GAAGL,WAAW,2BAA2B,CAAC,EAAE;MACrE,IAAIG,kBAAkB,IAAIC,8BAAc,CAACC,MAAM,CAACF,kBAAkB,CAAC,EAAE;QACnE,IAAI;UACFC,8BAAc,CAACE,QAAQ,CACrBH,kBAAkB,EAClB,GAAGH,WAAW,2BAChB,CAAC;QACH,CAAC,CAAC,MAAM;UACNO,OAAO,CAACC,GAAG,CACT,4FAA4FR,WAAW,2BACzG,CAAC;QACH;MACF,CAAC,MAAM;QACLO,OAAO,CAACC,GAAG,CACT,wCAAwCL,kBAAkB,yDAAyDH,WAAW,2BAChI,CAAC;MACH;IACF,CAAC,MAAM;MACLO,OAAO,CAACC,GAAG,CACT,wBAAwBR,WAAW,wCACrC,CAAC;IACH;IAEA,OAAOF,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACW,OAAA,CAAAf,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withMainApplicationModifications = void 0;
|
|
7
|
+
var _configPlugins = require("@expo/config-plugins");
|
|
8
|
+
var _android = require("../helpers/constants/android");
|
|
9
|
+
var _common = require("../helpers/constants/common");
|
|
10
|
+
var _patchPluginNativeCode = require("../helpers/utils/patchPluginNativeCode");
|
|
11
|
+
var _android2 = require("../utils/android");
|
|
12
|
+
const withMainApplicationModifications = (configOuter, sdkConfig) => {
|
|
13
|
+
return (0, _configPlugins.withMainApplication)(configOuter, async config => {
|
|
14
|
+
const content = setupCustomerIOSDKInitializer(config, sdkConfig);
|
|
15
|
+
config.modResults.contents = content;
|
|
16
|
+
return config;
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Setup CustomerIOSDKInitializer for Android auto initialization
|
|
22
|
+
*/
|
|
23
|
+
exports.withMainApplicationModifications = withMainApplicationModifications;
|
|
24
|
+
const setupCustomerIOSDKInitializer = (config, sdkConfig) => {
|
|
25
|
+
const SDK_INITIALIZER_CLASS = 'CustomerIOSDKInitializer';
|
|
26
|
+
const SDK_INITIALIZER_PACKAGE = 'io.customer.sdk.expo';
|
|
27
|
+
const SDK_INITIALIZER_FILE = `${SDK_INITIALIZER_CLASS}.kt`;
|
|
28
|
+
const SDK_INITIALIZER_IMPORT = `import ${SDK_INITIALIZER_PACKAGE}.${SDK_INITIALIZER_CLASS}`;
|
|
29
|
+
let content = config.modResults.contents;
|
|
30
|
+
try {
|
|
31
|
+
// Always regenerate the CustomerIOSDKInitializer file to reflect config changes
|
|
32
|
+
(0, _android2.copyTemplateFile)(config, SDK_INITIALIZER_FILE, SDK_INITIALIZER_PACKAGE, content => (0, _patchPluginNativeCode.patchNativeSDKInitializer)(content, _common.PLATFORM.ANDROID, sdkConfig));
|
|
33
|
+
// Add import if not already present
|
|
34
|
+
content = (0, _android2.addImportToFile)(content, SDK_INITIALIZER_IMPORT);
|
|
35
|
+
// Add initialization code to onCreate if not already present
|
|
36
|
+
if (!content.includes(_android.CIO_NATIVE_SDK_INITIALIZE_CALL)) {
|
|
37
|
+
content = (0, _android2.addCodeToMethod)(content, _android.CIO_MAINAPPLICATION_ONCREATE_REGEX, _android.CIO_NATIVE_SDK_INITIALIZE_SNIPPET);
|
|
38
|
+
}
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.warn(`Could not setup ${SDK_INITIALIZER_CLASS}:`, error);
|
|
41
|
+
return config.modResults.contents;
|
|
42
|
+
}
|
|
43
|
+
return content;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=withMainApplicationModifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_android","_common","_patchPluginNativeCode","_android2","withMainApplicationModifications","configOuter","sdkConfig","withMainApplication","config","content","setupCustomerIOSDKInitializer","modResults","contents","exports","SDK_INITIALIZER_CLASS","SDK_INITIALIZER_PACKAGE","SDK_INITIALIZER_FILE","SDK_INITIALIZER_IMPORT","copyTemplateFile","patchNativeSDKInitializer","PLATFORM","ANDROID","addImportToFile","includes","CIO_NATIVE_SDK_INITIALIZE_CALL","addCodeToMethod","CIO_MAINAPPLICATION_ONCREATE_REGEX","CIO_NATIVE_SDK_INITIALIZE_SNIPPET","error","console","warn"],"sources":["withMainApplicationModifications.ts"],"sourcesContent":["import type { ConfigPlugin, ExportedConfigWithProps } from '@expo/config-plugins';\nimport { withMainApplication } from '@expo/config-plugins';\nimport type { ApplicationProjectFile } from '@expo/config-plugins/build/android/Paths';\nimport { CIO_MAINAPPLICATION_ONCREATE_REGEX, CIO_NATIVE_SDK_INITIALIZE_CALL, CIO_NATIVE_SDK_INITIALIZE_SNIPPET } from '../helpers/constants/android';\nimport { PLATFORM } from '../helpers/constants/common';\nimport { patchNativeSDKInitializer } from '../helpers/utils/patchPluginNativeCode';\nimport type { NativeSDKConfig } from '../types/cio-types';\nimport { addCodeToMethod, addImportToFile, copyTemplateFile } from '../utils/android';\n\nexport const withMainApplicationModifications: ConfigPlugin<NativeSDKConfig> = (configOuter, sdkConfig) => {\n return withMainApplication(configOuter, async (config) => {\n const content = setupCustomerIOSDKInitializer(config, sdkConfig);\n config.modResults.contents = content;\n return config;\n });\n};\n\n/**\n * Setup CustomerIOSDKInitializer for Android auto initialization\n */\nconst setupCustomerIOSDKInitializer = (\n config: ExportedConfigWithProps<ApplicationProjectFile>,\n sdkConfig: NativeSDKConfig,\n): string => {\n const SDK_INITIALIZER_CLASS = 'CustomerIOSDKInitializer';\n const SDK_INITIALIZER_PACKAGE = 'io.customer.sdk.expo';\n\n const SDK_INITIALIZER_FILE = `${SDK_INITIALIZER_CLASS}.kt`;\n const SDK_INITIALIZER_IMPORT = `import ${SDK_INITIALIZER_PACKAGE}.${SDK_INITIALIZER_CLASS}`;\n\n let content = config.modResults.contents;\n\n try {\n // Always regenerate the CustomerIOSDKInitializer file to reflect config changes\n copyTemplateFile(config, SDK_INITIALIZER_FILE, SDK_INITIALIZER_PACKAGE, (content) =>\n patchNativeSDKInitializer(content, PLATFORM.ANDROID, sdkConfig)\n );\n // Add import if not already present\n content = addImportToFile(content, SDK_INITIALIZER_IMPORT);\n // Add initialization code to onCreate if not already present\n if (!content.includes(CIO_NATIVE_SDK_INITIALIZE_CALL)) {\n content = addCodeToMethod(content, CIO_MAINAPPLICATION_ONCREATE_REGEX, CIO_NATIVE_SDK_INITIALIZE_SNIPPET);\n }\n } catch (error) {\n console.warn(`Could not setup ${SDK_INITIALIZER_CLASS}:`, error);\n return config.modResults.contents;\n }\n\n return content;\n};\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAH,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AAEO,MAAMK,gCAA+D,GAAGA,CAACC,WAAW,EAAEC,SAAS,KAAK;EACzG,OAAO,IAAAC,kCAAmB,EAACF,WAAW,EAAE,MAAOG,MAAM,IAAK;IACxD,MAAMC,OAAO,GAAGC,6BAA6B,CAACF,MAAM,EAAEF,SAAS,CAAC;IAChEE,MAAM,CAACG,UAAU,CAACC,QAAQ,GAAGH,OAAO;IACpC,OAAOD,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AAFAK,OAAA,CAAAT,gCAAA,GAAAA,gCAAA;AAGA,MAAMM,6BAA6B,GAAGA,CACpCF,MAAuD,EACvDF,SAA0B,KACf;EACX,MAAMQ,qBAAqB,GAAG,0BAA0B;EACxD,MAAMC,uBAAuB,GAAG,sBAAsB;EAEtD,MAAMC,oBAAoB,GAAG,GAAGF,qBAAqB,KAAK;EAC1D,MAAMG,sBAAsB,GAAG,UAAUF,uBAAuB,IAAID,qBAAqB,EAAE;EAE3F,IAAIL,OAAO,GAAGD,MAAM,CAACG,UAAU,CAACC,QAAQ;EAExC,IAAI;IACF;IACA,IAAAM,0BAAgB,EAACV,MAAM,EAAEQ,oBAAoB,EAAED,uBAAuB,EAAGN,OAAO,IAC9E,IAAAU,gDAAyB,EAACV,OAAO,EAAEW,gBAAQ,CAACC,OAAO,EAAEf,SAAS,CAChE,CAAC;IACD;IACAG,OAAO,GAAG,IAAAa,yBAAe,EAACb,OAAO,EAAEQ,sBAAsB,CAAC;IAC1D;IACA,IAAI,CAACR,OAAO,CAACc,QAAQ,CAACC,uCAA8B,CAAC,EAAE;MACrDf,OAAO,GAAG,IAAAgB,yBAAe,EAAChB,OAAO,EAAEiB,2CAAkC,EAAEC,0CAAiC,CAAC;IAC3G;EACF,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdC,OAAO,CAACC,IAAI,CAAC,mBAAmBhB,qBAAqB,GAAG,EAAEc,KAAK,CAAC;IAChE,OAAOpB,MAAM,CAACG,UAAU,CAACC,QAAQ;EACnC;EAEA,OAAOH,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -15,7 +15,7 @@ const addMetadataIfNotExists = (application, name, value) => {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// Check if metadata already exists
|
|
18
|
-
const hasMetadata = application['meta-data'].some(metadata => metadata['
|
|
18
|
+
const hasMetadata = application['meta-data'].some(metadata => metadata.$['android:name'] === name);
|
|
19
19
|
|
|
20
20
|
// Add metadata if it doesn't exist
|
|
21
21
|
if (!hasMetadata) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_configPlugins","require","addMetadataIfNotExists","application","name","value","hasMetadata","some","metadata","
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","addMetadataIfNotExists","application","name","value","hasMetadata","some","metadata","$","push","withNotificationChannelMetadata","config","props","withAndroidManifest","manifestProps","_props$pushNotificati","modResults","manifest","channel","pushNotification","id","importance","undefined","String","exports"],"sources":["withNotificationChannelMetadata.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\n/**\n * Adds a metadata entry to the Android manifest if it doesn't already exist\n */\nconst addMetadataIfNotExists = (\n application: ManifestApplication,\n name: string,\n value: string\n): void => {\n // Initialize meta-data array if it doesn't exist\n if (!application['meta-data']) {\n application['meta-data'] = [];\n }\n\n // Check if metadata already exists\n const hasMetadata = application['meta-data'].some(\n (metadata) => metadata.$['android:name'] === name\n );\n\n // Add metadata if it doesn't exist\n if (!hasMetadata) {\n application['meta-data'].push({\n $: {\n 'android:name': name,\n 'android:value': value,\n },\n });\n }\n};\n\nexport const withNotificationChannelMetadata: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (config, props) => {\n return withAndroidManifest(config, (manifestProps) => {\n const application = manifestProps.modResults.manifest\n .application as ManifestApplication[];\n const channel = props.pushNotification?.channel;\n\n // Only proceed if channel configuration exists\n if (\n channel &&\n (channel.id || channel.name || channel.importance !== undefined)\n ) {\n if (channel.id) {\n addMetadataIfNotExists(\n application[0],\n 'io.customer.notification_channel_id',\n channel.id\n );\n }\n\n if (channel.name) {\n addMetadataIfNotExists(\n application[0],\n 'io.customer.notification_channel_name',\n channel.name\n );\n }\n\n if (channel.importance !== undefined) {\n addMetadataIfNotExists(\n application[0],\n 'io.customer.notification_channel_importance',\n String(channel.importance)\n );\n }\n }\n\n manifestProps.modResults.manifest.application = application;\n return manifestProps;\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAKA;AACA;AACA;AACA,MAAMC,sBAAsB,GAAGA,CAC7BC,WAAgC,EAChCC,IAAY,EACZC,KAAa,KACJ;EACT;EACA,IAAI,CAACF,WAAW,CAAC,WAAW,CAAC,EAAE;IAC7BA,WAAW,CAAC,WAAW,CAAC,GAAG,EAAE;EAC/B;;EAEA;EACA,MAAMG,WAAW,GAAGH,WAAW,CAAC,WAAW,CAAC,CAACI,IAAI,CAC9CC,QAAQ,IAAKA,QAAQ,CAACC,CAAC,CAAC,cAAc,CAAC,KAAKL,IAC/C,CAAC;;EAED;EACA,IAAI,CAACE,WAAW,EAAE;IAChBH,WAAW,CAAC,WAAW,CAAC,CAACO,IAAI,CAAC;MAC5BD,CAAC,EAAE;QACD,cAAc,EAAEL,IAAI;QACpB,eAAe,EAAEC;MACnB;IACF,CAAC,CAAC;EACJ;AACF,CAAC;AAEM,MAAMM,+BAEZ,GAAGA,CAACC,MAAM,EAAEC,KAAK,KAAK;EACrB,OAAO,IAAAC,kCAAmB,EAACF,MAAM,EAAGG,aAAa,IAAK;IAAA,IAAAC,qBAAA;IACpD,MAAMb,WAAW,GAAGY,aAAa,CAACE,UAAU,CAACC,QAAQ,CAClDf,WAAoC;IACvC,MAAMgB,OAAO,IAAAH,qBAAA,GAAGH,KAAK,CAACO,gBAAgB,cAAAJ,qBAAA,uBAAtBA,qBAAA,CAAwBG,OAAO;;IAE/C;IACA,IACEA,OAAO,KACNA,OAAO,CAACE,EAAE,IAAIF,OAAO,CAACf,IAAI,IAAIe,OAAO,CAACG,UAAU,KAAKC,SAAS,CAAC,EAChE;MACA,IAAIJ,OAAO,CAACE,EAAE,EAAE;QACdnB,sBAAsB,CACpBC,WAAW,CAAC,CAAC,CAAC,EACd,qCAAqC,EACrCgB,OAAO,CAACE,EACV,CAAC;MACH;MAEA,IAAIF,OAAO,CAACf,IAAI,EAAE;QAChBF,sBAAsB,CACpBC,WAAW,CAAC,CAAC,CAAC,EACd,uCAAuC,EACvCgB,OAAO,CAACf,IACV,CAAC;MACH;MAEA,IAAIe,OAAO,CAACG,UAAU,KAAKC,SAAS,EAAE;QACpCrB,sBAAsB,CACpBC,WAAW,CAAC,CAAC,CAAC,EACd,6CAA6C,EAC7CqB,MAAM,CAACL,OAAO,CAACG,UAAU,CAC3B,CAAC;MACH;IACF;IAEAP,aAAa,CAACE,UAAU,CAACC,QAAQ,CAACf,WAAW,GAAGA,WAAW;IAC3D,OAAOY,aAAa;EACtB,CAAC,CAAC;AACJ,CAAC;AAACU,OAAA,CAAAd,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.addStringsToXml = addStringsToXml;
|
|
7
7
|
exports.withProjectStrings = void 0;
|
|
8
8
|
var _configPlugins = require("@expo/config-plugins");
|
|
9
|
-
var
|
|
9
|
+
var _plugin = require("../utils/plugin");
|
|
10
10
|
/**
|
|
11
11
|
* Adds or updates string resources in Android's strings.xml required by the plugin
|
|
12
12
|
*/
|
|
13
|
-
const withProjectStrings =
|
|
14
|
-
return (0, _configPlugins.withStringsXml)(
|
|
13
|
+
const withProjectStrings = configOuter => {
|
|
14
|
+
return (0, _configPlugins.withStringsXml)(configOuter, config => {
|
|
15
15
|
const stringsXml = config.modResults;
|
|
16
|
-
const pluginVersion = (0,
|
|
16
|
+
const pluginVersion = (0, _plugin.getPluginVersion)();
|
|
17
17
|
|
|
18
18
|
// Updating meta-data in AndroidManifest.xml fails on Manifest merging, so we're updating
|
|
19
19
|
// the strings here instead
|
|
@@ -45,20 +45,27 @@ function addStringsToXml(stringsXml, stringResources) {
|
|
|
45
45
|
string: []
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
+
// Ensure the string array exists
|
|
49
|
+
if (!stringsXml.resources.string) {
|
|
50
|
+
stringsXml.resources.string = [];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Get a reference to the string array after ensuring it exists
|
|
54
|
+
const stringArray = stringsXml.resources.string;
|
|
48
55
|
stringResources.forEach(({
|
|
49
56
|
name,
|
|
50
57
|
value
|
|
51
58
|
}) => {
|
|
52
|
-
const existingStringIndex =
|
|
59
|
+
const existingStringIndex = stringArray.findIndex(item => {
|
|
53
60
|
var _item$$;
|
|
54
61
|
return ((_item$$ = item.$) === null || _item$$ === void 0 ? void 0 : _item$$.name) === name;
|
|
55
62
|
});
|
|
56
63
|
if (existingStringIndex !== -1) {
|
|
57
64
|
// Update the existing string
|
|
58
|
-
|
|
65
|
+
stringArray[existingStringIndex]._ = value;
|
|
59
66
|
} else {
|
|
60
67
|
// Add a new string resource
|
|
61
|
-
|
|
68
|
+
stringArray.push({
|
|
62
69
|
$: {
|
|
63
70
|
name
|
|
64
71
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_configPlugins","require","
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_plugin","withProjectStrings","configOuter","withStringsXml","config","stringsXml","modResults","pluginVersion","getPluginVersion","addStringsToXml","name","value","exports","stringResources","resources","string","stringArray","forEach","existingStringIndex","findIndex","item","_item$$","$","_","push"],"sources":["withProjectStrings.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withStringsXml } from '@expo/config-plugins';\nimport type { ResourceXML } from '@expo/config-plugins/build/android/Resources';\nimport { getPluginVersion } from '../utils/plugin';\n\n/**\n * Adds or updates string resources in Android's strings.xml required by the plugin\n */\nexport const withProjectStrings: ConfigPlugin = (configOuter) => {\n return withStringsXml(configOuter, (config) => {\n const stringsXml = config.modResults;\n const pluginVersion = getPluginVersion();\n\n // Updating meta-data in AndroidManifest.xml fails on Manifest merging, so we're updating\n // the strings here instead\n // These strings are added to the strings.xml file by Customer.io's React Native SDK\n // We're updating them here to include the Expo client source and version so user agent\n // can be generated correctly for Expo apps\n addStringsToXml(stringsXml, [\n { name: 'customer_io_react_native_sdk_client_source', value: 'Expo' },\n {\n name: 'customer_io_react_native_sdk_client_version',\n value: pluginVersion,\n },\n ]);\n\n return config;\n });\n};\n\n/**\n * Adds or updates multiple string resources in Android's strings.xml\n * @param stringsXml - Parsed strings.xml object\n * @param stringResources - Array of string resources to add or update\n * @returns Updated strings.xml object\n */\nexport function addStringsToXml(\n stringsXml: ResourceXML,\n stringResources: { name: string; value: string }[]\n) {\n // Ensure the resource exists\n if (!stringsXml.resources) {\n stringsXml.resources = { string: [] };\n }\n // Ensure the string array exists\n if (!stringsXml.resources.string) {\n stringsXml.resources.string = [];\n }\n\n // Get a reference to the string array after ensuring it exists\n const stringArray = stringsXml.resources.string;\n stringResources.forEach(({ name, value }) => {\n const existingStringIndex = stringArray.findIndex(\n (item) => item.$?.name === name\n );\n\n if (existingStringIndex !== -1) {\n // Update the existing string\n stringArray[existingStringIndex]._ = value;\n } else {\n // Add a new string resource\n stringArray.push({\n $: { name },\n _: value,\n });\n }\n });\n}\n"],"mappings":";;;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACO,MAAME,kBAAgC,GAAIC,WAAW,IAAK;EAC/D,OAAO,IAAAC,6BAAc,EAACD,WAAW,EAAGE,MAAM,IAAK;IAC7C,MAAMC,UAAU,GAAGD,MAAM,CAACE,UAAU;IACpC,MAAMC,aAAa,GAAG,IAAAC,wBAAgB,EAAC,CAAC;;IAExC;IACA;IACA;IACA;IACA;IACAC,eAAe,CAACJ,UAAU,EAAE,CAC1B;MAAEK,IAAI,EAAE,4CAA4C;MAAEC,KAAK,EAAE;IAAO,CAAC,EACrE;MACED,IAAI,EAAE,6CAA6C;MACnDC,KAAK,EAAEJ;IACT,CAAC,CACF,CAAC;IAEF,OAAOH,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AALAQ,OAAA,CAAAX,kBAAA,GAAAA,kBAAA;AAMO,SAASQ,eAAeA,CAC7BJ,UAAuB,EACvBQ,eAAkD,EAClD;EACA;EACA,IAAI,CAACR,UAAU,CAACS,SAAS,EAAE;IACzBT,UAAU,CAACS,SAAS,GAAG;MAAEC,MAAM,EAAE;IAAG,CAAC;EACvC;EACA;EACA,IAAI,CAACV,UAAU,CAACS,SAAS,CAACC,MAAM,EAAE;IAChCV,UAAU,CAACS,SAAS,CAACC,MAAM,GAAG,EAAE;EAClC;;EAEA;EACA,MAAMC,WAAW,GAAGX,UAAU,CAACS,SAAS,CAACC,MAAM;EAC/CF,eAAe,CAACI,OAAO,CAAC,CAAC;IAAEP,IAAI;IAAEC;EAAM,CAAC,KAAK;IAC3C,MAAMO,mBAAmB,GAAGF,WAAW,CAACG,SAAS,CAC9CC,IAAI;MAAA,IAAAC,OAAA;MAAA,OAAK,EAAAA,OAAA,GAAAD,IAAI,CAACE,CAAC,cAAAD,OAAA,uBAANA,OAAA,CAAQX,IAAI,MAAKA,IAAI;IAAA,CACjC,CAAC;IAED,IAAIQ,mBAAmB,KAAK,CAAC,CAAC,EAAE;MAC9B;MACAF,WAAW,CAACE,mBAAmB,CAAC,CAACK,CAAC,GAAGZ,KAAK;IAC5C,CAAC,MAAM;MACL;MACAK,WAAW,CAACQ,IAAI,CAAC;QACfF,CAAC,EAAE;UAAEZ;QAAK,CAAC;QACXa,CAAC,EAAEZ;MACL,CAAC,CAAC;IACJ;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.CIO_PROJECT_GOOGLE_SNIPPET = exports.CIO_PROJECT_GIST_MAVEN_SNIPPET = exports.CIO_PROJECT_BUILDSCRIPTS_REGEX = exports.CIO_PROJECT_ALLPROJECTS_REGEX = exports.CIO_GIST_MAVEN_REGEX = exports.CIO_APP_GOOGLE_SNIPPET = exports.CIO_APP_APPLY_REGEX = void 0;
|
|
6
|
+
exports.CIO_PROJECT_GOOGLE_SNIPPET = exports.CIO_PROJECT_GIST_MAVEN_SNIPPET = exports.CIO_PROJECT_BUILDSCRIPTS_REGEX = exports.CIO_PROJECT_ALLPROJECTS_REGEX = exports.CIO_NATIVE_SDK_INITIALIZE_SNIPPET = exports.CIO_NATIVE_SDK_INITIALIZE_CALL = exports.CIO_MAINAPPLICATION_ONCREATE_REGEX = exports.CIO_GIST_MAVEN_REGEX = exports.CIO_APP_GOOGLE_SNIPPET = exports.CIO_APP_APPLY_REGEX = void 0;
|
|
7
7
|
const CIO_PROJECT_BUILDSCRIPTS_REGEX = exports.CIO_PROJECT_BUILDSCRIPTS_REGEX = /(buildscript\s*\{(.|\n)*dependencies\s*\{)/;
|
|
8
8
|
const CIO_APP_APPLY_REGEX = exports.CIO_APP_APPLY_REGEX = /(apply plugin: "com.android.application")/;
|
|
9
9
|
const CIO_GIST_MAVEN_REGEX = exports.CIO_GIST_MAVEN_REGEX = /maven { url "https:\/\/maven.gist.build" }/;
|
|
@@ -11,4 +11,10 @@ const CIO_PROJECT_ALLPROJECTS_REGEX = exports.CIO_PROJECT_ALLPROJECTS_REGEX = /(
|
|
|
11
11
|
const CIO_PROJECT_GIST_MAVEN_SNIPPET = exports.CIO_PROJECT_GIST_MAVEN_SNIPPET = ' maven { url "https://maven.gist.build" }';
|
|
12
12
|
const CIO_APP_GOOGLE_SNIPPET = exports.CIO_APP_GOOGLE_SNIPPET = 'apply plugin: "com.google.gms.google-services" // Google Services plugin';
|
|
13
13
|
const CIO_PROJECT_GOOGLE_SNIPPET = exports.CIO_PROJECT_GOOGLE_SNIPPET = ' classpath "com.google.gms:google-services:4.3.13" // Google Services plugin';
|
|
14
|
+
const CIO_MAINAPPLICATION_ONCREATE_REGEX = exports.CIO_MAINAPPLICATION_ONCREATE_REGEX = /override\s+fun\s+onCreate\s*\(\s*\)\s*\{[\s\S]*?\}/;
|
|
15
|
+
// Actual method call, also used to detect if Customer.io auto initialization is already present
|
|
16
|
+
const CIO_NATIVE_SDK_INITIALIZE_CALL = exports.CIO_NATIVE_SDK_INITIALIZE_CALL = 'CustomerIOSDKInitializer.initialize(this)';
|
|
17
|
+
// Complete code snippet to inject into MainActivity.onCreate()
|
|
18
|
+
const CIO_NATIVE_SDK_INITIALIZE_SNIPPET = exports.CIO_NATIVE_SDK_INITIALIZE_SNIPPET = `// Auto Initialize Native Customer.io SDK
|
|
19
|
+
${CIO_NATIVE_SDK_INITIALIZE_CALL}`;
|
|
14
20
|
//# sourceMappingURL=android.js.map
|
|
@@ -1 +1 @@
|
|
|
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,GAAAC,OAAA,CAAAD,8BAAA,GACzC,4CAA4C;AACvC,MAAME,mBAAmB,GAAAD,OAAA,CAAAC,mBAAA,GAAG,2CAA2C;AACvE,MAAMC,oBAAoB,GAAAF,OAAA,CAAAE,oBAAA,GAC/B,4CAA4C;AACvC,MAAMC,6BAA6B,GAAAH,OAAA,CAAAG,6BAAA,GACxC,kDAAkD;AAE7C,MAAMC,8BAA8B,GAAAJ,OAAA,CAAAI,8BAAA,GACzC,kDAAkD;AAC7C,MAAMC,sBAAsB,GAAAL,OAAA,CAAAK,sBAAA,GACjC,2EAA2E;AACtE,MAAMC,0BAA0B,GAAAN,OAAA,CAAAM,0BAAA,GACrC,sFAAsF","ignoreList":[]}
|
|
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","CIO_MAINAPPLICATION_ONCREATE_REGEX","CIO_NATIVE_SDK_INITIALIZE_CALL","CIO_NATIVE_SDK_INITIALIZE_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\nexport const CIO_MAINAPPLICATION_ONCREATE_REGEX = /override\\s+fun\\s+onCreate\\s*\\(\\s*\\)\\s*\\{[\\s\\S]*?\\}/;\n// Actual method call, also used to detect if Customer.io auto initialization is already present\nexport const CIO_NATIVE_SDK_INITIALIZE_CALL = 'CustomerIOSDKInitializer.initialize(this)';\n// Complete code snippet to inject into MainActivity.onCreate()\nexport const CIO_NATIVE_SDK_INITIALIZE_SNIPPET = `// Auto Initialize Native Customer.io SDK\n ${CIO_NATIVE_SDK_INITIALIZE_CALL}`;\n"],"mappings":";;;;;;AAAO,MAAMA,8BAA8B,GAAAC,OAAA,CAAAD,8BAAA,GACzC,4CAA4C;AACvC,MAAME,mBAAmB,GAAAD,OAAA,CAAAC,mBAAA,GAAG,2CAA2C;AACvE,MAAMC,oBAAoB,GAAAF,OAAA,CAAAE,oBAAA,GAC/B,4CAA4C;AACvC,MAAMC,6BAA6B,GAAAH,OAAA,CAAAG,6BAAA,GACxC,kDAAkD;AAE7C,MAAMC,8BAA8B,GAAAJ,OAAA,CAAAI,8BAAA,GACzC,kDAAkD;AAC7C,MAAMC,sBAAsB,GAAAL,OAAA,CAAAK,sBAAA,GACjC,2EAA2E;AACtE,MAAMC,0BAA0B,GAAAN,OAAA,CAAAM,0BAAA,GACrC,sFAAsF;AAEjF,MAAMC,kCAAkC,GAAAP,OAAA,CAAAO,kCAAA,GAAG,oDAAoD;AACtG;AACO,MAAMC,8BAA8B,GAAAR,OAAA,CAAAQ,8BAAA,GAAG,2CAA2C;AACzF;AACO,MAAMC,iCAAiC,GAAAT,OAAA,CAAAS,iCAAA,GAAG;AACjD,MAAMD,8BAA8B,EAAE","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PLATFORM = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Platform constants for native SDK initialization
|
|
9
|
+
*/
|
|
10
|
+
const PLATFORM = exports.PLATFORM = {
|
|
11
|
+
IOS: 'ios',
|
|
12
|
+
ANDROID: 'android'
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Platform type definition
|
|
17
|
+
*/
|
|
18
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PLATFORM","exports","IOS","ANDROID"],"sources":["common.ts"],"sourcesContent":["/**\n * Platform constants for native SDK initialization\n */\nexport const PLATFORM = {\n IOS: 'ios',\n ANDROID: 'android',\n} as const;\n\n/**\n * Platform type definition\n */\nexport type Platform = typeof PLATFORM[keyof typeof PLATFORM];\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACO,MAAMA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG;EACtBE,GAAG,EAAE,KAAK;EACVC,OAAO,EAAE;AACX,CAAU;;AAEV;AACA;AACA","ignoreList":[]}
|
|
@@ -3,16 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.IOS_DEPLOYMENT_TARGET = exports.GROUP_IDENTIFIER_TEMPLATE_REGEX = exports.DEFAULT_BUNDLE_VERSION = exports.DEFAULT_BUNDLE_SHORT_VERSION = exports.CIO_TARGET_NAME = exports.CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER = exports.CIO_REGISTER_PUSHNOTIFICATION_SNIPPET_v2 = exports.CIO_REGISTER_PUSHNOTIFICATION_SNIPPET = exports.CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET = exports.CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX = exports.CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = exports.CIO_NOTIFICATION_TARGET_NAME = exports.CIO_NATIVE_SDK_INITIALIZE_SNIPPET = exports.CIO_NATIVE_SDK_INITIALIZE_CALL = exports.CIO_MESSAGING_PUSH_APP_DELEGATE_INIT_REGEX = exports.CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET = exports.CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX = exports.CIO_INITIALIZECIOSDK_SNIPPET = exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = exports.CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX = exports.CIO_DIDFINISHLAUNCHINGMETHOD_REGEX = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX = exports.CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX = exports.CIO_DEEPLINK_COMMENT_REGEX = exports.CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SWIFT_SNIPPET = exports.CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET = exports.CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = exports.CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET = exports.CIO_APPDELEGATEHEADER_REGEX = exports.CIO_APPDELEGATEHEADER_IMPORT_SNIPPET = exports.CIO_APPDELEGATEDECLARATION_REGEX = exports.BUNDLE_VERSION_TEMPLATE_REGEX = exports.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = void 0;
|
|
7
7
|
exports.getRelativePathToRNSDK = getRelativePathToRNSDK;
|
|
8
|
-
const finder = require('find-package-json');
|
|
9
8
|
const path = require('path');
|
|
10
9
|
const resolveFrom = require('resolve-from');
|
|
11
|
-
const f = finder(__dirname);
|
|
12
|
-
let pluginPackageRoot = f.next().filename;
|
|
13
|
-
// This is the path to the root of the customerio-expo-plugin package
|
|
14
|
-
pluginPackageRoot = path.dirname(pluginPackageRoot);
|
|
15
|
-
const LOCAL_PATH_TO_CIO_NSE_FILES = exports.LOCAL_PATH_TO_CIO_NSE_FILES = path.join(pluginPackageRoot, 'plugin/src/helpers/native-files/ios');
|
|
16
10
|
function getRelativePathToRNSDK(iosPath) {
|
|
17
11
|
// Root path of the Expo project
|
|
18
12
|
const rootAppPath = path.dirname(iosPath);
|
|
@@ -142,4 +136,10 @@ const CIO_REGISTER_PUSHNOTIFICATION_SNIPPET_v2 = exports.CIO_REGISTER_PUSHNOTIFI
|
|
|
142
136
|
}
|
|
143
137
|
}`;
|
|
144
138
|
const CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER = exports.CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER = /\{\{REGISTER_SNIPPET\}\}/;
|
|
139
|
+
// Regex to match MessagingPush initialization in AppDelegate (different from NSE initialization)
|
|
140
|
+
const CIO_MESSAGING_PUSH_APP_DELEGATE_INIT_REGEX = exports.CIO_MESSAGING_PUSH_APP_DELEGATE_INIT_REGEX = /(MessagingPush(?:APN|FCM)\.initialize)/;
|
|
141
|
+
const CIO_NATIVE_SDK_INITIALIZE_CALL = exports.CIO_NATIVE_SDK_INITIALIZE_CALL = 'CustomerIOSDKInitializer.initialize()';
|
|
142
|
+
const CIO_NATIVE_SDK_INITIALIZE_SNIPPET = exports.CIO_NATIVE_SDK_INITIALIZE_SNIPPET = `// Auto Initialize Native Customer.io SDK
|
|
143
|
+
${CIO_NATIVE_SDK_INITIALIZE_CALL}
|
|
144
|
+
`;
|
|
145
145
|
//# sourceMappingURL=ios.js.map
|