customerio-expo-plugin 2.3.0 → 2.4.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 +2 -2
- package/plugin/lib/commonjs/android/withCIOAndroid.js +5 -0
- package/plugin/lib/commonjs/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/commonjs/android/withNotificationChannelMetadata.js +53 -0
- package/plugin/lib/commonjs/android/withNotificationChannelMetadata.js.map +1 -0
- package/plugin/lib/commonjs/types/cio-types.js.map +1 -1
- package/plugin/lib/module/android/withCIOAndroid.js +5 -0
- package/plugin/lib/module/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/module/android/withNotificationChannelMetadata.js +46 -0
- package/plugin/lib/module/android/withNotificationChannelMetadata.js.map +1 -0
- package/plugin/lib/module/types/cio-types.js.map +1 -1
- package/plugin/lib/typescript/android/withNotificationChannelMetadata.d.ts +3 -0
- package/plugin/lib/typescript/types/cio-types.d.ts +7 -0
- package/plugin/src/android/withCIOAndroid.ts +4 -0
- package/plugin/src/android/withNotificationChannelMetadata.ts +73 -0
- package/plugin/src/types/cio-types.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "customerio-expo-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.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",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"registry": "https://registry.npmjs.org/"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"customerio-reactnative": "4.
|
|
56
|
+
"customerio-reactnative": "4.5.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@expo/config-plugins": "^10.0.0",
|
|
@@ -8,9 +8,11 @@ var _withAndroidManifestUpdates = require("./withAndroidManifestUpdates");
|
|
|
8
8
|
var _withAppGoogleServices = require("./withAppGoogleServices");
|
|
9
9
|
var _withGistMavenRepository = require("./withGistMavenRepository");
|
|
10
10
|
var _withGoogleServicesJSON = require("./withGoogleServicesJSON");
|
|
11
|
+
var _withNotificationChannelMetadata = require("./withNotificationChannelMetadata");
|
|
11
12
|
var _withProjectGoogleServices = require("./withProjectGoogleServices");
|
|
12
13
|
var _withProjectStrings = require("./withProjectStrings");
|
|
13
14
|
function withCIOAndroid(config, props) {
|
|
15
|
+
var _props$pushNotificati;
|
|
14
16
|
config = (0, _withGistMavenRepository.withGistMavenRepository)(config, props);
|
|
15
17
|
config = (0, _withProjectGoogleServices.withProjectGoogleServices)(config, props);
|
|
16
18
|
config = (0, _withAppGoogleServices.withAppGoogleServices)(config, props);
|
|
@@ -19,6 +21,9 @@ function withCIOAndroid(config, props) {
|
|
|
19
21
|
if (props.setHighPriorityPushHandler) {
|
|
20
22
|
config = (0, _withAndroidManifestUpdates.withAndroidManifestUpdates)(config, props);
|
|
21
23
|
}
|
|
24
|
+
if ((_props$pushNotificati = props.pushNotification) !== null && _props$pushNotificati !== void 0 && _props$pushNotificati.channel) {
|
|
25
|
+
config = (0, _withNotificationChannelMetadata.withNotificationChannelMetadata)(config, props);
|
|
26
|
+
}
|
|
22
27
|
return config;
|
|
23
28
|
}
|
|
24
29
|
//# sourceMappingURL=withCIOAndroid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_withAndroidManifestUpdates","require","_withAppGoogleServices","_withGistMavenRepository","_withGoogleServicesJSON","_withProjectGoogleServices","_withProjectStrings","withCIOAndroid","config","props","withGistMavenRepository","withProjectGoogleServices","withAppGoogleServices","withGoogleServicesJSON","withProjectStrings","setHighPriorityPushHandler","withAndroidManifestUpdates"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\nimport { withAndroidManifestUpdates } from './withAndroidManifestUpdates';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\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\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","_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,gCAAA,GAAAJ,OAAA;AACA,IAAAK,0BAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AAEO,SAASO,cAAcA,CAC5BC,MAAkB,EAClBC,KAAqC,EACzB;EAAA,IAAAC,qBAAA;EACZF,MAAM,GAAG,IAAAG,gDAAuB,EAACH,MAAM,EAAEC,KAAK,CAAC;EAC/CD,MAAM,GAAG,IAAAI,oDAAyB,EAACJ,MAAM,EAAEC,KAAK,CAAC;EACjDD,MAAM,GAAG,IAAAK,4CAAqB,EAACL,MAAM,EAAEC,KAAK,CAAC;EAC7CD,MAAM,GAAG,IAAAM,8CAAsB,EAACN,MAAM,EAAEC,KAAK,CAAC;EAC9CD,MAAM,GAAG,IAAAO,sCAAkB,EAACP,MAAM,CAAC;EACnC,IAAIC,KAAK,CAACO,0BAA0B,EAAE;IACpCR,MAAM,GAAG,IAAAS,sDAA0B,EAACT,MAAM,EAAEC,KAAK,CAAC;EACpD;EACA,KAAAC,qBAAA,GAAID,KAAK,CAACS,gBAAgB,cAAAR,qBAAA,eAAtBA,qBAAA,CAAwBS,OAAO,EAAE;IACnCX,MAAM,GAAG,IAAAY,gEAA+B,EAACZ,MAAM,EAAEC,KAAK,CAAC;EACzD;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withNotificationChannelMetadata = void 0;
|
|
7
|
+
var _configPlugins = require("@expo/config-plugins");
|
|
8
|
+
/**
|
|
9
|
+
* Adds a metadata entry to the Android manifest if it doesn't already exist
|
|
10
|
+
*/
|
|
11
|
+
const addMetadataIfNotExists = (application, name, value) => {
|
|
12
|
+
// Initialize meta-data array if it doesn't exist
|
|
13
|
+
if (!application['meta-data']) {
|
|
14
|
+
application['meta-data'] = [];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Check if metadata already exists
|
|
18
|
+
const hasMetadata = application['meta-data'].some(metadata => metadata['$']['android:name'] === name);
|
|
19
|
+
|
|
20
|
+
// Add metadata if it doesn't exist
|
|
21
|
+
if (!hasMetadata) {
|
|
22
|
+
application['meta-data'].push({
|
|
23
|
+
$: {
|
|
24
|
+
'android:name': name,
|
|
25
|
+
'android:value': value
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const withNotificationChannelMetadata = (config, props) => {
|
|
31
|
+
return (0, _configPlugins.withAndroidManifest)(config, manifestProps => {
|
|
32
|
+
var _props$pushNotificati;
|
|
33
|
+
const application = manifestProps.modResults.manifest.application;
|
|
34
|
+
const channel = (_props$pushNotificati = props.pushNotification) === null || _props$pushNotificati === void 0 ? void 0 : _props$pushNotificati.channel;
|
|
35
|
+
|
|
36
|
+
// Only proceed if channel configuration exists
|
|
37
|
+
if (channel && (channel.id || channel.name || channel.importance !== undefined)) {
|
|
38
|
+
if (channel.id) {
|
|
39
|
+
addMetadataIfNotExists(application[0], 'io.customer.notification_channel_id', channel.id);
|
|
40
|
+
}
|
|
41
|
+
if (channel.name) {
|
|
42
|
+
addMetadataIfNotExists(application[0], 'io.customer.notification_channel_name', channel.name);
|
|
43
|
+
}
|
|
44
|
+
if (channel.importance !== undefined) {
|
|
45
|
+
addMetadataIfNotExists(application[0], 'io.customer.notification_channel_importance', String(channel.importance));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
manifestProps.modResults.manifest.application = application;
|
|
49
|
+
return manifestProps;
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
exports.withNotificationChannelMetadata = withNotificationChannelMetadata;
|
|
53
|
+
//# sourceMappingURL=withNotificationChannelMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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.application as ManifestApplication[];\n const channel = props.pushNotification?.channel;\n\n // Only proceed if channel configuration exists\n if (channel && (channel.id || channel.name || channel.importance !== undefined)) {\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,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAKJ,IAClD,CAAC;;EAED;EACA,IAAI,CAACE,WAAW,EAAE;IAChBH,WAAW,CAAC,WAAW,CAAC,CAACM,IAAI,CAAC;MAC5BC,CAAC,EAAE;QACD,cAAc,EAAEN,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,CAACf,WAAoC;IAC1F,MAAMgB,OAAO,IAAAH,qBAAA,GAAGH,KAAK,CAACO,gBAAgB,cAAAJ,qBAAA,uBAAtBA,qBAAA,CAAwBG,OAAO;;IAE/C;IACA,IAAIA,OAAO,KAAKA,OAAO,CAACE,EAAE,IAAIF,OAAO,CAACf,IAAI,IAAIe,OAAO,CAACG,UAAU,KAAKC,SAAS,CAAC,EAAE;MAC/E,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":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["cio-types.ts"],"sourcesContent":["// properties set by the user in their app config file (e.g: app.json or app.plugin.js)\nexport type CustomerIOPluginProperties = {\n // (iOS only) Environment name and bundle identifier\n devTeam: string;\n iosDeploymentTarget: string;\n};\n\n// Plugin options for pre-build\nexport type CustomerIOPluginOptionsIOS = {\n iosPath: string;\n devTeam?: string;\n bundleVersion?: string;\n bundleShortVersion?: string;\n bundleIdentifier?: string;\n iosDeploymentTarget?: string;\n appleTeamId?: string;\n appName?: string;\n\n useFrameworks?: 'static' | 'dynamic';\n\n pushNotification?: CustomerIOPluginPushNotificationOptions;\n\n /**\n * @deprecated No longer has any effect. Use autoTrackPushEvents to control if push metrics should be automatically tracked by SDK.\n */\n handleNotificationClick?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.autoFetchDeviceToken instead\n */\n autoFetchDeviceToken?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.showPushAppInForeground instead\n */\n showPushAppInForeground?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.autoTrackPushEvents instead\n */\n autoTrackPushEvents?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.handleDeeplinkInKilledState instead\n */\n handleDeeplinkInKilledState?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.disableNotificationRegistration instead\n */\n disableNotificationRegistration?: boolean;\n};\n\nexport type CustomerIOPluginOptionsAndroid = {\n androidPath: string;\n googleServicesFile?: string;\n setHighPriorityPushHandler?: boolean;\n};\n\nexport type CustomerIOPluginOptions = {\n android: CustomerIOPluginOptionsAndroid;\n ios: CustomerIOPluginOptionsIOS;\n};\n\nexport type CustomerIOPluginPushNotificationOptions = {\n provider?: 'apn' | 'fcm';\n googleServicesFile?: string;\n useRichPush?: boolean;\n autoFetchDeviceToken?: boolean;\n autoTrackPushEvents?: boolean;\n showPushAppInForeground?: boolean;\n disableNotificationRegistration?: boolean;\n handleDeeplinkInKilledState?: boolean;\n\n /**\n * These values will be used to initialize the Notification Service Extension (NSE) on the native side.\n * They should match the values you use to initialize the SDK in your app\n */\n env: {\n cdpApiKey: string;\n region: string;\n };\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["cio-types.ts"],"sourcesContent":["// properties set by the user in their app config file (e.g: app.json or app.plugin.js)\nexport type CustomerIOPluginProperties = {\n // (iOS only) Environment name and bundle identifier\n devTeam: string;\n iosDeploymentTarget: string;\n};\n\n// Plugin options for pre-build\nexport type CustomerIOPluginOptionsIOS = {\n iosPath: string;\n devTeam?: string;\n bundleVersion?: string;\n bundleShortVersion?: string;\n bundleIdentifier?: string;\n iosDeploymentTarget?: string;\n appleTeamId?: string;\n appName?: string;\n\n useFrameworks?: 'static' | 'dynamic';\n\n pushNotification?: CustomerIOPluginPushNotificationOptions;\n\n /**\n * @deprecated No longer has any effect. Use autoTrackPushEvents to control if push metrics should be automatically tracked by SDK.\n */\n handleNotificationClick?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.autoFetchDeviceToken instead\n */\n autoFetchDeviceToken?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.showPushAppInForeground instead\n */\n showPushAppInForeground?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.autoTrackPushEvents instead\n */\n autoTrackPushEvents?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.handleDeeplinkInKilledState instead\n */\n handleDeeplinkInKilledState?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.disableNotificationRegistration instead\n */\n disableNotificationRegistration?: boolean;\n};\n\nexport type CustomerIOPluginOptionsAndroid = {\n androidPath: string;\n googleServicesFile?: string;\n setHighPriorityPushHandler?: boolean;\n pushNotification?: {\n channel?: {\n id?: string;\n name?: string;\n importance?: number;\n };\n };\n};\n\nexport type CustomerIOPluginOptions = {\n android: CustomerIOPluginOptionsAndroid;\n ios: CustomerIOPluginOptionsIOS;\n};\n\nexport type CustomerIOPluginPushNotificationOptions = {\n provider?: 'apn' | 'fcm';\n googleServicesFile?: string;\n useRichPush?: boolean;\n autoFetchDeviceToken?: boolean;\n autoTrackPushEvents?: boolean;\n showPushAppInForeground?: boolean;\n disableNotificationRegistration?: boolean;\n handleDeeplinkInKilledState?: boolean;\n\n /**\n * These values will be used to initialize the Notification Service Extension (NSE) on the native side.\n * They should match the values you use to initialize the SDK in your app\n */\n env: {\n cdpApiKey: string;\n region: string;\n };\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -2,9 +2,11 @@ import { withAndroidManifestUpdates } from './withAndroidManifestUpdates';
|
|
|
2
2
|
import { withAppGoogleServices } from './withAppGoogleServices';
|
|
3
3
|
import { withGistMavenRepository } from './withGistMavenRepository';
|
|
4
4
|
import { withGoogleServicesJSON } from './withGoogleServicesJSON';
|
|
5
|
+
import { withNotificationChannelMetadata } from './withNotificationChannelMetadata';
|
|
5
6
|
import { withProjectGoogleServices } from './withProjectGoogleServices';
|
|
6
7
|
import { withProjectStrings } from './withProjectStrings';
|
|
7
8
|
export function withCIOAndroid(config, props) {
|
|
9
|
+
var _props$pushNotificati;
|
|
8
10
|
config = withGistMavenRepository(config, props);
|
|
9
11
|
config = withProjectGoogleServices(config, props);
|
|
10
12
|
config = withAppGoogleServices(config, props);
|
|
@@ -13,6 +15,9 @@ export function withCIOAndroid(config, props) {
|
|
|
13
15
|
if (props.setHighPriorityPushHandler) {
|
|
14
16
|
config = withAndroidManifestUpdates(config, props);
|
|
15
17
|
}
|
|
18
|
+
if ((_props$pushNotificati = props.pushNotification) !== null && _props$pushNotificati !== void 0 && _props$pushNotificati.channel) {
|
|
19
|
+
config = withNotificationChannelMetadata(config, props);
|
|
20
|
+
}
|
|
16
21
|
return config;
|
|
17
22
|
}
|
|
18
23
|
//# sourceMappingURL=withCIOAndroid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withAndroidManifestUpdates","withAppGoogleServices","withGistMavenRepository","withGoogleServicesJSON","withProjectGoogleServices","withProjectStrings","withCIOAndroid","config","props","setHighPriorityPushHandler"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\nimport { withAndroidManifestUpdates } from './withAndroidManifestUpdates';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\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\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,yBAAyB,QAAQ,6BAA6B;AACvE,SAASC,kBAAkB,QAAQ,sBAAsB;AAEzD,OAAO,SAASC,cAAcA,CAC5BC,MAAkB,EAClBC,KAAqC,EACzB;
|
|
1
|
+
{"version":3,"names":["withAndroidManifestUpdates","withAppGoogleServices","withGistMavenRepository","withGoogleServicesJSON","withNotificationChannelMetadata","withProjectGoogleServices","withProjectStrings","withCIOAndroid","config","props","_props$pushNotificati","setHighPriorityPushHandler","pushNotification","channel"],"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,SAASA,0BAA0B,QAAQ,8BAA8B;AACzE,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,+BAA+B,QAAQ,mCAAmC;AACnF,SAASC,yBAAyB,QAAQ,6BAA6B;AACvE,SAASC,kBAAkB,QAAQ,sBAAsB;AAEzD,OAAO,SAASC,cAAcA,CAC5BC,MAAkB,EAClBC,KAAqC,EACzB;EAAA,IAAAC,qBAAA;EACZF,MAAM,GAAGN,uBAAuB,CAACM,MAAM,EAAEC,KAAK,CAAC;EAC/CD,MAAM,GAAGH,yBAAyB,CAACG,MAAM,EAAEC,KAAK,CAAC;EACjDD,MAAM,GAAGP,qBAAqB,CAACO,MAAM,EAAEC,KAAK,CAAC;EAC7CD,MAAM,GAAGL,sBAAsB,CAACK,MAAM,EAAEC,KAAK,CAAC;EAC9CD,MAAM,GAAGF,kBAAkB,CAACE,MAAM,CAAC;EACnC,IAAIC,KAAK,CAACE,0BAA0B,EAAE;IACpCH,MAAM,GAAGR,0BAA0B,CAACQ,MAAM,EAAEC,KAAK,CAAC;EACpD;EACA,KAAAC,qBAAA,GAAID,KAAK,CAACG,gBAAgB,cAAAF,qBAAA,eAAtBA,qBAAA,CAAwBG,OAAO,EAAE;IACnCL,MAAM,GAAGJ,+BAA+B,CAACI,MAAM,EAAEC,KAAK,CAAC;EACzD;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { withAndroidManifest } from '@expo/config-plugins';
|
|
2
|
+
/**
|
|
3
|
+
* Adds a metadata entry to the Android manifest if it doesn't already exist
|
|
4
|
+
*/
|
|
5
|
+
const addMetadataIfNotExists = (application, name, value) => {
|
|
6
|
+
// Initialize meta-data array if it doesn't exist
|
|
7
|
+
if (!application['meta-data']) {
|
|
8
|
+
application['meta-data'] = [];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Check if metadata already exists
|
|
12
|
+
const hasMetadata = application['meta-data'].some(metadata => metadata['$']['android:name'] === name);
|
|
13
|
+
|
|
14
|
+
// Add metadata if it doesn't exist
|
|
15
|
+
if (!hasMetadata) {
|
|
16
|
+
application['meta-data'].push({
|
|
17
|
+
$: {
|
|
18
|
+
'android:name': name,
|
|
19
|
+
'android:value': value
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export const withNotificationChannelMetadata = (config, props) => {
|
|
25
|
+
return withAndroidManifest(config, manifestProps => {
|
|
26
|
+
var _props$pushNotificati;
|
|
27
|
+
const application = manifestProps.modResults.manifest.application;
|
|
28
|
+
const channel = (_props$pushNotificati = props.pushNotification) === null || _props$pushNotificati === void 0 ? void 0 : _props$pushNotificati.channel;
|
|
29
|
+
|
|
30
|
+
// Only proceed if channel configuration exists
|
|
31
|
+
if (channel && (channel.id || channel.name || channel.importance !== undefined)) {
|
|
32
|
+
if (channel.id) {
|
|
33
|
+
addMetadataIfNotExists(application[0], 'io.customer.notification_channel_id', channel.id);
|
|
34
|
+
}
|
|
35
|
+
if (channel.name) {
|
|
36
|
+
addMetadataIfNotExists(application[0], 'io.customer.notification_channel_name', channel.name);
|
|
37
|
+
}
|
|
38
|
+
if (channel.importance !== undefined) {
|
|
39
|
+
addMetadataIfNotExists(application[0], 'io.customer.notification_channel_importance', String(channel.importance));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
manifestProps.modResults.manifest.application = application;
|
|
43
|
+
return manifestProps;
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=withNotificationChannelMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withAndroidManifest","addMetadataIfNotExists","application","name","value","hasMetadata","some","metadata","push","$","withNotificationChannelMetadata","config","props","manifestProps","_props$pushNotificati","modResults","manifest","channel","pushNotification","id","importance","undefined","String"],"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.application as ManifestApplication[];\n const channel = props.pushNotification?.channel;\n\n // Only proceed if channel configuration exists\n if (channel && (channel.id || channel.name || channel.importance !== undefined)) {\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,SAASA,mBAAmB,QAAQ,sBAAsB;AAK1D;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,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAKJ,IAClD,CAAC;;EAED;EACA,IAAI,CAACE,WAAW,EAAE;IAChBH,WAAW,CAAC,WAAW,CAAC,CAACM,IAAI,CAAC;MAC5BC,CAAC,EAAE;QACD,cAAc,EAAEN,IAAI;QACpB,eAAe,EAAEC;MACnB;IACF,CAAC,CAAC;EACJ;AACF,CAAC;AAED,OAAO,MAAMM,+BAEZ,GAAGA,CAACC,MAAM,EAAEC,KAAK,KAAK;EACrB,OAAOZ,mBAAmB,CAACW,MAAM,EAAGE,aAAa,IAAK;IAAA,IAAAC,qBAAA;IACpD,MAAMZ,WAAW,GAAGW,aAAa,CAACE,UAAU,CAACC,QAAQ,CAACd,WAAoC;IAC1F,MAAMe,OAAO,IAAAH,qBAAA,GAAGF,KAAK,CAACM,gBAAgB,cAAAJ,qBAAA,uBAAtBA,qBAAA,CAAwBG,OAAO;;IAE/C;IACA,IAAIA,OAAO,KAAKA,OAAO,CAACE,EAAE,IAAIF,OAAO,CAACd,IAAI,IAAIc,OAAO,CAACG,UAAU,KAAKC,SAAS,CAAC,EAAE;MAC/E,IAAIJ,OAAO,CAACE,EAAE,EAAE;QACdlB,sBAAsB,CACpBC,WAAW,CAAC,CAAC,CAAC,EACd,qCAAqC,EACrCe,OAAO,CAACE,EACV,CAAC;MACH;MAEA,IAAIF,OAAO,CAACd,IAAI,EAAE;QAChBF,sBAAsB,CACpBC,WAAW,CAAC,CAAC,CAAC,EACd,uCAAuC,EACvCe,OAAO,CAACd,IACV,CAAC;MACH;MAEA,IAAIc,OAAO,CAACG,UAAU,KAAKC,SAAS,EAAE;QACpCpB,sBAAsB,CACpBC,WAAW,CAAC,CAAC,CAAC,EACd,6CAA6C,EAC7CoB,MAAM,CAACL,OAAO,CAACG,UAAU,CAC3B,CAAC;MACH;IACF;IAEAP,aAAa,CAACE,UAAU,CAACC,QAAQ,CAACd,WAAW,GAAGA,WAAW;IAC3D,OAAOW,aAAa;EACtB,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["cio-types.ts"],"sourcesContent":["// properties set by the user in their app config file (e.g: app.json or app.plugin.js)\nexport type CustomerIOPluginProperties = {\n // (iOS only) Environment name and bundle identifier\n devTeam: string;\n iosDeploymentTarget: string;\n};\n\n// Plugin options for pre-build\nexport type CustomerIOPluginOptionsIOS = {\n iosPath: string;\n devTeam?: string;\n bundleVersion?: string;\n bundleShortVersion?: string;\n bundleIdentifier?: string;\n iosDeploymentTarget?: string;\n appleTeamId?: string;\n appName?: string;\n\n useFrameworks?: 'static' | 'dynamic';\n\n pushNotification?: CustomerIOPluginPushNotificationOptions;\n\n /**\n * @deprecated No longer has any effect. Use autoTrackPushEvents to control if push metrics should be automatically tracked by SDK.\n */\n handleNotificationClick?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.autoFetchDeviceToken instead\n */\n autoFetchDeviceToken?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.showPushAppInForeground instead\n */\n showPushAppInForeground?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.autoTrackPushEvents instead\n */\n autoTrackPushEvents?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.handleDeeplinkInKilledState instead\n */\n handleDeeplinkInKilledState?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.disableNotificationRegistration instead\n */\n disableNotificationRegistration?: boolean;\n};\n\nexport type CustomerIOPluginOptionsAndroid = {\n androidPath: string;\n googleServicesFile?: string;\n setHighPriorityPushHandler?: boolean;\n};\n\nexport type CustomerIOPluginOptions = {\n android: CustomerIOPluginOptionsAndroid;\n ios: CustomerIOPluginOptionsIOS;\n};\n\nexport type CustomerIOPluginPushNotificationOptions = {\n provider?: 'apn' | 'fcm';\n googleServicesFile?: string;\n useRichPush?: boolean;\n autoFetchDeviceToken?: boolean;\n autoTrackPushEvents?: boolean;\n showPushAppInForeground?: boolean;\n disableNotificationRegistration?: boolean;\n handleDeeplinkInKilledState?: boolean;\n\n /**\n * These values will be used to initialize the Notification Service Extension (NSE) on the native side.\n * They should match the values you use to initialize the SDK in your app\n */\n env: {\n cdpApiKey: string;\n region: string;\n };\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["cio-types.ts"],"sourcesContent":["// properties set by the user in their app config file (e.g: app.json or app.plugin.js)\nexport type CustomerIOPluginProperties = {\n // (iOS only) Environment name and bundle identifier\n devTeam: string;\n iosDeploymentTarget: string;\n};\n\n// Plugin options for pre-build\nexport type CustomerIOPluginOptionsIOS = {\n iosPath: string;\n devTeam?: string;\n bundleVersion?: string;\n bundleShortVersion?: string;\n bundleIdentifier?: string;\n iosDeploymentTarget?: string;\n appleTeamId?: string;\n appName?: string;\n\n useFrameworks?: 'static' | 'dynamic';\n\n pushNotification?: CustomerIOPluginPushNotificationOptions;\n\n /**\n * @deprecated No longer has any effect. Use autoTrackPushEvents to control if push metrics should be automatically tracked by SDK.\n */\n handleNotificationClick?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.autoFetchDeviceToken instead\n */\n autoFetchDeviceToken?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.showPushAppInForeground instead\n */\n showPushAppInForeground?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.autoTrackPushEvents instead\n */\n autoTrackPushEvents?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.handleDeeplinkInKilledState instead\n */\n handleDeeplinkInKilledState?: boolean;\n\n /**\n * @deprecated Property will be removed in the future. Use ios.pushNotification.disableNotificationRegistration instead\n */\n disableNotificationRegistration?: boolean;\n};\n\nexport type CustomerIOPluginOptionsAndroid = {\n androidPath: string;\n googleServicesFile?: string;\n setHighPriorityPushHandler?: boolean;\n pushNotification?: {\n channel?: {\n id?: string;\n name?: string;\n importance?: number;\n };\n };\n};\n\nexport type CustomerIOPluginOptions = {\n android: CustomerIOPluginOptionsAndroid;\n ios: CustomerIOPluginOptionsIOS;\n};\n\nexport type CustomerIOPluginPushNotificationOptions = {\n provider?: 'apn' | 'fcm';\n googleServicesFile?: string;\n useRichPush?: boolean;\n autoFetchDeviceToken?: boolean;\n autoTrackPushEvents?: boolean;\n showPushAppInForeground?: boolean;\n disableNotificationRegistration?: boolean;\n handleDeeplinkInKilledState?: boolean;\n\n /**\n * These values will be used to initialize the Notification Service Extension (NSE) on the native side.\n * They should match the values you use to initialize the SDK in your app\n */\n env: {\n cdpApiKey: string;\n region: string;\n };\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -42,6 +42,13 @@ export type CustomerIOPluginOptionsAndroid = {
|
|
|
42
42
|
androidPath: string;
|
|
43
43
|
googleServicesFile?: string;
|
|
44
44
|
setHighPriorityPushHandler?: boolean;
|
|
45
|
+
pushNotification?: {
|
|
46
|
+
channel?: {
|
|
47
|
+
id?: string;
|
|
48
|
+
name?: string;
|
|
49
|
+
importance?: number;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
45
52
|
};
|
|
46
53
|
export type CustomerIOPluginOptions = {
|
|
47
54
|
android: CustomerIOPluginOptionsAndroid;
|
|
@@ -5,6 +5,7 @@ import { withAndroidManifestUpdates } from './withAndroidManifestUpdates';
|
|
|
5
5
|
import { withAppGoogleServices } from './withAppGoogleServices';
|
|
6
6
|
import { withGistMavenRepository } from './withGistMavenRepository';
|
|
7
7
|
import { withGoogleServicesJSON } from './withGoogleServicesJSON';
|
|
8
|
+
import { withNotificationChannelMetadata } from './withNotificationChannelMetadata';
|
|
8
9
|
import { withProjectGoogleServices } from './withProjectGoogleServices';
|
|
9
10
|
import { withProjectStrings } from './withProjectStrings';
|
|
10
11
|
|
|
@@ -20,6 +21,9 @@ export function withCIOAndroid(
|
|
|
20
21
|
if (props.setHighPriorityPushHandler) {
|
|
21
22
|
config = withAndroidManifestUpdates(config, props);
|
|
22
23
|
}
|
|
24
|
+
if (props.pushNotification?.channel) {
|
|
25
|
+
config = withNotificationChannelMetadata(config, props);
|
|
26
|
+
}
|
|
23
27
|
|
|
24
28
|
return config;
|
|
25
29
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
+
import { withAndroidManifest } from '@expo/config-plugins';
|
|
3
|
+
import type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';
|
|
4
|
+
|
|
5
|
+
import type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Adds a metadata entry to the Android manifest if it doesn't already exist
|
|
9
|
+
*/
|
|
10
|
+
const addMetadataIfNotExists = (
|
|
11
|
+
application: ManifestApplication,
|
|
12
|
+
name: string,
|
|
13
|
+
value: string
|
|
14
|
+
): void => {
|
|
15
|
+
// Initialize meta-data array if it doesn't exist
|
|
16
|
+
if (!application['meta-data']) {
|
|
17
|
+
application['meta-data'] = [];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Check if metadata already exists
|
|
21
|
+
const hasMetadata = application['meta-data'].some(
|
|
22
|
+
(metadata) => metadata['$']['android:name'] === name
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
// Add metadata if it doesn't exist
|
|
26
|
+
if (!hasMetadata) {
|
|
27
|
+
application['meta-data'].push({
|
|
28
|
+
$: {
|
|
29
|
+
'android:name': name,
|
|
30
|
+
'android:value': value,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const withNotificationChannelMetadata: ConfigPlugin<
|
|
37
|
+
CustomerIOPluginOptionsAndroid
|
|
38
|
+
> = (config, props) => {
|
|
39
|
+
return withAndroidManifest(config, (manifestProps) => {
|
|
40
|
+
const application = manifestProps.modResults.manifest.application as ManifestApplication[];
|
|
41
|
+
const channel = props.pushNotification?.channel;
|
|
42
|
+
|
|
43
|
+
// Only proceed if channel configuration exists
|
|
44
|
+
if (channel && (channel.id || channel.name || channel.importance !== undefined)) {
|
|
45
|
+
if (channel.id) {
|
|
46
|
+
addMetadataIfNotExists(
|
|
47
|
+
application[0],
|
|
48
|
+
'io.customer.notification_channel_id',
|
|
49
|
+
channel.id
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (channel.name) {
|
|
54
|
+
addMetadataIfNotExists(
|
|
55
|
+
application[0],
|
|
56
|
+
'io.customer.notification_channel_name',
|
|
57
|
+
channel.name
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (channel.importance !== undefined) {
|
|
62
|
+
addMetadataIfNotExists(
|
|
63
|
+
application[0],
|
|
64
|
+
'io.customer.notification_channel_importance',
|
|
65
|
+
String(channel.importance)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
manifestProps.modResults.manifest.application = application;
|
|
71
|
+
return manifestProps;
|
|
72
|
+
});
|
|
73
|
+
};
|
|
@@ -55,6 +55,13 @@ export type CustomerIOPluginOptionsAndroid = {
|
|
|
55
55
|
androidPath: string;
|
|
56
56
|
googleServicesFile?: string;
|
|
57
57
|
setHighPriorityPushHandler?: boolean;
|
|
58
|
+
pushNotification?: {
|
|
59
|
+
channel?: {
|
|
60
|
+
id?: string;
|
|
61
|
+
name?: string;
|
|
62
|
+
importance?: number;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
58
65
|
};
|
|
59
66
|
|
|
60
67
|
export type CustomerIOPluginOptions = {
|