customerio-expo-plugin 2.6.0 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/plugin/lib/commonjs/android/withAndroidManifestUpdates.js +53 -12
- package/plugin/lib/commonjs/android/withAndroidManifestUpdates.js.map +1 -1
- package/plugin/lib/commonjs/android/withCIOAndroid.js +1 -1
- package/plugin/lib/commonjs/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/commonjs/helpers/native-files/ios/CustomerIOSDKInitializer.swift +10 -4
- package/plugin/lib/module/android/withAndroidManifestUpdates.js +52 -11
- package/plugin/lib/module/android/withAndroidManifestUpdates.js.map +1 -1
- package/plugin/lib/module/android/withCIOAndroid.js +1 -1
- package/plugin/lib/module/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/module/helpers/native-files/ios/CustomerIOSDKInitializer.swift +10 -4
- package/plugin/lib/typescript/android/withAndroidManifestUpdates.d.ts +1 -0
- package/plugin/src/android/withAndroidManifestUpdates.ts +66 -17
- package/plugin/src/android/withCIOAndroid.ts +1 -1
- package/plugin/src/helpers/native-files/ios/CustomerIOSDKInitializer.swift +10 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "customerio-expo-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
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",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"registry": "https://registry.npmjs.org/"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"customerio-reactnative": "4.
|
|
58
|
+
"customerio-reactnative": "4.8.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@eslint/js": "^9.33.0",
|
|
@@ -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
14
|
if (!application[0].service) {
|
|
13
15
|
application[0].service = [];
|
|
14
16
|
}
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
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
|
+
}
|
|
17
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","service","
|
|
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;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
|
@@ -19,7 +19,7 @@ function withCIOAndroid(config, sdkConfig, props) {
|
|
|
19
19
|
config = (0, _withAppGoogleServices.withAppGoogleServices)(config, props);
|
|
20
20
|
config = (0, _withGoogleServicesJSON.withGoogleServicesJSON)(config, props);
|
|
21
21
|
config = (0, _withProjectStrings.withProjectStrings)(config);
|
|
22
|
-
if (props.setHighPriorityPushHandler) {
|
|
22
|
+
if (props.setHighPriorityPushHandler !== undefined) {
|
|
23
23
|
config = (0, _withAndroidManifestUpdates.withAndroidManifestUpdates)(config, props);
|
|
24
24
|
}
|
|
25
25
|
if ((_props$pushNotificati = props.pushNotification) !== null && _props$pushNotificati !== void 0 && _props$pushNotificati.channel) {
|
|
@@ -1 +1 @@
|
|
|
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","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) {\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,EAAE;
|
|
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":[]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import CioDataPipelines
|
|
2
2
|
import CioInternalCommon
|
|
3
3
|
import CioMessagingInApp
|
|
4
|
-
import customerio_reactnative
|
|
5
4
|
|
|
6
5
|
class CustomerIOSDKInitializer {
|
|
7
6
|
static func initialize() {
|
|
@@ -27,9 +26,16 @@ class CustomerIOSDKInitializer {
|
|
|
27
26
|
CustomerIO.initialize(withConfig: builder.build())
|
|
28
27
|
|
|
29
28
|
if let siteId = siteId {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
let inAppConfig = MessagingInAppConfigBuilder(siteId: siteId, region: region).build()
|
|
30
|
+
MessagingInApp.initialize(withConfig: inAppConfig)
|
|
31
|
+
let logger = DIGraphShared.shared.logger
|
|
32
|
+
// Retrieves ReactInAppEventListener from DI graph, populated when it is accessed in React Native SDK.
|
|
33
|
+
if let listener: InAppEventListener? = DIGraphShared.shared.getOverriddenInstance() {
|
|
34
|
+
logger.debug("[Expo][InApp] React InAppEventListener found in DI graph and set")
|
|
35
|
+
MessagingInApp.shared.setEventListener(listener)
|
|
36
|
+
} else {
|
|
37
|
+
logger.debug("[Expo][InApp] React InAppEventListener not found in DI graph, will be set by React Native module when accessed")
|
|
38
|
+
}
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
|
|
@@ -1,27 +1,68 @@
|
|
|
1
1
|
import { withAndroidManifest } from '@expo/config-plugins';
|
|
2
|
-
|
|
2
|
+
// Default low priority for Firebase messaging service when setHighPriorityPushHandler is false
|
|
3
|
+
export const DEFAULT_LOW_PRIORITY = -10;
|
|
4
|
+
export const withAndroidManifestUpdates = (configOuter, options) => {
|
|
3
5
|
return withAndroidManifest(configOuter, props => {
|
|
4
6
|
const application = props.modResults.manifest.application;
|
|
5
7
|
const customerIOMessagingpush = 'io.customer.messagingpush.CustomerIOFirebaseMessagingService';
|
|
6
8
|
if (!application[0].service) {
|
|
7
9
|
application[0].service = [];
|
|
8
10
|
}
|
|
9
|
-
const
|
|
10
|
-
if (
|
|
11
|
+
const existingServiceIndex = application[0].service.findIndex(service => service.$['android:name'] === customerIOMessagingpush);
|
|
12
|
+
if (existingServiceIndex === -1) {
|
|
13
|
+
// Intent filter structure for Firebase messaging service
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
const intentFilter = {
|
|
16
|
+
action: [{
|
|
17
|
+
$: {
|
|
18
|
+
'android:name': 'com.google.firebase.MESSAGING_EVENT'
|
|
19
|
+
}
|
|
20
|
+
}]
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Handle priority based on setHighPriorityPushHandler value
|
|
24
|
+
if (options.setHighPriorityPushHandler === true) {
|
|
25
|
+
// High priority - no priority attribute means default high priority
|
|
26
|
+
console.log('Successfully set CustomerIO push handler as high priority in AndroidManifest.xml');
|
|
27
|
+
} else if (options.setHighPriorityPushHandler === false) {
|
|
28
|
+
// Low priority - set fixed priority
|
|
29
|
+
intentFilter.$ = {
|
|
30
|
+
'android:priority': DEFAULT_LOW_PRIORITY.toString()
|
|
31
|
+
};
|
|
32
|
+
console.log(`Successfully set CustomerIO push handler as low priority (${DEFAULT_LOW_PRIORITY}) in AndroidManifest.xml`);
|
|
33
|
+
}
|
|
11
34
|
application[0].service.push({
|
|
12
35
|
'$': {
|
|
13
36
|
'android:name': customerIOMessagingpush,
|
|
14
37
|
'android:exported': 'false'
|
|
15
38
|
},
|
|
16
|
-
'intent-filter': [
|
|
17
|
-
action: [{
|
|
18
|
-
$: {
|
|
19
|
-
'android:name': 'com.google.firebase.MESSAGING_EVENT'
|
|
20
|
-
}
|
|
21
|
-
}]
|
|
22
|
-
}]
|
|
39
|
+
'intent-filter': [intentFilter]
|
|
23
40
|
});
|
|
24
|
-
|
|
41
|
+
} else if (options.setHighPriorityPushHandler === true) {
|
|
42
|
+
// Service exists, need to ensure it becomes high priority (remove priority attribute)
|
|
43
|
+
const existingService = application[0].service[existingServiceIndex];
|
|
44
|
+
if (existingService['intent-filter'] && existingService['intent-filter'].length > 0) {
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
+
const intentFilter = existingService['intent-filter'][0];
|
|
47
|
+
if (intentFilter.$ && intentFilter.$['android:priority']) {
|
|
48
|
+
delete intentFilter.$['android:priority'];
|
|
49
|
+
console.log('Successfully updated existing CustomerIO push handler to high priority in AndroidManifest.xml');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
} else if (options.setHighPriorityPushHandler === false) {
|
|
53
|
+
// Service exists, update to low priority
|
|
54
|
+
const existingService = application[0].service[existingServiceIndex];
|
|
55
|
+
|
|
56
|
+
// Update existing service intent-filter with fixed priority
|
|
57
|
+
if (existingService['intent-filter'] && existingService['intent-filter'].length > 0) {
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
+
const intentFilter = existingService['intent-filter'][0];
|
|
60
|
+
if (!intentFilter.$) {
|
|
61
|
+
intentFilter.$ = {};
|
|
62
|
+
}
|
|
63
|
+
intentFilter.$['android:priority'] = DEFAULT_LOW_PRIORITY.toString();
|
|
64
|
+
console.log(`Successfully updated existing CustomerIO push handler to low priority (${DEFAULT_LOW_PRIORITY}) in AndroidManifest.xml`);
|
|
65
|
+
}
|
|
25
66
|
}
|
|
26
67
|
props.modResults.manifest.application = application;
|
|
27
68
|
return props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withAndroidManifest","withAndroidManifestUpdates","configOuter","props","application","modResults","manifest","customerIOMessagingpush","service","
|
|
1
|
+
{"version":3,"names":["withAndroidManifest","DEFAULT_LOW_PRIORITY","withAndroidManifestUpdates","configOuter","options","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,SAASA,mBAAmB,QAAQ,sBAAsB;AAK1D;AACA,OAAO,MAAMC,oBAAoB,GAAG,CAAC,EAAE;AAGvC,OAAO,MAAMC,0BAEZ,GAAGA,CAACC,WAAW,EAAEC,OAAO,KAAK;EAC5B,OAAOJ,mBAAmB,CAACG,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,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,IAAIT,OAAO,CAACY,0BAA0B,KAAK,IAAI,EAAE;QAC/C;QACAC,OAAO,CAACC,GAAG,CACT,kFACF,CAAC;MACH,CAAC,MAAM,IAAId,OAAO,CAACY,0BAA0B,KAAK,KAAK,EAAE;QACvD;QACAF,YAAY,CAACD,CAAC,GAAG;UACf,kBAAkB,EAAEZ,oBAAoB,CAACkB,QAAQ,CAAC;QACpD,CAAC;QACDF,OAAO,CAACC,GAAG,CACT,6DAA6DjB,oBAAoB,0BACnF,CAAC;MACH;MAEAK,WAAW,CAAC,CAAC,CAAC,CAAC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CAAC;MACH;IACF;IAEAI,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -13,7 +13,7 @@ export function withCIOAndroid(config, sdkConfig, props) {
|
|
|
13
13
|
config = withAppGoogleServices(config, props);
|
|
14
14
|
config = withGoogleServicesJSON(config, props);
|
|
15
15
|
config = withProjectStrings(config);
|
|
16
|
-
if (props.setHighPriorityPushHandler) {
|
|
16
|
+
if (props.setHighPriorityPushHandler !== undefined) {
|
|
17
17
|
config = withAndroidManifestUpdates(config, props);
|
|
18
18
|
}
|
|
19
19
|
if ((_props$pushNotificati = props.pushNotification) !== null && _props$pushNotificati !== void 0 && _props$pushNotificati.channel) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withAndroidManifestUpdates","withAppGoogleServices","withGistMavenRepository","withGoogleServicesJSON","withMainApplicationModifications","withNotificationChannelMetadata","withProjectGoogleServices","withProjectStrings","withCIOAndroid","config","sdkConfig","props","_props$pushNotificati","setHighPriorityPushHandler","pushNotification","channel"],"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) {\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,SAASA,0BAA0B,QAAQ,8BAA8B;AACzE,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,gCAAgC,QAAQ,oCAAoC;AACrF,SAASC,+BAA+B,QAAQ,mCAAmC;AACnF,SAASC,yBAAyB,QAAQ,6BAA6B;AACvE,SAASC,kBAAkB,QAAQ,sBAAsB;AAEzD,OAAO,SAASC,cAAcA,CAC5BC,MAAkB,EAClBC,SAAsC,EACtCC,KAAqC,EACzB;EAAA,IAAAC,qBAAA;EACZH,MAAM,GAAGP,uBAAuB,CAACO,MAAM,EAAEE,KAAK,CAAC;EAC/CF,MAAM,GAAGH,yBAAyB,CAACG,MAAM,EAAEE,KAAK,CAAC;EACjDF,MAAM,GAAGR,qBAAqB,CAACQ,MAAM,EAAEE,KAAK,CAAC;EAC7CF,MAAM,GAAGN,sBAAsB,CAACM,MAAM,EAAEE,KAAK,CAAC;EAC9CF,MAAM,GAAGF,kBAAkB,CAACE,MAAM,CAAC;EACnC,IAAIE,KAAK,CAACE,0BAA0B,EAAE;
|
|
1
|
+
{"version":3,"names":["withAndroidManifestUpdates","withAppGoogleServices","withGistMavenRepository","withGoogleServicesJSON","withMainApplicationModifications","withNotificationChannelMetadata","withProjectGoogleServices","withProjectStrings","withCIOAndroid","config","sdkConfig","props","_props$pushNotificati","setHighPriorityPushHandler","undefined","pushNotification","channel"],"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,SAASA,0BAA0B,QAAQ,8BAA8B;AACzE,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,gCAAgC,QAAQ,oCAAoC;AACrF,SAASC,+BAA+B,QAAQ,mCAAmC;AACnF,SAASC,yBAAyB,QAAQ,6BAA6B;AACvE,SAASC,kBAAkB,QAAQ,sBAAsB;AAEzD,OAAO,SAASC,cAAcA,CAC5BC,MAAkB,EAClBC,SAAsC,EACtCC,KAAqC,EACzB;EAAA,IAAAC,qBAAA;EACZH,MAAM,GAAGP,uBAAuB,CAACO,MAAM,EAAEE,KAAK,CAAC;EAC/CF,MAAM,GAAGH,yBAAyB,CAACG,MAAM,EAAEE,KAAK,CAAC;EACjDF,MAAM,GAAGR,qBAAqB,CAACQ,MAAM,EAAEE,KAAK,CAAC;EAC7CF,MAAM,GAAGN,sBAAsB,CAACM,MAAM,EAAEE,KAAK,CAAC;EAC9CF,MAAM,GAAGF,kBAAkB,CAACE,MAAM,CAAC;EACnC,IAAIE,KAAK,CAACE,0BAA0B,KAAKC,SAAS,EAAE;IAClDL,MAAM,GAAGT,0BAA0B,CAACS,MAAM,EAAEE,KAAK,CAAC;EACpD;EACA,KAAAC,qBAAA,GAAID,KAAK,CAACI,gBAAgB,cAAAH,qBAAA,eAAtBA,qBAAA,CAAwBI,OAAO,EAAE;IACnCP,MAAM,GAAGJ,+BAA+B,CAACI,MAAM,EAAEE,KAAK,CAAC;EACzD;EACA;EACA,IAAID,SAAS,EAAE;IACbD,MAAM,GAAGL,gCAAgC,CAACK,MAAM,EAAEC,SAAS,CAAC;EAC9D;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import CioDataPipelines
|
|
2
2
|
import CioInternalCommon
|
|
3
3
|
import CioMessagingInApp
|
|
4
|
-
import customerio_reactnative
|
|
5
4
|
|
|
6
5
|
class CustomerIOSDKInitializer {
|
|
7
6
|
static func initialize() {
|
|
@@ -27,9 +26,16 @@ class CustomerIOSDKInitializer {
|
|
|
27
26
|
CustomerIO.initialize(withConfig: builder.build())
|
|
28
27
|
|
|
29
28
|
if let siteId = siteId {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
let inAppConfig = MessagingInAppConfigBuilder(siteId: siteId, region: region).build()
|
|
30
|
+
MessagingInApp.initialize(withConfig: inAppConfig)
|
|
31
|
+
let logger = DIGraphShared.shared.logger
|
|
32
|
+
// Retrieves ReactInAppEventListener from DI graph, populated when it is accessed in React Native SDK.
|
|
33
|
+
if let listener: InAppEventListener? = DIGraphShared.shared.getOverriddenInstance() {
|
|
34
|
+
logger.debug("[Expo][InApp] React InAppEventListener found in DI graph and set")
|
|
35
|
+
MessagingInApp.shared.setEventListener(listener)
|
|
36
|
+
} else {
|
|
37
|
+
logger.debug("[Expo][InApp] React InAppEventListener not found in DI graph, will be set by React Native module when accessed")
|
|
38
|
+
}
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
2
2
|
import type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';
|
|
3
|
+
export declare const DEFAULT_LOW_PRIORITY = -10;
|
|
3
4
|
export declare const withAndroidManifestUpdates: ConfigPlugin<CustomerIOPluginOptionsAndroid>;
|
|
@@ -4,9 +4,13 @@ import type { ManifestApplication } from '@expo/config-plugins/build/android/Man
|
|
|
4
4
|
|
|
5
5
|
import type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';
|
|
6
6
|
|
|
7
|
+
// Default low priority for Firebase messaging service when setHighPriorityPushHandler is false
|
|
8
|
+
export const DEFAULT_LOW_PRIORITY = -10;
|
|
9
|
+
|
|
10
|
+
|
|
7
11
|
export const withAndroidManifestUpdates: ConfigPlugin<
|
|
8
12
|
CustomerIOPluginOptionsAndroid
|
|
9
|
-
> = (configOuter) => {
|
|
13
|
+
> = (configOuter, options) => {
|
|
10
14
|
return withAndroidManifest(configOuter, (props) => {
|
|
11
15
|
const application = props.modResults.manifest
|
|
12
16
|
.application as ManifestApplication[];
|
|
@@ -17,31 +21,76 @@ export const withAndroidManifestUpdates: ConfigPlugin<
|
|
|
17
21
|
application[0].service = [];
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
const
|
|
24
|
+
const existingServiceIndex = application[0].service.findIndex(
|
|
21
25
|
(service) => service.$['android:name'] === customerIOMessagingpush
|
|
22
26
|
);
|
|
23
27
|
|
|
24
|
-
if (
|
|
28
|
+
if (existingServiceIndex === -1) {
|
|
29
|
+
// Intent filter structure for Firebase messaging service
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
+
const intentFilter: any = {
|
|
32
|
+
action: [
|
|
33
|
+
{
|
|
34
|
+
$: {
|
|
35
|
+
'android:name': 'com.google.firebase.MESSAGING_EVENT',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Handle priority based on setHighPriorityPushHandler value
|
|
42
|
+
if (options.setHighPriorityPushHandler === true) {
|
|
43
|
+
// High priority - no priority attribute means default high priority
|
|
44
|
+
console.log(
|
|
45
|
+
'Successfully set CustomerIO push handler as high priority in AndroidManifest.xml'
|
|
46
|
+
);
|
|
47
|
+
} else if (options.setHighPriorityPushHandler === false) {
|
|
48
|
+
// Low priority - set fixed priority
|
|
49
|
+
intentFilter.$ = {
|
|
50
|
+
'android:priority': DEFAULT_LOW_PRIORITY.toString(),
|
|
51
|
+
};
|
|
52
|
+
console.log(
|
|
53
|
+
`Successfully set CustomerIO push handler as low priority (${DEFAULT_LOW_PRIORITY}) in AndroidManifest.xml`
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
25
57
|
application[0].service.push({
|
|
26
58
|
'$': {
|
|
27
59
|
'android:name': customerIOMessagingpush,
|
|
28
60
|
'android:exported': 'false',
|
|
29
61
|
},
|
|
30
|
-
'intent-filter': [
|
|
31
|
-
{
|
|
32
|
-
action: [
|
|
33
|
-
{
|
|
34
|
-
$: {
|
|
35
|
-
'android:name': 'com.google.firebase.MESSAGING_EVENT',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
],
|
|
62
|
+
'intent-filter': [intentFilter],
|
|
41
63
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
64
|
+
} else if (options.setHighPriorityPushHandler === true) {
|
|
65
|
+
// Service exists, need to ensure it becomes high priority (remove priority attribute)
|
|
66
|
+
const existingService = application[0].service[existingServiceIndex];
|
|
67
|
+
|
|
68
|
+
if (existingService['intent-filter'] && existingService['intent-filter'].length > 0) {
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
const intentFilter = existingService['intent-filter'][0] as any;
|
|
71
|
+
if (intentFilter.$ && intentFilter.$['android:priority']) {
|
|
72
|
+
delete intentFilter.$['android:priority'];
|
|
73
|
+
console.log(
|
|
74
|
+
'Successfully updated existing CustomerIO push handler to high priority in AndroidManifest.xml'
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
} else if (options.setHighPriorityPushHandler === false) {
|
|
79
|
+
// Service exists, update to low priority
|
|
80
|
+
const existingService = application[0].service[existingServiceIndex];
|
|
81
|
+
|
|
82
|
+
// Update existing service intent-filter with fixed priority
|
|
83
|
+
if (existingService['intent-filter'] && existingService['intent-filter'].length > 0) {
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
85
|
+
const intentFilter = existingService['intent-filter'][0] as any;
|
|
86
|
+
if (!intentFilter.$) {
|
|
87
|
+
intentFilter.$ = {};
|
|
88
|
+
}
|
|
89
|
+
intentFilter.$['android:priority'] = DEFAULT_LOW_PRIORITY.toString();
|
|
90
|
+
console.log(
|
|
91
|
+
`Successfully updated existing CustomerIO push handler to low priority (${DEFAULT_LOW_PRIORITY}) in AndroidManifest.xml`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
45
94
|
}
|
|
46
95
|
|
|
47
96
|
props.modResults.manifest.application = application;
|
|
@@ -20,7 +20,7 @@ export function withCIOAndroid(
|
|
|
20
20
|
config = withAppGoogleServices(config, props);
|
|
21
21
|
config = withGoogleServicesJSON(config, props);
|
|
22
22
|
config = withProjectStrings(config);
|
|
23
|
-
if (props.setHighPriorityPushHandler) {
|
|
23
|
+
if (props.setHighPriorityPushHandler !== undefined) {
|
|
24
24
|
config = withAndroidManifestUpdates(config, props);
|
|
25
25
|
}
|
|
26
26
|
if (props.pushNotification?.channel) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import CioDataPipelines
|
|
2
2
|
import CioInternalCommon
|
|
3
3
|
import CioMessagingInApp
|
|
4
|
-
import customerio_reactnative
|
|
5
4
|
|
|
6
5
|
class CustomerIOSDKInitializer {
|
|
7
6
|
static func initialize() {
|
|
@@ -27,9 +26,16 @@ class CustomerIOSDKInitializer {
|
|
|
27
26
|
CustomerIO.initialize(withConfig: builder.build())
|
|
28
27
|
|
|
29
28
|
if let siteId = siteId {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
let inAppConfig = MessagingInAppConfigBuilder(siteId: siteId, region: region).build()
|
|
30
|
+
MessagingInApp.initialize(withConfig: inAppConfig)
|
|
31
|
+
let logger = DIGraphShared.shared.logger
|
|
32
|
+
// Retrieves ReactInAppEventListener from DI graph, populated when it is accessed in React Native SDK.
|
|
33
|
+
if let listener: InAppEventListener? = DIGraphShared.shared.getOverriddenInstance() {
|
|
34
|
+
logger.debug("[Expo][InApp] React InAppEventListener found in DI graph and set")
|
|
35
|
+
MessagingInApp.shared.setEventListener(listener)
|
|
36
|
+
} else {
|
|
37
|
+
logger.debug("[Expo][InApp] React InAppEventListener not found in DI graph, will be set by React Native module when accessed")
|
|
38
|
+
}
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
|