customerio-expo-plugin 1.0.0-beta.9 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/package.json +32 -24
- package/plugin/app.plugin.js +1 -0
- package/{lib → plugin/lib}/commonjs/android/withAndroidManifestUpdates.js.map +1 -1
- package/{lib → plugin/lib}/commonjs/android/withAppGoogleServices.js.map +1 -1
- package/{lib → plugin/lib}/commonjs/android/withCIOAndroid.js +2 -0
- package/plugin/lib/commonjs/android/withCIOAndroid.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/android/withGistMavenRepository.js.map +1 -1
- package/{lib → plugin/lib}/commonjs/android/withGoogleServicesJSON.js.map +1 -1
- package/{lib → plugin/lib}/commonjs/android/withProjectGoogleServices.js.map +1 -1
- package/plugin/lib/commonjs/android/withProjectStrings.js +70 -0
- package/plugin/lib/commonjs/android/withProjectStrings.js.map +1 -0
- package/plugin/lib/commonjs/helpers/constants/android.js +14 -0
- package/{lib → plugin/lib}/commonjs/helpers/constants/android.js.map +1 -1
- package/{lib → plugin/lib}/commonjs/helpers/constants/globals.d.js.map +1 -1
- package/plugin/lib/commonjs/helpers/constants/ios.js +119 -0
- package/plugin/lib/commonjs/helpers/constants/ios.js.map +1 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/apn/NotificationService.swift +25 -0
- package/{src/helpers/native-files/ios → plugin/lib/commonjs/helpers/native-files/ios/apn}/PushService.swift +11 -13
- package/plugin/lib/commonjs/helpers/native-files/ios/common/Env.swift +7 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/fcm/NotificationService.swift +25 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/fcm/PushService.swift +59 -0
- package/{lib → plugin/lib}/commonjs/helpers/utils/codeInjection.js +9 -1
- package/plugin/lib/commonjs/helpers/utils/codeInjection.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/helpers/utils/fileManagement.js.map +1 -1
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +50 -0
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -0
- package/plugin/lib/commonjs/helpers/utils/pluginUtils.js +26 -0
- package/plugin/lib/commonjs/helpers/utils/pluginUtils.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/index.js +1 -2
- package/{lib → plugin/lib}/commonjs/index.js.map +1 -1
- package/plugin/lib/commonjs/ios/utils.js +17 -0
- package/plugin/lib/commonjs/ios/utils.js.map +1 -0
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js +151 -0
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/ios/withCIOIos.js +2 -0
- package/plugin/lib/commonjs/ios/withCIOIos.js.map +1 -0
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js +68 -0
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/ios/withNotificationsXcodeProject.js +59 -45
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/ios/withXcodeProject.js +2 -1
- package/plugin/lib/commonjs/ios/withXcodeProject.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/postInstall.js.map +1 -1
- package/plugin/lib/commonjs/postInstallHelper.js +22 -0
- package/plugin/lib/commonjs/postInstallHelper.js.map +1 -0
- package/plugin/lib/commonjs/types/cio-types.js.map +1 -0
- package/{lib → plugin/lib}/module/android/withAndroidManifestUpdates.js.map +1 -1
- package/{lib → plugin/lib}/module/android/withAppGoogleServices.js.map +1 -1
- package/{lib → plugin/lib}/module/android/withCIOAndroid.js +2 -0
- package/plugin/lib/module/android/withCIOAndroid.js.map +1 -0
- package/{lib → plugin/lib}/module/android/withGistMavenRepository.js.map +1 -1
- package/{lib → plugin/lib}/module/android/withGoogleServicesJSON.js.map +1 -1
- package/{lib → plugin/lib}/module/android/withProjectGoogleServices.js.map +1 -1
- package/plugin/lib/module/android/withProjectStrings.js +63 -0
- package/plugin/lib/module/android/withProjectStrings.js.map +1 -0
- package/{lib → plugin/lib}/module/helpers/constants/android.js.map +1 -1
- package/{lib → plugin/lib}/module/helpers/constants/globals.d.js.map +1 -1
- package/plugin/lib/module/helpers/constants/ios.js +112 -0
- package/plugin/lib/module/helpers/constants/ios.js.map +1 -0
- package/plugin/lib/module/helpers/native-files/ios/apn/NotificationService.swift +25 -0
- package/{lib/commonjs/helpers/native-files/ios → plugin/lib/module/helpers/native-files/ios/apn}/PushService.swift +11 -13
- package/plugin/lib/module/helpers/native-files/ios/common/Env.swift +7 -0
- package/plugin/lib/module/helpers/native-files/ios/fcm/NotificationService.swift +25 -0
- package/plugin/lib/module/helpers/native-files/ios/fcm/PushService.swift +59 -0
- package/{lib → plugin/lib}/module/helpers/utils/codeInjection.js +7 -1
- package/plugin/lib/module/helpers/utils/codeInjection.js.map +1 -0
- package/{lib → plugin/lib}/module/helpers/utils/fileManagement.js.map +1 -1
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js +43 -0
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -0
- package/plugin/lib/module/helpers/utils/pluginUtils.js +19 -0
- package/plugin/lib/module/helpers/utils/pluginUtils.js.map +1 -0
- package/{lib → plugin/lib}/module/index.js.map +1 -1
- package/plugin/lib/module/ios/utils.js +10 -0
- package/plugin/lib/module/ios/utils.js.map +1 -0
- package/plugin/lib/module/ios/withAppDelegateModifications.js +144 -0
- package/plugin/lib/module/ios/withAppDelegateModifications.js.map +1 -0
- package/{lib → plugin/lib}/module/ios/withCIOIos.js +2 -0
- package/plugin/lib/module/ios/withCIOIos.js.map +1 -0
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js +61 -0
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js.map +1 -0
- package/{lib → plugin/lib}/module/ios/withNotificationsXcodeProject.js +59 -44
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js.map +1 -0
- package/{lib → plugin/lib}/module/ios/withXcodeProject.js +2 -1
- package/plugin/lib/module/ios/withXcodeProject.js.map +1 -0
- package/{lib → plugin/lib}/module/postInstall.js.map +1 -1
- package/plugin/lib/module/postInstallHelper.js +20 -0
- package/plugin/lib/module/postInstallHelper.js.map +1 -0
- package/plugin/lib/module/types/cio-types.js.map +1 -0
- package/plugin/lib/typescript/android/withProjectStrings.d.ts +15 -0
- package/plugin/lib/typescript/helpers/constants/ios.d.ts +30 -0
- package/{lib → plugin/lib}/typescript/helpers/utils/codeInjection.d.ts +3 -1
- package/{lib → plugin/lib}/typescript/helpers/utils/injectCIOPodfileCode.d.ts +2 -2
- package/plugin/lib/typescript/helpers/utils/pluginUtils.d.ts +4 -0
- package/plugin/lib/typescript/ios/utils.d.ts +7 -0
- package/plugin/lib/typescript/ios/withGoogleServicesJsonFile.d.ts +3 -0
- package/{lib → plugin/lib}/typescript/types/cio-types.d.ts +11 -2
- package/{src → plugin/src}/android/withCIOAndroid.ts +2 -0
- package/plugin/src/android/withProjectStrings.ts +57 -0
- package/plugin/src/helpers/constants/ios.ts +144 -0
- package/plugin/src/helpers/native-files/ios/apn/NotificationService.swift +25 -0
- package/{lib/module/helpers/native-files/ios → plugin/src/helpers/native-files/ios/apn}/PushService.swift +11 -13
- package/plugin/src/helpers/native-files/ios/common/Env.swift +7 -0
- package/plugin/src/helpers/native-files/ios/fcm/NotificationService.swift +25 -0
- package/plugin/src/helpers/native-files/ios/fcm/PushService.swift +59 -0
- package/{src → plugin/src}/helpers/utils/codeInjection.ts +12 -1
- package/plugin/src/helpers/utils/injectCIOPodfileCode.ts +68 -0
- package/plugin/src/helpers/utils/pluginUtils.ts +22 -0
- package/plugin/src/ios/utils.ts +10 -0
- package/{src → plugin/src}/ios/withAppDelegateModifications.ts +133 -23
- package/{src → plugin/src}/ios/withCIOIos.ts +2 -0
- package/plugin/src/ios/withGoogleServicesJsonFile.ts +97 -0
- package/{src → plugin/src}/ios/withNotificationsXcodeProject.ts +97 -47
- package/{src → plugin/src}/ios/withXcodeProject.ts +2 -1
- package/plugin/src/postInstallHelper.js +32 -0
- package/{src → plugin/src}/types/cio-types.ts +11 -2
- package/lib/commonjs/android/withCIOAndroid.js.map +0 -1
- package/lib/commonjs/helpers/constants/android.js +0 -21
- package/lib/commonjs/helpers/constants/ios.js +0 -121
- package/lib/commonjs/helpers/constants/ios.js.map +0 -1
- package/lib/commonjs/helpers/native-files/ios/Env.swift +0 -8
- package/lib/commonjs/helpers/native-files/ios/NotificationService.swift +0 -22
- package/lib/commonjs/helpers/utils/codeInjection.js.map +0 -1
- package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +0 -36
- package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +0 -1
- package/lib/commonjs/ios/withAppDelegateModifications.js +0 -89
- package/lib/commonjs/ios/withAppDelegateModifications.js.map +0 -1
- package/lib/commonjs/ios/withCIOIos.js.map +0 -1
- package/lib/commonjs/ios/withNotificationsXcodeProject.js.map +0 -1
- package/lib/commonjs/ios/withXcodeProject.js.map +0 -1
- package/lib/commonjs/postInstallHelper.js +0 -20
- package/lib/commonjs/postInstallHelper.js.map +0 -1
- package/lib/commonjs/types/cio-types.js.map +0 -1
- package/lib/module/android/withCIOAndroid.js.map +0 -1
- package/lib/module/helpers/constants/ios.js +0 -84
- package/lib/module/helpers/constants/ios.js.map +0 -1
- package/lib/module/helpers/native-files/ios/Env.swift +0 -8
- package/lib/module/helpers/native-files/ios/NotificationService.swift +0 -22
- package/lib/module/helpers/utils/codeInjection.js.map +0 -1
- package/lib/module/helpers/utils/injectCIOPodfileCode.js +0 -29
- package/lib/module/helpers/utils/injectCIOPodfileCode.js.map +0 -1
- package/lib/module/ios/withAppDelegateModifications.js +0 -82
- package/lib/module/ios/withAppDelegateModifications.js.map +0 -1
- package/lib/module/ios/withCIOIos.js.map +0 -1
- package/lib/module/ios/withNotificationsXcodeProject.js.map +0 -1
- package/lib/module/ios/withXcodeProject.js.map +0 -1
- package/lib/module/postInstallHelper.js +0 -18
- package/lib/module/postInstallHelper.js.map +0 -1
- package/lib/module/types/cio-types.js.map +0 -1
- package/lib/typescript/helpers/constants/ios.d.ts +0 -31
- package/src/helpers/constants/ios.ts +0 -104
- package/src/helpers/native-files/ios/Env.swift +0 -8
- package/src/helpers/native-files/ios/NotificationService.swift +0 -22
- package/src/helpers/utils/injectCIOPodfileCode.ts +0 -54
- package/src/postInstallHelper.js +0 -22
- /package/{lib → plugin/lib}/commonjs/android/withAndroidManifestUpdates.js +0 -0
- /package/{lib → plugin/lib}/commonjs/android/withAppGoogleServices.js +0 -0
- /package/{lib → plugin/lib}/commonjs/android/withGistMavenRepository.js +0 -0
- /package/{lib → plugin/lib}/commonjs/android/withGoogleServicesJSON.js +0 -0
- /package/{lib → plugin/lib}/commonjs/android/withProjectGoogleServices.js +0 -0
- /package/{lib → plugin/lib}/commonjs/helpers/constants/globals.d.js +0 -0
- /package/{lib/commonjs/helpers/native-files/ios → plugin/lib/commonjs/helpers/native-files/ios/common}/NotificationService-Info.plist +0 -0
- /package/{lib/commonjs/helpers/native-files/ios → plugin/lib/commonjs/helpers/native-files/ios/common}/NotificationService.h +0 -0
- /package/{lib/commonjs/helpers/native-files/ios → plugin/lib/commonjs/helpers/native-files/ios/common}/NotificationService.m +0 -0
- /package/{lib → plugin/lib}/commonjs/helpers/utils/fileManagement.js +0 -0
- /package/{lib → plugin/lib}/commonjs/postInstall.js +0 -0
- /package/{lib → plugin/lib}/commonjs/types/cio-types.js +0 -0
- /package/{lib → plugin/lib}/module/android/withAndroidManifestUpdates.js +0 -0
- /package/{lib → plugin/lib}/module/android/withAppGoogleServices.js +0 -0
- /package/{lib → plugin/lib}/module/android/withGistMavenRepository.js +0 -0
- /package/{lib → plugin/lib}/module/android/withGoogleServicesJSON.js +0 -0
- /package/{lib → plugin/lib}/module/android/withProjectGoogleServices.js +0 -0
- /package/{lib → plugin/lib}/module/helpers/constants/android.js +0 -0
- /package/{lib → plugin/lib}/module/helpers/constants/globals.d.js +0 -0
- /package/{lib/module/helpers/native-files/ios → plugin/lib/module/helpers/native-files/ios/common}/NotificationService-Info.plist +0 -0
- /package/{lib/module/helpers/native-files/ios → plugin/lib/module/helpers/native-files/ios/common}/NotificationService.h +0 -0
- /package/{lib/module/helpers/native-files/ios → plugin/lib/module/helpers/native-files/ios/common}/NotificationService.m +0 -0
- /package/{lib → plugin/lib}/module/helpers/utils/fileManagement.js +0 -0
- /package/{lib → plugin/lib}/module/index.js +0 -0
- /package/{lib → plugin/lib}/module/postInstall.js +0 -0
- /package/{lib → plugin/lib}/module/types/cio-types.js +0 -0
- /package/{lib → plugin/lib}/typescript/android/withAndroidManifestUpdates.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/android/withAppGoogleServices.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/android/withCIOAndroid.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/android/withGistMavenRepository.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/android/withGoogleServicesJSON.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/android/withProjectGoogleServices.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/helpers/constants/android.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/helpers/utils/fileManagement.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/index.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/ios/withAppDelegateModifications.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/ios/withCIOIos.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/ios/withNotificationsXcodeProject.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/ios/withXcodeProject.d.ts +0 -0
- /package/{src → plugin/src}/android/withAndroidManifestUpdates.ts +0 -0
- /package/{src → plugin/src}/android/withAppGoogleServices.ts +0 -0
- /package/{src → plugin/src}/android/withGistMavenRepository.ts +0 -0
- /package/{src → plugin/src}/android/withGoogleServicesJSON.ts +0 -0
- /package/{src → plugin/src}/android/withProjectGoogleServices.ts +0 -0
- /package/{src → plugin/src}/helpers/constants/android.ts +0 -0
- /package/{src → plugin/src}/helpers/constants/globals.d.ts +0 -0
- /package/{src/helpers/native-files/ios → plugin/src/helpers/native-files/ios/common}/NotificationService-Info.plist +0 -0
- /package/{src/helpers/native-files/ios → plugin/src/helpers/native-files/ios/common}/NotificationService.h +0 -0
- /package/{src/helpers/native-files/ios → plugin/src/helpers/native-files/ios/common}/NotificationService.m +0 -0
- /package/{src → plugin/src}/helpers/utils/fileManagement.ts +0 -0
- /package/{src → plugin/src}/index.ts +0 -0
- /package/{src → plugin/src}/postInstall.js +0 -0
|
@@ -5,37 +5,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.withCioNotificationsXcodeProject = void 0;
|
|
7
7
|
var _configPlugins = require("@expo/config-plugins");
|
|
8
|
-
var _xcode = _interopRequireDefault(require("xcode"));
|
|
9
8
|
var _ios = require("../helpers/constants/ios");
|
|
10
9
|
var _codeInjection = require("../helpers/utils/codeInjection");
|
|
11
10
|
var _injectCIOPodfileCode = require("../helpers/utils/injectCIOPodfileCode");
|
|
12
11
|
var _fileManagement = require("./../helpers/utils/fileManagement");
|
|
13
|
-
|
|
12
|
+
var _utils = require("./utils");
|
|
14
13
|
const PLIST_FILENAME = `${_ios.CIO_NOTIFICATION_TARGET_NAME}-Info.plist`;
|
|
15
14
|
const ENV_FILENAME = 'Env.swift';
|
|
16
15
|
const TARGETED_DEVICE_FAMILY = `"1,2"`;
|
|
17
|
-
const addNotificationServiceExtension = async options => {
|
|
18
|
-
|
|
19
|
-
// See function withCioNotificationsXcodeProject to get where the variabes are pulled from.
|
|
20
|
-
const {
|
|
21
|
-
iosPath,
|
|
22
|
-
appName
|
|
23
|
-
} = options;
|
|
24
|
-
const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`;
|
|
25
|
-
const xcodeProject = _xcode.default.project(projPath);
|
|
26
|
-
xcodeProject.parse(async function (err) {
|
|
16
|
+
const addNotificationServiceExtension = async (options, xcodeProject) => {
|
|
17
|
+
try {
|
|
27
18
|
var _options$pushNotifica;
|
|
28
|
-
if (err) {
|
|
29
|
-
throw new Error(`Error parsing iOS project: ${JSON.stringify(err)}`);
|
|
30
|
-
}
|
|
31
19
|
if (options.pushNotification) {
|
|
32
20
|
await addPushNotificationFile(options, xcodeProject);
|
|
33
21
|
}
|
|
34
22
|
if ((_options$pushNotifica = options.pushNotification) !== null && _options$pushNotifica !== void 0 && _options$pushNotifica.useRichPush) {
|
|
35
23
|
await addRichPushXcodeProj(options, xcodeProject);
|
|
36
24
|
}
|
|
37
|
-
|
|
38
|
-
})
|
|
25
|
+
return xcodeProject;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error(error);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
39
30
|
};
|
|
40
31
|
const withCioNotificationsXcodeProject = (configOuter, props) => {
|
|
41
32
|
return (0, _configPlugins.withXcodeProject)(configOuter, async config => {
|
|
@@ -82,7 +73,10 @@ const withCioNotificationsXcodeProject = (configOuter, props) => {
|
|
|
82
73
|
iosDeploymentTarget,
|
|
83
74
|
pushNotification
|
|
84
75
|
};
|
|
85
|
-
await addNotificationServiceExtension(options);
|
|
76
|
+
const modifiedProjectFile = await addNotificationServiceExtension(options, config.modResults);
|
|
77
|
+
if (modifiedProjectFile) {
|
|
78
|
+
config.modResults = modifiedProjectFile;
|
|
79
|
+
}
|
|
86
80
|
return config;
|
|
87
81
|
});
|
|
88
82
|
};
|
|
@@ -97,7 +91,8 @@ const addRichPushXcodeProj = async (options, xcodeProject) => {
|
|
|
97
91
|
iosDeploymentTarget,
|
|
98
92
|
useFrameworks
|
|
99
93
|
} = options;
|
|
100
|
-
|
|
94
|
+
const isFcmProvider = (0, _utils.isFcmPushProvider)(options);
|
|
95
|
+
await (0, _injectCIOPodfileCode.injectCIONotificationPodfileCode)(iosPath, useFrameworks, isFcmProvider);
|
|
101
96
|
|
|
102
97
|
// Check if `CIO_NOTIFICATION_TARGET_NAME` group already exist in the project
|
|
103
98
|
// If true then skip creating a new group to avoid duplicate folders
|
|
@@ -109,11 +104,19 @@ const addRichPushXcodeProj = async (options, xcodeProject) => {
|
|
|
109
104
|
_fileManagement.FileManagement.mkdir(nsePath, {
|
|
110
105
|
recursive: true
|
|
111
106
|
});
|
|
112
|
-
const
|
|
107
|
+
const platformSpecificFiles = ['NotificationService.swift'];
|
|
108
|
+
const commonFiles = [PLIST_FILENAME, 'NotificationService.h', 'NotificationService.m', ENV_FILENAME];
|
|
113
109
|
const getTargetFile = filename => `${nsePath}/${filename}`;
|
|
114
|
-
|
|
110
|
+
// Copy platform-specific files
|
|
111
|
+
platformSpecificFiles.forEach(filename => {
|
|
112
|
+
const targetFile = getTargetFile(filename);
|
|
113
|
+
_fileManagement.FileManagement.copyFile(`${_ios.LOCAL_PATH_TO_CIO_NSE_FILES}/${isFcmProvider ? "fcm" : "apn"}/${filename}`, targetFile);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// Copy common files
|
|
117
|
+
commonFiles.forEach(filename => {
|
|
115
118
|
const targetFile = getTargetFile(filename);
|
|
116
|
-
_fileManagement.FileManagement.copyFile(`${_ios.LOCAL_PATH_TO_CIO_NSE_FILES}/${filename}`, targetFile);
|
|
119
|
+
_fileManagement.FileManagement.copyFile(`${_ios.LOCAL_PATH_TO_CIO_NSE_FILES}/common/${filename}`, targetFile);
|
|
117
120
|
});
|
|
118
121
|
|
|
119
122
|
/* MODIFY COPIED EXTENSION FILES */
|
|
@@ -126,7 +129,9 @@ const addRichPushXcodeProj = async (options, xcodeProject) => {
|
|
|
126
129
|
updateNseEnv(options, getTargetFile(ENV_FILENAME));
|
|
127
130
|
|
|
128
131
|
// Create new PBXGroup for the extension
|
|
129
|
-
const extGroup = xcodeProject.addPbxGroup(
|
|
132
|
+
const extGroup = xcodeProject.addPbxGroup([...platformSpecificFiles, ...commonFiles],
|
|
133
|
+
// Combine platform-specific and common files,
|
|
134
|
+
_ios.CIO_NOTIFICATION_TARGET_NAME, _ios.CIO_NOTIFICATION_TARGET_NAME);
|
|
130
135
|
|
|
131
136
|
// Add the new PBXGroup to the top level group. This makes the
|
|
132
137
|
// files / folder appear in the file explorer in Xcode.
|
|
@@ -164,7 +169,7 @@ const addRichPushXcodeProj = async (options, xcodeProject) => {
|
|
|
164
169
|
if (typeof configurations[key].buildSettings !== 'undefined' && configurations[key].buildSettings.PRODUCT_NAME === `"${_ios.CIO_NOTIFICATION_TARGET_NAME}"`) {
|
|
165
170
|
const buildSettingsObj = configurations[key].buildSettings;
|
|
166
171
|
buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;
|
|
167
|
-
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = iosDeploymentTarget || '
|
|
172
|
+
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET = iosDeploymentTarget || '15.1';
|
|
168
173
|
buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;
|
|
169
174
|
buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';
|
|
170
175
|
buildSettingsObj.SWIFT_VERSION = 4.2;
|
|
@@ -188,30 +193,25 @@ const updateNseInfoPlist = payload => {
|
|
|
188
193
|
_fileManagement.FileManagement.writeFile(payload.infoPlistTargetFile, plistFileString);
|
|
189
194
|
};
|
|
190
195
|
const updateNseEnv = (options, envFileName) => {
|
|
191
|
-
var _options$pushNotifica2, _options$
|
|
192
|
-
const
|
|
193
|
-
const API_KEY_RE = /\{\{API_KEY\}\}/;
|
|
196
|
+
var _options$pushNotifica2, _options$pushNotifica4;
|
|
197
|
+
const CDP_API_KEY_RE = /\{\{CDP_API_KEY\}\}/;
|
|
194
198
|
const REGION_RE = /\{\{REGION\}\}/;
|
|
195
199
|
let envFileContent = _fileManagement.FileManagement.readFile(envFileName);
|
|
196
|
-
if ((_options$pushNotifica2 = options.pushNotification) !== null && _options$pushNotifica2 !== void 0 && (_options$
|
|
197
|
-
var _options$
|
|
198
|
-
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent,
|
|
199
|
-
}
|
|
200
|
-
if ((_options$pushNotifica6 = options.pushNotification) !== null && _options$pushNotifica6 !== void 0 && (_options$pushNotifica7 = _options$pushNotifica6.env) !== null && _options$pushNotifica7 !== void 0 && _options$pushNotifica7.apiKey) {
|
|
201
|
-
var _options$pushNotifica8, _options$pushNotifica9;
|
|
202
|
-
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, API_KEY_RE, (_options$pushNotifica8 = options.pushNotification) === null || _options$pushNotifica8 === void 0 ? void 0 : (_options$pushNotifica9 = _options$pushNotifica8.env) === null || _options$pushNotifica9 === void 0 ? void 0 : _options$pushNotifica9.apiKey);
|
|
200
|
+
if ((_options$pushNotifica2 = options.pushNotification) !== null && _options$pushNotifica2 !== void 0 && (_options$pushNotifica2 = _options$pushNotifica2.env) !== null && _options$pushNotifica2 !== void 0 && _options$pushNotifica2.cdpApiKey) {
|
|
201
|
+
var _options$pushNotifica3;
|
|
202
|
+
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, CDP_API_KEY_RE, (_options$pushNotifica3 = options.pushNotification) === null || _options$pushNotifica3 === void 0 || (_options$pushNotifica3 = _options$pushNotifica3.env) === null || _options$pushNotifica3 === void 0 ? void 0 : _options$pushNotifica3.cdpApiKey);
|
|
203
203
|
}
|
|
204
|
-
if ((_options$
|
|
205
|
-
var _options$
|
|
204
|
+
if ((_options$pushNotifica4 = options.pushNotification) !== null && _options$pushNotifica4 !== void 0 && (_options$pushNotifica4 = _options$pushNotifica4.env) !== null && _options$pushNotifica4 !== void 0 && _options$pushNotifica4.region) {
|
|
205
|
+
var _options$pushNotifica5;
|
|
206
206
|
const regionMap = {
|
|
207
207
|
us: 'Region.US',
|
|
208
208
|
eu: 'Region.EU'
|
|
209
209
|
};
|
|
210
|
-
const region = (_options$
|
|
210
|
+
const region = (_options$pushNotifica5 = options.pushNotification) === null || _options$pushNotifica5 === void 0 || (_options$pushNotifica5 = _options$pushNotifica5.env) === null || _options$pushNotifica5 === void 0 || (_options$pushNotifica5 = _options$pushNotifica5.region) === null || _options$pushNotifica5 === void 0 ? void 0 : _options$pushNotifica5.toLowerCase();
|
|
211
211
|
const mappedRegion = regionMap[region] || '';
|
|
212
212
|
if (!mappedRegion) {
|
|
213
|
-
var _options$
|
|
214
|
-
console.warn(`${(_options$
|
|
213
|
+
var _options$pushNotifica6;
|
|
214
|
+
console.warn(`${(_options$pushNotifica6 = options.pushNotification) === null || _options$pushNotifica6 === void 0 || (_options$pushNotifica6 = _options$pushNotifica6.env) === null || _options$pushNotifica6 === void 0 ? void 0 : _options$pushNotifica6.region} is an invalid region. Please use the values from the docs: https://customer.io/docs/sdk/expo/getting-started/#configure-the-plugin`);
|
|
215
215
|
} else {
|
|
216
216
|
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, REGION_RE, mappedRegion);
|
|
217
217
|
}
|
|
@@ -219,24 +219,28 @@ const updateNseEnv = (options, envFileName) => {
|
|
|
219
219
|
_fileManagement.FileManagement.writeFile(envFileName, envFileContent);
|
|
220
220
|
};
|
|
221
221
|
async function addPushNotificationFile(options, xcodeProject) {
|
|
222
|
+
// Maybe copy a different file with FCM config based on config
|
|
222
223
|
const {
|
|
223
224
|
iosPath,
|
|
224
225
|
appName
|
|
225
226
|
} = options;
|
|
226
|
-
const
|
|
227
|
+
const isFcmProvider = (0, _utils.isFcmPushProvider)(options);
|
|
228
|
+
// PushService.swift is platform-specific and always lives in the platform folder
|
|
229
|
+
const sourceFile = `${isFcmProvider ? "fcm" : "apn"}/PushService.swift`;
|
|
230
|
+
const targetFileName = 'PushService.swift';
|
|
227
231
|
const appPath = `${iosPath}/${appName}`;
|
|
228
232
|
const getTargetFile = filename => `${appPath}/${filename}`;
|
|
229
|
-
const targetFile = getTargetFile(
|
|
233
|
+
const targetFile = getTargetFile(targetFileName);
|
|
230
234
|
|
|
231
235
|
// Check whether {file} exists in the project. If false, then add the file
|
|
232
236
|
// If {file} exists then skip and return
|
|
233
|
-
if (!_fileManagement.FileManagement.exists(getTargetFile(
|
|
237
|
+
if (!_fileManagement.FileManagement.exists(getTargetFile(targetFileName))) {
|
|
234
238
|
_fileManagement.FileManagement.mkdir(appPath, {
|
|
235
239
|
recursive: true
|
|
236
240
|
});
|
|
237
|
-
_fileManagement.FileManagement.copyFile(`${_ios.LOCAL_PATH_TO_CIO_NSE_FILES}/${
|
|
241
|
+
_fileManagement.FileManagement.copyFile(`${_ios.LOCAL_PATH_TO_CIO_NSE_FILES}/${sourceFile}`, targetFile);
|
|
238
242
|
} else {
|
|
239
|
-
console.log(`${getTargetFile(
|
|
243
|
+
console.log(`${getTargetFile(targetFileName)} already exists. Skipping...`);
|
|
240
244
|
return;
|
|
241
245
|
}
|
|
242
246
|
updatePushFile(options, targetFile);
|
|
@@ -245,7 +249,7 @@ async function addPushNotificationFile(options, xcodeProject) {
|
|
|
245
249
|
name: `${appName}`
|
|
246
250
|
});
|
|
247
251
|
xcodeProject.addToPbxGroup(group, classesKey);
|
|
248
|
-
xcodeProject.addSourceFile(`${appName}/${
|
|
252
|
+
xcodeProject.addSourceFile(`${appName}/${targetFileName}`, null, group);
|
|
249
253
|
}
|
|
250
254
|
const updatePushFile = (options, envFileName) => {
|
|
251
255
|
const REGISTER_RE = /\{\{REGISTER_SNIPPET\}\}/;
|
|
@@ -255,6 +259,16 @@ const updatePushFile = (options, envFileName) => {
|
|
|
255
259
|
snippet = _ios.CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;
|
|
256
260
|
}
|
|
257
261
|
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, REGISTER_RE, snippet);
|
|
262
|
+
if (options.pushNotification) {
|
|
263
|
+
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{CDP_API_KEY\}\}/, options.pushNotification.env.cdpApiKey);
|
|
264
|
+
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{REGION\}\}/, options.pushNotification.env.region.toUpperCase());
|
|
265
|
+
}
|
|
266
|
+
const autoTrackPushEvents = options.autoTrackPushEvents === undefined || options.autoTrackPushEvents === true;
|
|
267
|
+
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{AUTO_TRACK_PUSH_EVENTS\}\}/, autoTrackPushEvents.toString());
|
|
268
|
+
const autoFetchDeviceToken = options.autoFetchDeviceToken === undefined || options.autoFetchDeviceToken === true;
|
|
269
|
+
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{AUTO_FETCH_DEVICE_TOKEN\}\}/, autoFetchDeviceToken.toString());
|
|
270
|
+
const showPushAppInForeground = options.showPushAppInForeground === undefined || options.showPushAppInForeground === true;
|
|
271
|
+
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{SHOW_PUSH_APP_IN_FOREGROUND\}\}/, showPushAppInForeground.toString());
|
|
258
272
|
_fileManagement.FileManagement.writeFile(envFileName, envFileContent);
|
|
259
273
|
};
|
|
260
274
|
//# sourceMappingURL=withNotificationsXcodeProject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_ios","_codeInjection","_injectCIOPodfileCode","_fileManagement","_utils","PLIST_FILENAME","CIO_NOTIFICATION_TARGET_NAME","ENV_FILENAME","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","console","withCioNotificationsXcodeProject","configOuter","props","withXcodeProject","config","modRequest","ios","version","bundleShortVersion","appleTeamId","iosDeploymentTarget","useFrameworks","undefined","Error","projectName","platformProjectRoot","bundleIdentifier","buildNumber","bundleVersion","DEFAULT_BUNDLE_VERSION","iosPath","appName","modifiedProjectFile","modResults","exports","isFcmProvider","isFcmPushProvider","injectCIONotificationPodfileCode","pbxTargetByName","warn","nsePath","FileManagement","mkdir","recursive","platformSpecificFiles","commonFiles","getTargetFile","filename","forEach","targetFile","copyFile","LOCAL_PATH_TO_CIO_NSE_FILES","infoPlistTargetFile","updateNseInfoPlist","updateNseEnv","extGroup","addPbxGroup","groups","hash","project","objects","Object","keys","key","name","path","addToPbxGroup","uuid","projObjects","nseTarget","addTarget","addBuildPhase","configurations","pbxXCBuildConfigurationSection","buildSettings","PRODUCT_NAME","buildSettingsObj","DEVELOPMENT_TEAM","IPHONEOS_DEPLOYMENT_TARGET","CODE_SIGN_STYLE","SWIFT_VERSION","addTargetAttribute","payload","BUNDLE_SHORT_VERSION_RE","BUNDLE_VERSION_RE","plistFileString","readFile","replaceCodeByRegex","writeFile","envFileName","_options$pushNotifica2","_options$pushNotifica4","CDP_API_KEY_RE","REGION_RE","envFileContent","env","cdpApiKey","_options$pushNotifica3","region","_options$pushNotifica5","regionMap","us","eu","toLowerCase","mappedRegion","_options$pushNotifica6","sourceFile","targetFileName","appPath","exists","log","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","REGISTER_RE","snippet","disableNotificationRegistration","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","toUpperCase","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import {\n ConfigPlugin,\n XcodeProject,\n withXcodeProject,\n} from '@expo/config-plugins';\n\nimport {\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_REGISTER_PUSHNOTIFICATION_SNIPPET,\n DEFAULT_BUNDLE_VERSION,\n LOCAL_PATH_TO_CIO_NSE_FILES,\n} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { injectCIONotificationPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport { isFcmPushProvider } from './utils';\n\nconst PLIST_FILENAME = `${CIO_NOTIFICATION_TARGET_NAME}-Info.plist`;\nconst ENV_FILENAME = 'Env.swift';\n\nconst TARGETED_DEVICE_FAMILY = `\"1,2\"`;\n\nconst addNotificationServiceExtension = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject\n) => {\n try {\n if (options.pushNotification) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush) {\n await addRichPushXcodeProj(options, xcodeProject);\n }\n return xcodeProject;\n } catch (error: any) {\n console.error(error);\n return null;\n }\n};\n\nexport const withCioNotificationsXcodeProject: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withXcodeProject(configOuter, async (config) => {\n const { modRequest, ios, version: bundleShortVersion } = config;\n const {\n appleTeamId,\n iosDeploymentTarget,\n pushNotification,\n useFrameworks,\n } = props;\n\n if (ios === undefined)\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios config missing from app.config.js or app.json.'\n );\n\n // projectName and platformProjectRoot translates to appName and iosPath in addNotificationServiceExtension()\n const { projectName, platformProjectRoot } = modRequest;\n const { bundleIdentifier, buildNumber } = ios;\n\n if (bundleShortVersion === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: version missing from app.config.js or app.json'\n );\n }\n\n if (bundleIdentifier === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.bundleIdentifier missing from app.config.js or app.json'\n );\n }\n\n if (projectName === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: name missing from app.config.js or app.json'\n );\n }\n\n const options = {\n ...props,\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion: buildNumber || DEFAULT_BUNDLE_VERSION,\n iosPath: platformProjectRoot,\n appName: projectName,\n useFrameworks,\n iosDeploymentTarget,\n pushNotification,\n };\n\n const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults\n );\n\n if (modifiedProjectFile) {\n config.modResults = modifiedProjectFile;\n }\n\n return config;\n });\n};\n\nconst addRichPushXcodeProj = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: any\n) => {\n const {\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion,\n iosPath,\n iosDeploymentTarget,\n useFrameworks,\n } = options;\n\n const isFcmProvider = isFcmPushProvider(options);\n\n await injectCIONotificationPodfileCode(iosPath, useFrameworks, isFcmProvider);\n\n // Check if `CIO_NOTIFICATION_TARGET_NAME` group already exist in the project\n // If true then skip creating a new group to avoid duplicate folders\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n console.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n const nsePath = `${iosPath}/${CIO_NOTIFICATION_TARGET_NAME}`;\n FileManagement.mkdir(nsePath, {\n recursive: true,\n });\n\n const platformSpecificFiles = [\n 'NotificationService.swift',\n ];\n\n const commonFiles = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.m',\n ENV_FILENAME,\n ];\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n // Copy platform-specific files\n platformSpecificFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${isFcmProvider ? \"fcm\" : \"apn\"}/${filename}`,\n targetFile\n );\n });\n\n // Copy common files\n commonFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/common/${filename}`,\n targetFile\n );\n });\n\n /* MODIFY COPIED EXTENSION FILES */\n const infoPlistTargetFile = getTargetFile(PLIST_FILENAME);\n updateNseInfoPlist({\n bundleVersion,\n bundleShortVersion,\n infoPlistTargetFile,\n });\n updateNseEnv(options, getTargetFile(ENV_FILENAME));\n\n // Create new PBXGroup for the extension\n const extGroup = xcodeProject.addPbxGroup(\n [...platformSpecificFiles, ...commonFiles], // Combine platform-specific and common files,\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_NOTIFICATION_TARGET_NAME\n );\n\n // Add the new PBXGroup to the top level group. This makes the\n // files / folder appear in the file explorer in Xcode.\n const groups = xcodeProject.hash.project.objects['PBXGroup'];\n Object.keys(groups).forEach((key) => {\n if (groups[key].name === undefined && groups[key].path === undefined) {\n xcodeProject.addToPbxGroup(extGroup.uuid, key);\n }\n });\n\n // WORK AROUND for codeProject.addTarget BUG\n // Xcode projects don't contain these if there is only one target\n // An upstream fix should be made to the code referenced in this link:\n // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860\n const projObjects = xcodeProject.hash.project.objects;\n projObjects['PBXTargetDependency'] = projObjects['PBXTargetDependency'] || {};\n projObjects['PBXContainerItemProxy'] =\n projObjects['PBXTargetDependency'] || {};\n\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n console.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n // Add the NSE target\n // This also adds PBXTargetDependency and PBXContainerItemProxy\n const nseTarget = xcodeProject.addTarget(\n CIO_NOTIFICATION_TARGET_NAME,\n 'app_extension',\n CIO_NOTIFICATION_TARGET_NAME,\n `${bundleIdentifier}.richpush`\n );\n\n // Add build phases to the new target\n xcodeProject.addBuildPhase(\n ['NotificationService.m', 'NotificationService.swift', 'Env.swift'],\n 'PBXSourcesBuildPhase',\n 'Sources',\n nseTarget.uuid\n );\n xcodeProject.addBuildPhase(\n [],\n 'PBXResourcesBuildPhase',\n 'Resources',\n nseTarget.uuid\n );\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXFrameworksBuildPhase',\n 'Frameworks',\n nseTarget.uuid\n );\n\n // Edit the Deployment info of the target\n const configurations = xcodeProject.pbxXCBuildConfigurationSection();\n for (const key in configurations) {\n if (\n typeof configurations[key].buildSettings !== 'undefined' &&\n configurations[key].buildSettings.PRODUCT_NAME ===\n `\"${CIO_NOTIFICATION_TARGET_NAME}\"`\n ) {\n const buildSettingsObj = configurations[key].buildSettings;\n buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;\n buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =\n iosDeploymentTarget || '15.1';\n buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;\n buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';\n buildSettingsObj.SWIFT_VERSION = 4.2;\n }\n }\n\n // Add development team to the target & the main\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId, nseTarget);\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId);\n};\n\nconst updateNseInfoPlist = (payload: {\n bundleVersion?: string;\n bundleShortVersion?: string;\n infoPlistTargetFile: string;\n}) => {\n const BUNDLE_SHORT_VERSION_RE = /\\{\\{BUNDLE_SHORT_VERSION\\}\\}/;\n const BUNDLE_VERSION_RE = /\\{\\{BUNDLE_VERSION\\}\\}/;\n\n let plistFileString = FileManagement.readFile(payload.infoPlistTargetFile);\n\n if (payload.bundleVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_VERSION_RE,\n payload.bundleVersion\n );\n }\n\n if (payload.bundleShortVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_SHORT_VERSION_RE,\n payload.bundleShortVersion\n );\n }\n\n FileManagement.writeFile(payload.infoPlistTargetFile, plistFileString);\n};\n\nconst updateNseEnv = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const CDP_API_KEY_RE = /\\{\\{CDP_API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n if (options.pushNotification?.env?.cdpApiKey) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n CDP_API_KEY_RE,\n options.pushNotification?.env?.cdpApiKey\n );\n }\n\n if (options.pushNotification?.env?.region) {\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n };\n const region = options.pushNotification?.env?.region?.toLowerCase();\n const mappedRegion = (regionMap as any)[region] || '';\n if (!mappedRegion) {\n console.warn(\n `${options.pushNotification?.env?.region} is an invalid region. Please use the values from the docs: https://customer.io/docs/sdk/expo/getting-started/#configure-the-plugin`\n );\n } else {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n REGION_RE,\n mappedRegion\n );\n }\n }\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n\nasync function addPushNotificationFile(\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: any\n) {\n // Maybe copy a different file with FCM config based on config\n const { iosPath, appName } = options;\n const isFcmProvider = isFcmPushProvider(options);\n // PushService.swift is platform-specific and always lives in the platform folder\n const sourceFile = `${isFcmProvider ? \"fcm\" : \"apn\"}/PushService.swift`;\n const targetFileName = 'PushService.swift';\n const appPath = `${iosPath}/${appName}`;\n const getTargetFile = (filename: string) => `${appPath}/${filename}`;\n const targetFile = getTargetFile(targetFileName);\n\n // Check whether {file} exists in the project. If false, then add the file\n // If {file} exists then skip and return\n if (!FileManagement.exists(getTargetFile(targetFileName))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${sourceFile}`,\n targetFile\n );\n } else {\n console.log(`${getTargetFile(targetFileName)} already exists. Skipping...`);\n return;\n }\n\n updatePushFile(options, targetFile);\n\n const group = xcodeProject.pbxCreateGroup('CustomerIONotifications');\n const classesKey = xcodeProject.findPBXGroupKey({ name: `${appName}` });\n xcodeProject.addToPbxGroup(group, classesKey);\n\n xcodeProject.addSourceFile(`${appName}/${targetFileName}`, null, group);\n}\n\nconst updatePushFile = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const REGISTER_RE = /\\{\\{REGISTER_SNIPPET\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n let snippet = '';\n if (\n options.disableNotificationRegistration !== undefined &&\n options.disableNotificationRegistration === false\n ) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n if (options.pushNotification) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{CDP_API_KEY\\}\\}/,\n options.pushNotification.env.cdpApiKey\n );\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n options.pushNotification.env.region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.autoTrackPushEvents === undefined ||\n options.autoTrackPushEvents === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const autoFetchDeviceToken = \n options.autoFetchDeviceToken === undefined ||\n options.autoFetchDeviceToken === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString()\n );\n \n const showPushAppInForeground =\n options.showPushAppInForeground === undefined ||\n options.showPushAppInForeground === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAMA,IAAAC,IAAA,GAAAD,OAAA;AAMA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,MAAMM,cAAc,GAAG,GAAGC,iCAA4B,aAAa;AACnE,MAAMC,YAAY,GAAG,WAAW;AAEhC,MAAMC,sBAAsB,GAAG,OAAO;AAEtC,MAAMC,+BAA+B,GAAG,MAAAA,CACtCC,OAAmC,EACnCC,YAA0B,KACvB;EACH,IA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B,KAAK,IAAI;EACvC9B,cAAc,GAAG,IAAAP,iCAAkB,EACjCO,cAAc,EACd,iCAAiC,EACjC8B,oBAAoB,CAACD,QAAQ,CAAC,CAChC,CAAC;EAED,MAAME,uBAAuB,GAC3B5H,OAAO,CAAC4H,uBAAuB,KAAKvG,SAAS,IAC7CrB,OAAO,CAAC4H,uBAAuB,KAAK,IAAI;EAC1C/B,cAAc,GAAG,IAAAP,iCAAkB,EACjCO,cAAc,EACd,qCAAqC,EACrC+B,uBAAuB,CAACF,QAAQ,CAAC,CACnC,CAAC;EAEDlF,8BAAc,CAAC+C,SAAS,CAACC,WAAW,EAAEK,cAAc,CAAC;AACvD,CAAC","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.withCioXcodeProject = void 0;
|
|
7
7
|
var _configPlugins = require("@expo/config-plugins");
|
|
8
8
|
var _injectCIOPodfileCode = require("../helpers/utils/injectCIOPodfileCode");
|
|
9
|
+
var _utils = require("./utils");
|
|
9
10
|
const withCioXcodeProject = (config, cioProps) => {
|
|
10
11
|
return (0, _configPlugins.withXcodeProject)(config, async props => {
|
|
11
12
|
var _props$ios, _props$ios2;
|
|
@@ -20,7 +21,7 @@ const withCioXcodeProject = (config, cioProps) => {
|
|
|
20
21
|
const {
|
|
21
22
|
iosPath
|
|
22
23
|
} = options;
|
|
23
|
-
await (0, _injectCIOPodfileCode.injectCIOPodfileCode)(iosPath);
|
|
24
|
+
await (0, _injectCIOPodfileCode.injectCIOPodfileCode)(iosPath, (0, _utils.isFcmPushProvider)(cioProps));
|
|
24
25
|
return props;
|
|
25
26
|
});
|
|
26
27
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_injectCIOPodfileCode","_utils","withCioXcodeProject","config","cioProps","withXcodeProject","props","_props$ios","_props$ios2","options","iosPath","modRequest","platformProjectRoot","bundleIdentifier","ios","devTeam","bundleVersion","buildNumber","bundleShortVersion","version","iosDeploymentTarget","injectCIOPodfileCode","isFcmPushProvider","exports"],"sources":["withXcodeProject.ts"],"sourcesContent":["import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins';\n\nimport { injectCIOPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { isFcmPushProvider } from './utils';\n\nexport const withCioXcodeProject: ConfigPlugin<CustomerIOPluginOptionsIOS> = (\n config,\n cioProps\n) => {\n return withXcodeProject(config, async (props) => {\n const options: CustomerIOPluginOptionsIOS = {\n iosPath: props.modRequest.platformProjectRoot,\n bundleIdentifier: props.ios?.bundleIdentifier,\n devTeam: cioProps?.devTeam,\n bundleVersion: props.ios?.buildNumber,\n bundleShortVersion: props?.version,\n iosDeploymentTarget: cioProps?.iosDeploymentTarget,\n };\n const { iosPath } = options;\n\n await injectCIOPodfileCode(iosPath, isFcmPushProvider(cioProps));\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,qBAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAEO,MAAMG,mBAA6D,GAAGA,CAC3EC,MAAM,EACNC,QAAQ,KACL;EACH,OAAO,IAAAC,+BAAgB,EAACF,MAAM,EAAE,MAAOG,KAAK,IAAK;IAAA,IAAAC,UAAA,EAAAC,WAAA;IAC/C,MAAMC,OAAmC,GAAG;MAC1CC,OAAO,EAAEJ,KAAK,CAACK,UAAU,CAACC,mBAAmB;MAC7CC,gBAAgB,GAAAN,UAAA,GAAED,KAAK,CAACQ,GAAG,cAAAP,UAAA,uBAATA,UAAA,CAAWM,gBAAgB;MAC7CE,OAAO,EAAEX,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEW,OAAO;MAC1BC,aAAa,GAAAR,WAAA,GAAEF,KAAK,CAACQ,GAAG,cAAAN,WAAA,uBAATA,WAAA,CAAWS,WAAW;MACrCC,kBAAkB,EAAEZ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEa,OAAO;MAClCC,mBAAmB,EAAEhB,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEgB;IACjC,CAAC;IACD,MAAM;MAAEV;IAAQ,CAAC,GAAGD,OAAO;IAE3B,MAAM,IAAAY,0CAAoB,EAACX,OAAO,EAAE,IAAAY,wBAAiB,EAAClB,QAAQ,CAAC,CAAC;IAEhE,OAAOE,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACiB,OAAA,CAAArB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ph","require","runPostInstall","error"],"sources":["postInstall.js"],"sourcesContent":["try {\n const ph = require('./postInstallHelper');\n\n ph.runPostInstall();\n} catch (error) {}\n"],"mappings":";;AAAA,IAAI;EACF,MAAMA,EAAE,GAAGC,OAAO,CAAC,qBAAqB,CAAC;EAEzCD,EAAE,CAACE,cAAc,CAAC,CAAC;AACrB,CAAC,CAAC,OAAOC,KAAK,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"names":["ph","require","runPostInstall","error"],"sources":["postInstall.js"],"sourcesContent":["try {\n const ph = require('./postInstallHelper');\n\n ph.runPostInstall();\n} catch (error) {}\n"],"mappings":";;AAAA,IAAI;EACF,MAAMA,EAAE,GAAGC,OAAO,CAAC,qBAAqB,CAAC;EAEzCD,EAAE,CAACE,cAAc,CAAC,CAAC;AACrB,CAAC,CAAC,OAAOC,KAAK,EAAE,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
function runPostInstall() {
|
|
5
|
+
// react native SDK package.json path
|
|
6
|
+
const reactNativePackageJsonFile = `${__dirname}/../../../customerio-reactnative/package.json`;
|
|
7
|
+
const expoPackageJsonFile = `${__dirname}/../../package.json`;
|
|
8
|
+
try {
|
|
9
|
+
// if react native SDK is installed
|
|
10
|
+
if (fs.existsSync(reactNativePackageJsonFile)) {
|
|
11
|
+
const reactNativePackageJson = fs.readFileSync(reactNativePackageJsonFile, 'utf8');
|
|
12
|
+
const expoPackageJson = require(expoPackageJsonFile);
|
|
13
|
+
const reactNativePackage = JSON.parse(reactNativePackageJson);
|
|
14
|
+
reactNativePackage.expoVersion = expoPackageJson.version;
|
|
15
|
+
fs.writeFileSync(reactNativePackageJsonFile, JSON.stringify(reactNativePackage, null, 2));
|
|
16
|
+
}
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.warn('Unable to find customerio-reactnative package.json file. Please make sure you have installed the customerio-reactnative package.', error);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.runPostInstall = runPostInstall;
|
|
22
|
+
//# sourceMappingURL=postInstallHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["fs","require","runPostInstall","reactNativePackageJsonFile","__dirname","expoPackageJsonFile","existsSync","reactNativePackageJson","readFileSync","expoPackageJson","reactNativePackage","JSON","parse","expoVersion","version","writeFileSync","stringify","error","console","warn","exports"],"sources":["postInstallHelper.js"],"sourcesContent":["const fs = require('fs');\n\nfunction runPostInstall() {\n // react native SDK package.json path\n const reactNativePackageJsonFile = `${__dirname}/../../../customerio-reactnative/package.json`;\n const expoPackageJsonFile = `${__dirname}/../../package.json`;\n try {\n // if react native SDK is installed\n if (fs.existsSync(reactNativePackageJsonFile)) {\n const reactNativePackageJson = fs.readFileSync(\n reactNativePackageJsonFile,\n 'utf8'\n );\n const expoPackageJson = require(expoPackageJsonFile);\n\n const reactNativePackage = JSON.parse(reactNativePackageJson);\n reactNativePackage.expoVersion = expoPackageJson.version;\n\n fs.writeFileSync(\n reactNativePackageJsonFile,\n JSON.stringify(reactNativePackage, null, 2)\n );\n }\n } catch (error) {\n console.warn(\n 'Unable to find customerio-reactnative package.json file. Please make sure you have installed the customerio-reactnative package.',\n error\n );\n }\n}\n\nexports.runPostInstall = runPostInstall;"],"mappings":";;AAAA,MAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AAExB,SAASC,cAAcA,CAAA,EAAG;EACxB;EACA,MAAMC,0BAA0B,GAAG,GAAGC,SAAS,+CAA+C;EAC9F,MAAMC,mBAAmB,GAAG,GAAGD,SAAS,qBAAqB;EAC7D,IAAI;IACF;IACA,IAAIJ,EAAE,CAACM,UAAU,CAACH,0BAA0B,CAAC,EAAE;MAC7C,MAAMI,sBAAsB,GAAGP,EAAE,CAACQ,YAAY,CAC5CL,0BAA0B,EAC1B,MACF,CAAC;MACD,MAAMM,eAAe,GAAGR,OAAO,CAACI,mBAAmB,CAAC;MAEpD,MAAMK,kBAAkB,GAAGC,IAAI,CAACC,KAAK,CAACL,sBAAsB,CAAC;MAC7DG,kBAAkB,CAACG,WAAW,GAAGJ,eAAe,CAACK,OAAO;MAExDd,EAAE,CAACe,aAAa,CACdZ,0BAA0B,EAC1BQ,IAAI,CAACK,SAAS,CAACN,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAC5C,CAAC;IACH;EACF,CAAC,CAAC,OAAOO,KAAK,EAAE;IACdC,OAAO,CAACC,IAAI,CACV,kIAAkI,EAClIF,KACF,CAAC;EACH;AACF;AAEAG,OAAO,CAAClB,cAAc,GAAGA,cAAc","ignoreList":[]}
|
|
@@ -0,0 +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 disableNotificationRegistration?: boolean;\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 showPushAppInForeground?: boolean;\n autoTrackPushEvents?: boolean;\n autoFetchDeviceToken?: boolean;\n handleDeeplinkInKilledState?: boolean;\n useFrameworks?: 'static' | 'dynamic';\n pushNotification?: {\n provider?: 'apn' | 'fcm';\n googleServicesFile?: string;\n useRichPush: boolean;\n env: {\n cdpApiKey: string;\n region: string;\n };\n };\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"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withAndroidManifest","withAndroidManifestUpdates","configOuter","props","application","modResults","manifest","customerIOMessagingpush","hasService","some","service","push","action","$","console","log"],"sources":["withAndroidManifestUpdates.ts"],"sourcesContent":["import { ConfigPlugin, withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAndroidManifestUpdates: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAndroidManifest(configOuter, (props) => {\n const application = props.modResults.manifest\n .application as ManifestApplication[];\n const customerIOMessagingpush =\n 'io.customer.messagingpush.CustomerIOFirebaseMessagingService';\n\n if (!application[0]['service']) {\n application[0]['service'] = [];\n }\n\n const hasService = application[0]['service'].some(\n (service) => service['$']['android:name'] === customerIOMessagingpush\n );\n\n if (!hasService) {\n application[0]['service'].push({\n '$': {\n 'android:name': customerIOMessagingpush,\n 'android:exported': 'false',\n },\n 'intent-filter': [\n {\n action: [\n {\n $: {\n 'android:name': 'com.google.firebase.MESSAGING_EVENT',\n },\n },\n ],\n },\n ],\n });\n console.log(\n 'Successfully set CustomerIO push handler as priority in AndroidManifest.xml'\n );\n }\n\n props.modResults.manifest.application = application;\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,mBAAmB,QAAQ,sBAAsB;AAKxE,OAAO,MAAMC,0BAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOF,mBAAmB,CAACE,WAAW,EAAGC,KAAK,IAAK;IACjD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAC1CF,WAAoC;IACvC,MAAMG,uBAAuB,GAC3B,8DAA8D;IAEhE,IAAI,CAACH,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;MAC9BA,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;IAChC;IAEA,MAAMI,UAAU,GAAGJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACK,IAAI,CAC9CC,OAAO,IAAKA,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAKH,uBAChD,CAAC;IAED,IAAI,CAACC,UAAU,EAAE;MACfJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACO,IAAI,CAAC;QAC7B,GAAG,EAAE;UACH,cAAc,EAAEJ,uBAAuB;UACvC,kBAAkB,EAAE;QACtB,CAAC;QACD,eAAe,EAAE,CACf;UACEK,MAAM,EAAE,CACN;YACEC,CAAC,EAAE;cACD,cAAc,EAAE;YAClB;UACF,CAAC;QAEL,CAAC;MAEL,CAAC,CAAC;MACFC,OAAO,CAACC,GAAG,CACT,6EACF,CAAC;IACH;IAEAZ,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"names":["withAndroidManifest","withAndroidManifestUpdates","configOuter","props","application","modResults","manifest","customerIOMessagingpush","hasService","some","service","push","action","$","console","log"],"sources":["withAndroidManifestUpdates.ts"],"sourcesContent":["import { ConfigPlugin, withAndroidManifest } from '@expo/config-plugins';\nimport type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAndroidManifestUpdates: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAndroidManifest(configOuter, (props) => {\n const application = props.modResults.manifest\n .application as ManifestApplication[];\n const customerIOMessagingpush =\n 'io.customer.messagingpush.CustomerIOFirebaseMessagingService';\n\n if (!application[0]['service']) {\n application[0]['service'] = [];\n }\n\n const hasService = application[0]['service'].some(\n (service) => service['$']['android:name'] === customerIOMessagingpush\n );\n\n if (!hasService) {\n application[0]['service'].push({\n '$': {\n 'android:name': customerIOMessagingpush,\n 'android:exported': 'false',\n },\n 'intent-filter': [\n {\n action: [\n {\n $: {\n 'android:name': 'com.google.firebase.MESSAGING_EVENT',\n },\n },\n ],\n },\n ],\n });\n console.log(\n 'Successfully set CustomerIO push handler as priority in AndroidManifest.xml'\n );\n }\n\n props.modResults.manifest.application = application;\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,mBAAmB,QAAQ,sBAAsB;AAKxE,OAAO,MAAMC,0BAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOF,mBAAmB,CAACE,WAAW,EAAGC,KAAK,IAAK;IACjD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAC1CF,WAAoC;IACvC,MAAMG,uBAAuB,GAC3B,8DAA8D;IAEhE,IAAI,CAACH,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;MAC9BA,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE;IAChC;IAEA,MAAMI,UAAU,GAAGJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACK,IAAI,CAC9CC,OAAO,IAAKA,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,KAAKH,uBAChD,CAAC;IAED,IAAI,CAACC,UAAU,EAAE;MACfJ,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAACO,IAAI,CAAC;QAC7B,GAAG,EAAE;UACH,cAAc,EAAEJ,uBAAuB;UACvC,kBAAkB,EAAE;QACtB,CAAC;QACD,eAAe,EAAE,CACf;UACEK,MAAM,EAAE,CACN;YACEC,CAAC,EAAE;cACD,cAAc,EAAE;YAClB;UACF,CAAC;QAEL,CAAC;MAEL,CAAC,CAAC;MACFC,OAAO,CAACC,GAAG,CACT,6EACF,CAAC;IACH;IAEAZ,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACF,WAAW,GAAGA,WAAW;IACnD,OAAOD,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withAppBuildGradle","CIO_APP_APPLY_REGEX","CIO_APP_GOOGLE_SNIPPET","withAppGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace","console","log"],"sources":["withAppGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withAppBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_APP_APPLY_REGEX,\n CIO_APP_GOOGLE_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAppGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAppBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_APP_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_APP_APPLY_REGEX,\n `$1\\n${CIO_APP_GOOGLE_SNIPPET}`\n );\n } else {\n console.log('app/build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,kBAAkB,QAAQ,sBAAsB;AAEvE,SACEC,mBAAmB,EACnBC,sBAAsB,QACjB,8BAA8B;AAGrC,OAAO,MAAMC,qBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOJ,kBAAkB,CAACI,WAAW,EAAGC,KAAK,IAAK;IAChD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,sBAAsB,CAAC;IAChD,MAAMM,KAAK,GAAGH,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACF,KAAK,CAAC;IACpD,IAAI,CAACE,KAAK,EAAE;MACVH,KAAK,CAACI,UAAU,CAACC,QAAQ,GAAGL,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DV,mBAAmB,
|
|
1
|
+
{"version":3,"names":["withAppBuildGradle","CIO_APP_APPLY_REGEX","CIO_APP_GOOGLE_SNIPPET","withAppGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace","console","log"],"sources":["withAppGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withAppBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_APP_APPLY_REGEX,\n CIO_APP_GOOGLE_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\n\nexport const withAppGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withAppBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_APP_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_APP_APPLY_REGEX,\n `$1\\n${CIO_APP_GOOGLE_SNIPPET}`\n );\n } else {\n console.log('app/build.gradle snippet already exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,kBAAkB,QAAQ,sBAAsB;AAEvE,SACEC,mBAAmB,EACnBC,sBAAsB,QACjB,8BAA8B;AAGrC,OAAO,MAAMC,qBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOJ,kBAAkB,CAACI,WAAW,EAAGC,KAAK,IAAK;IAChD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,sBAAsB,CAAC;IAChD,MAAMM,KAAK,GAAGH,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACF,KAAK,CAAC;IACpD,IAAI,CAACE,KAAK,EAAE;MACVH,KAAK,CAACI,UAAU,CAACC,QAAQ,GAAGL,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DV,mBAAmB,EACnB,OAAOC,sBAAsB,EAC/B,CAAC;IACH,CAAC,MAAM;MACLU,OAAO,CAACC,GAAG,CAAC,sDAAsD,CAAC;IACrE;IAEA,OAAOR,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -3,11 +3,13 @@ import { withAppGoogleServices } from './withAppGoogleServices';
|
|
|
3
3
|
import { withGistMavenRepository } from './withGistMavenRepository';
|
|
4
4
|
import { withGoogleServicesJSON } from './withGoogleServicesJSON';
|
|
5
5
|
import { withProjectGoogleServices } from './withProjectGoogleServices';
|
|
6
|
+
import { withProjectStrings } from './withProjectStrings';
|
|
6
7
|
export function withCIOAndroid(config, props) {
|
|
7
8
|
config = withGistMavenRepository(config, props);
|
|
8
9
|
config = withProjectGoogleServices(config, props);
|
|
9
10
|
config = withAppGoogleServices(config, props);
|
|
10
11
|
config = withGoogleServicesJSON(config, props);
|
|
12
|
+
config = withProjectStrings(config);
|
|
11
13
|
if (props.setHighPriorityPushHandler) {
|
|
12
14
|
config = withAndroidManifestUpdates(config, props);
|
|
13
15
|
}
|
|
@@ -0,0 +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;EACZD,MAAM,GAAGL,uBAAuB,CAACK,MAAM,EAAEC,KAAK,CAAC;EAC/CD,MAAM,GAAGH,yBAAyB,CAACG,MAAM,EAAEC,KAAK,CAAC;EACjDD,MAAM,GAAGN,qBAAqB,CAACM,MAAM,EAAEC,KAAK,CAAC;EAC7CD,MAAM,GAAGJ,sBAAsB,CAACI,MAAM,EAAEC,KAAK,CAAC;EAC9CD,MAAM,GAAGF,kBAAkB,CAACE,MAAM,CAAC;EACnC,IAAIC,KAAK,CAACC,0BAA0B,EAAE;IACpCF,MAAM,GAAGP,0BAA0B,CAACO,MAAM,EAAEC,KAAK,CAAC;EACpD;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withProjectBuildGradle","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","withGistMavenRepository","configOuter","props","targetMatch","modResults","contents","match","replace","console","log"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport {\n CIO_GIST_MAVEN_REGEX,\n CIO_PROJECT_ALLPROJECTS_REGEX,\n CIO_PROJECT_GIST_MAVEN_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGistMavenRepository: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const targetMatch = props.modResults.contents.match(CIO_GIST_MAVEN_REGEX);\n if (!targetMatch) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_ALLPROJECTS_REGEX,\n `$1\\n${CIO_PROJECT_GIST_MAVEN_SNIPPET}`\n );\n } else {\n console.log('build.gradle snippet alreade exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAsB,sBAAsB;AAE3E,SACEC,oBAAoB,EACpBC,6BAA6B,EAC7BC,8BAA8B,QACzB,8BAA8B;AAGrC,OAAO,MAAMC,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOL,sBAAsB,CAACK,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACC,KAAK,CAACT,oBAAoB,CAAC;IACzE,IAAI,CAACM,WAAW,EAAE;MAChBD,KAAK,CAACE,UAAU,CAACC,QAAQ,GAAGH,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACE,OAAO,CAC3DT,6BAA6B,
|
|
1
|
+
{"version":3,"names":["withProjectBuildGradle","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","withGistMavenRepository","configOuter","props","targetMatch","modResults","contents","match","replace","console","log"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport {\n CIO_GIST_MAVEN_REGEX,\n CIO_PROJECT_ALLPROJECTS_REGEX,\n CIO_PROJECT_GIST_MAVEN_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGistMavenRepository: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const targetMatch = props.modResults.contents.match(CIO_GIST_MAVEN_REGEX);\n if (!targetMatch) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_ALLPROJECTS_REGEX,\n `$1\\n${CIO_PROJECT_GIST_MAVEN_SNIPPET}`\n );\n } else {\n console.log('build.gradle snippet alreade exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAsB,sBAAsB;AAE3E,SACEC,oBAAoB,EACpBC,6BAA6B,EAC7BC,8BAA8B,QACzB,8BAA8B;AAGrC,OAAO,MAAMC,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOL,sBAAsB,CAACK,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACC,KAAK,CAACT,oBAAoB,CAAC;IACzE,IAAI,CAACM,WAAW,EAAE;MAChBD,KAAK,CAACE,UAAU,CAACC,QAAQ,GAAGH,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACE,OAAO,CAC3DT,6BAA6B,EAC7B,OAAOC,8BAA8B,EACvC,CAAC;IACH,CAAC,MAAM;MACLS,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;IACjE;IAEA,OAAOP,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withProjectBuildGradle","FileManagement","withGoogleServicesJSON","configOuter","cioProps","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","exists","copyFile","e","console","log"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGoogleServicesJSON: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter, cioProps) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const options: CustomerIOPluginOptionsAndroid = {\n androidPath: props.modRequest.platformProjectRoot,\n googleServicesFile: cioProps?.googleServicesFile,\n };\n const { androidPath, googleServicesFile } = options;\n if (!FileManagement.exists(`${androidPath}/app/google-services.json`)) {\n if (googleServicesFile && FileManagement.exists(googleServicesFile)) {\n try {\n FileManagement.copyFile(\n googleServicesFile,\n `${androidPath}/app/google-services.json`\n );\n } catch (e) {\n console.log(\n `There was an error copying your google-services.json file. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAsB,sBAAsB;AAE3E,SAASC,cAAc,QAAQ,mCAAmC;AAGlE,OAAO,MAAMC,sBAEZ,GAAGA,CAACC,WAAW,EAAEC,QAAQ,KAAK;EAC7B,OAAOJ,sBAAsB,CAACG,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,OAAuC,GAAG;MAC9CC,WAAW,EAAEF,KAAK,CAACG,UAAU,CAACC,mBAAmB;MACjDC,kBAAkB,EAAEN,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEM;IAChC,CAAC;IACD,MAAM;MAAEH,WAAW;MAAEG;IAAmB,CAAC,GAAGJ,OAAO;IACnD,IAAI,CAACL,cAAc,CAACU,MAAM,
|
|
1
|
+
{"version":3,"names":["withProjectBuildGradle","FileManagement","withGoogleServicesJSON","configOuter","cioProps","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFile","exists","copyFile","e","console","log"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGoogleServicesJSON: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter, cioProps) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const options: CustomerIOPluginOptionsAndroid = {\n androidPath: props.modRequest.platformProjectRoot,\n googleServicesFile: cioProps?.googleServicesFile,\n };\n const { androidPath, googleServicesFile } = options;\n if (!FileManagement.exists(`${androidPath}/app/google-services.json`)) {\n if (googleServicesFile && FileManagement.exists(googleServicesFile)) {\n try {\n FileManagement.copyFile(\n googleServicesFile,\n `${androidPath}/app/google-services.json`\n );\n } catch (e) {\n console.log(\n `There was an error copying your google-services.json file. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${androidPath}/app/google-services.json`\n );\n }\n } else {\n console.log(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAsB,sBAAsB;AAE3E,SAASC,cAAc,QAAQ,mCAAmC;AAGlE,OAAO,MAAMC,sBAEZ,GAAGA,CAACC,WAAW,EAAEC,QAAQ,KAAK;EAC7B,OAAOJ,sBAAsB,CAACG,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,OAAuC,GAAG;MAC9CC,WAAW,EAAEF,KAAK,CAACG,UAAU,CAACC,mBAAmB;MACjDC,kBAAkB,EAAEN,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEM;IAChC,CAAC;IACD,MAAM;MAAEH,WAAW;MAAEG;IAAmB,CAAC,GAAGJ,OAAO;IACnD,IAAI,CAACL,cAAc,CAACU,MAAM,CAAC,GAAGJ,WAAW,2BAA2B,CAAC,EAAE;MACrE,IAAIG,kBAAkB,IAAIT,cAAc,CAACU,MAAM,CAACD,kBAAkB,CAAC,EAAE;QACnE,IAAI;UACFT,cAAc,CAACW,QAAQ,CACrBF,kBAAkB,EAClB,GAAGH,WAAW,2BAChB,CAAC;QACH,CAAC,CAAC,OAAOM,CAAC,EAAE;UACVC,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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withProjectBuildGradle","CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_PROJECT_GOOGLE_SNIPPET","withProjectGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace"],"sources":["withProjectGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n CIO_PROJECT_GOOGLE_SNIPPET,\n} from './../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withProjectGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,sBAAsB,QAAQ,sBAAsB;AAE3E,SACEC,8BAA8B,EAC9BC,0BAA0B,QACrB,gCAAgC;AAGvC,OAAO,MAAMC,yBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOJ,sBAAsB,CAACI,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,0BAA0B,CAAC;IACpD,MAAMM,KAAK,GAAGH,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACF,KAAK,CAAC;IACpD,IAAI,CAACE,KAAK,EAAE;MACVH,KAAK,CAACI,UAAU,CAACC,QAAQ,GAAGL,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DV,8BAA8B,
|
|
1
|
+
{"version":3,"names":["withProjectBuildGradle","CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_PROJECT_GOOGLE_SNIPPET","withProjectGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace"],"sources":["withProjectGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n CIO_PROJECT_GOOGLE_SNIPPET,\n} from './../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withProjectGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,sBAAsB,QAAQ,sBAAsB;AAE3E,SACEC,8BAA8B,EAC9BC,0BAA0B,QACrB,gCAAgC;AAGvC,OAAO,MAAMC,yBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOJ,sBAAsB,CAACI,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,0BAA0B,CAAC;IACpD,MAAMM,KAAK,GAAGH,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACF,KAAK,CAAC;IACpD,IAAI,CAACE,KAAK,EAAE;MACVH,KAAK,CAACI,UAAU,CAACC,QAAQ,GAAGL,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DV,8BAA8B,EAC9B,OAAOC,0BAA0B,EACnC,CAAC;IACH;IAEA,OAAOG,KAAK;EACd,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { withStringsXml } from '@expo/config-plugins';
|
|
2
|
+
import { getPluginVersion } from '../helpers/utils/pluginUtils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Adds or updates string resources in Android's strings.xml required by the plugin
|
|
6
|
+
*/
|
|
7
|
+
export const withProjectStrings = config => {
|
|
8
|
+
return withStringsXml(config, config => {
|
|
9
|
+
const stringsXml = config.modResults;
|
|
10
|
+
const pluginVersion = getPluginVersion();
|
|
11
|
+
|
|
12
|
+
// Updating meta-data in AndroidManifest.xml fails on Manifest merging, so we're updating
|
|
13
|
+
// the strings here instead
|
|
14
|
+
// These strings are added to the strings.xml file by Customer.io's React Native SDK
|
|
15
|
+
// We're updating them here to include the Expo client source and version so user agent
|
|
16
|
+
// can be generated correctly for Expo apps
|
|
17
|
+
addStringsToXml(stringsXml, [{
|
|
18
|
+
name: 'customer_io_react_native_sdk_client_source',
|
|
19
|
+
value: 'Expo'
|
|
20
|
+
}, {
|
|
21
|
+
name: 'customer_io_react_native_sdk_client_version',
|
|
22
|
+
value: pluginVersion
|
|
23
|
+
}]);
|
|
24
|
+
return config;
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Adds or updates multiple string resources in Android's strings.xml
|
|
30
|
+
* @param stringsXml - Parsed strings.xml object
|
|
31
|
+
* @param stringResources - Array of string resources to add or update
|
|
32
|
+
* @returns Updated strings.xml object
|
|
33
|
+
*/
|
|
34
|
+
export function addStringsToXml(stringsXml, stringResources) {
|
|
35
|
+
// Ensure the resource exists
|
|
36
|
+
if (!stringsXml.resources) {
|
|
37
|
+
stringsXml.resources = {
|
|
38
|
+
string: []
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
stringResources.forEach(({
|
|
42
|
+
name,
|
|
43
|
+
value
|
|
44
|
+
}) => {
|
|
45
|
+
const existingStringIndex = stringsXml.resources.string.findIndex(item => {
|
|
46
|
+
var _item$$;
|
|
47
|
+
return ((_item$$ = item.$) === null || _item$$ === void 0 ? void 0 : _item$$.name) === name;
|
|
48
|
+
});
|
|
49
|
+
if (existingStringIndex !== -1) {
|
|
50
|
+
// Update the existing string
|
|
51
|
+
stringsXml.resources.string[existingStringIndex]._ = value;
|
|
52
|
+
} else {
|
|
53
|
+
// Add a new string resource
|
|
54
|
+
stringsXml.resources.string.push({
|
|
55
|
+
$: {
|
|
56
|
+
name
|
|
57
|
+
},
|
|
58
|
+
_: value
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=withProjectStrings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withStringsXml","getPluginVersion","withProjectStrings","config","stringsXml","modResults","pluginVersion","addStringsToXml","name","value","stringResources","resources","string","forEach","existingStringIndex","findIndex","item","_item$$","$","_","push"],"sources":["withProjectStrings.ts"],"sourcesContent":["import { ConfigPlugin, withStringsXml } from '@expo/config-plugins';\nimport { getPluginVersion } from '../helpers/utils/pluginUtils';\n\n/**\n * Adds or updates string resources in Android's strings.xml required by the plugin\n */\nexport const withProjectStrings: ConfigPlugin = (config) => {\n return withStringsXml(config, (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 { name: 'customer_io_react_native_sdk_client_version', value: pluginVersion },\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: any,\n stringResources: { name: string, value: string }[]\n) {\n // Ensure the resource exists\n if (!stringsXml.resources) {\n stringsXml.resources = { string: [] };\n }\n\n stringResources.forEach(({ name, value }) => {\n const existingStringIndex = stringsXml.resources.string.findIndex(\n (item: { $: { name: string } }) => item.$?.name === name\n );\n\n if (existingStringIndex !== -1) {\n // Update the existing string\n stringsXml.resources.string[existingStringIndex]._ = value;\n } else {\n // Add a new string resource\n stringsXml.resources.string.push({\n $: { name },\n _: value,\n });\n }\n });\n}\n"],"mappings":"AAAA,SAAuBA,cAAc,QAAQ,sBAAsB;AACnE,SAASC,gBAAgB,QAAQ,8BAA8B;;AAE/D;AACA;AACA;AACA,OAAO,MAAMC,kBAAgC,GAAIC,MAAM,IAAK;EAC1D,OAAOH,cAAc,CAACG,MAAM,EAAGA,MAAM,IAAK;IACxC,MAAMC,UAAU,GAAGD,MAAM,CAACE,UAAU;IACpC,MAAMC,aAAa,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EX","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":"AAAA,OAAO,MAAMA,8BAA8B,GACzC,4CAA4C;AAC9C,OAAO,MAAMC,mBAAmB,GAAG,2CAA2C;AAC9E,OAAO,MAAMC,oBAAoB,GAC/B,4CAA4C;AAC9C,OAAO,MAAMC,6BAA6B,GACxC,kDAAkD;AAEpD,OAAO,MAAMC,8BAA8B,GACzC,kDAAkD;AACpD,OAAO,MAAMC,sBAAsB,GACjC,2EAA2E;AAC7E,OAAO,MAAMC,0BAA0B,GACrC,sFAAsF"}
|
|
1
|
+
{"version":3,"names":["CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_APP_APPLY_REGEX","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","CIO_APP_GOOGLE_SNIPPET","CIO_PROJECT_GOOGLE_SNIPPET"],"sources":["android.ts"],"sourcesContent":["export const CIO_PROJECT_BUILDSCRIPTS_REGEX =\n /(buildscript\\s*\\{(.|\\n)*dependencies\\s*\\{)/;\nexport const CIO_APP_APPLY_REGEX = /(apply plugin: \"com.android.application\")/;\nexport const CIO_GIST_MAVEN_REGEX =\n /maven { url \"https:\\/\\/maven.gist.build\" }/;\nexport const CIO_PROJECT_ALLPROJECTS_REGEX =\n /(allprojects\\s*\\{(.|\\n){1,500}repositories\\s*\\{)/;\n\nexport const CIO_PROJECT_GIST_MAVEN_SNIPPET =\n ' maven { url \"https://maven.gist.build\" }';\nexport const CIO_APP_GOOGLE_SNIPPET =\n 'apply plugin: \"com.google.gms.google-services\" // Google Services plugin';\nexport const CIO_PROJECT_GOOGLE_SNIPPET =\n ' classpath \"com.google.gms:google-services:4.3.13\" // Google Services plugin';\n"],"mappings":"AAAA,OAAO,MAAMA,8BAA8B,GACzC,4CAA4C;AAC9C,OAAO,MAAMC,mBAAmB,GAAG,2CAA2C;AAC9E,OAAO,MAAMC,oBAAoB,GAC/B,4CAA4C;AAC9C,OAAO,MAAMC,6BAA6B,GACxC,kDAAkD;AAEpD,OAAO,MAAMC,8BAA8B,GACzC,kDAAkD;AACpD,OAAO,MAAMC,sBAAsB,GACjC,2EAA2E;AAC7E,OAAO,MAAMC,0BAA0B,GACrC,sFAAsF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["declare module 'xcode' {\n interface xcode {\n project(projPath: string): any;\n }\n\n const xcode: xcode;\n export default xcode;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["declare module 'xcode' {\n interface xcode {\n project(projPath: string): any;\n }\n\n const xcode: xcode;\n export default xcode;\n}\n"],"mappings":"","ignoreList":[]}
|