customerio-expo-plugin 3.3.0 → 3.5.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 +8 -1
- package/plugin/lib/commonjs/android/withAndroidManifestUpdates.js +64 -59
- package/plugin/lib/commonjs/android/withAndroidManifestUpdates.js.map +1 -1
- package/plugin/lib/commonjs/android/withAppGoogleServices.js +10 -7
- package/plugin/lib/commonjs/android/withAppGoogleServices.js.map +1 -1
- package/plugin/lib/commonjs/android/withGoogleServicesJSON.js +18 -21
- package/plugin/lib/commonjs/android/withGoogleServicesJSON.js.map +1 -1
- package/plugin/lib/commonjs/android/withLocationGradleProperties.js +16 -12
- package/plugin/lib/commonjs/android/withLocationGradleProperties.js.map +1 -1
- package/plugin/lib/commonjs/android/withMainApplicationModifications.js +19 -12
- package/plugin/lib/commonjs/android/withMainApplicationModifications.js.map +1 -1
- package/plugin/lib/commonjs/android/withNotificationChannelMetadata.js +2 -1
- package/plugin/lib/commonjs/android/withNotificationChannelMetadata.js.map +1 -1
- package/plugin/lib/commonjs/android/withProjectBuildGradle.js +29 -25
- package/plugin/lib/commonjs/android/withProjectBuildGradle.js.map +1 -1
- package/plugin/lib/commonjs/android/withProjectGoogleServices.js +9 -5
- package/plugin/lib/commonjs/android/withProjectGoogleServices.js.map +1 -1
- package/plugin/lib/commonjs/helpers/constants/ios.js +76 -8
- package/plugin/lib/commonjs/helpers/constants/ios.js.map +1 -1
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +76 -31
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/commonjs/index.js +7 -0
- package/plugin/lib/commonjs/index.js.map +1 -1
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js +47 -33
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -1
- package/plugin/lib/commonjs/ios/withCIOIosSwift.js +44 -54
- package/plugin/lib/commonjs/ios/withCIOIosSwift.js.map +1 -1
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js +46 -30
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js.map +1 -1
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js +192 -122
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/commonjs/postInstallHelper.js +58 -11
- package/plugin/lib/commonjs/postInstallHelper.js.map +1 -1
- package/plugin/lib/commonjs/utils/resolveRNSDK.js +97 -0
- package/plugin/lib/commonjs/utils/resolveRNSDK.js.map +1 -0
- package/plugin/lib/commonjs/utils/writeExpoVersion.js +56 -0
- package/plugin/lib/commonjs/utils/writeExpoVersion.js.map +1 -0
- package/plugin/lib/module/android/withAndroidManifestUpdates.js +61 -58
- package/plugin/lib/module/android/withAndroidManifestUpdates.js.map +1 -1
- package/plugin/lib/module/android/withAppGoogleServices.js +9 -7
- package/plugin/lib/module/android/withAppGoogleServices.js.map +1 -1
- package/plugin/lib/module/android/withGoogleServicesJSON.js +17 -21
- package/plugin/lib/module/android/withGoogleServicesJSON.js.map +1 -1
- package/plugin/lib/module/android/withLocationGradleProperties.js +15 -12
- package/plugin/lib/module/android/withLocationGradleProperties.js.map +1 -1
- package/plugin/lib/module/android/withMainApplicationModifications.js +18 -12
- package/plugin/lib/module/android/withMainApplicationModifications.js.map +1 -1
- package/plugin/lib/module/android/withNotificationChannelMetadata.js +1 -1
- package/plugin/lib/module/android/withNotificationChannelMetadata.js.map +1 -1
- package/plugin/lib/module/android/withProjectBuildGradle.js +28 -25
- package/plugin/lib/module/android/withProjectBuildGradle.js.map +1 -1
- package/plugin/lib/module/android/withProjectGoogleServices.js +8 -5
- package/plugin/lib/module/android/withProjectGoogleServices.js.map +1 -1
- package/plugin/lib/module/helpers/constants/ios.js +75 -8
- package/plugin/lib/module/helpers/constants/ios.js.map +1 -1
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js +74 -31
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/module/index.js +7 -0
- package/plugin/lib/module/index.js.map +1 -1
- package/plugin/lib/module/ios/withAppDelegateModifications.js +45 -33
- package/plugin/lib/module/ios/withAppDelegateModifications.js.map +1 -1
- package/plugin/lib/module/ios/withCIOIosSwift.js +42 -54
- package/plugin/lib/module/ios/withCIOIosSwift.js.map +1 -1
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js +45 -30
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js.map +1 -1
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js +187 -122
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/module/postInstallHelper.js +58 -11
- package/plugin/lib/module/postInstallHelper.js.map +1 -1
- package/plugin/lib/module/utils/resolveRNSDK.js +88 -0
- package/plugin/lib/module/utils/resolveRNSDK.js.map +1 -0
- package/plugin/lib/module/utils/writeExpoVersion.js +48 -0
- package/plugin/lib/module/utils/writeExpoVersion.js.map +1 -0
- package/plugin/lib/typescript/android/withAndroidManifestUpdates.d.ts +2 -0
- package/plugin/lib/typescript/android/withAppGoogleServices.d.ts +1 -0
- package/plugin/lib/typescript/android/withGoogleServicesJSON.d.ts +1 -0
- package/plugin/lib/typescript/android/withLocationGradleProperties.d.ts +2 -0
- package/plugin/lib/typescript/android/withMainApplicationModifications.d.ts +6 -0
- package/plugin/lib/typescript/android/withNotificationChannelMetadata.d.ts +5 -0
- package/plugin/lib/typescript/android/withProjectBuildGradle.d.ts +9 -0
- package/plugin/lib/typescript/android/withProjectGoogleServices.d.ts +1 -0
- package/plugin/lib/typescript/helpers/constants/ios.d.ts +18 -0
- package/plugin/lib/typescript/helpers/utils/injectCIOPodfileCode.d.ts +25 -1
- package/plugin/lib/typescript/ios/withAppDelegateModifications.d.ts +13 -0
- package/plugin/lib/typescript/ios/withCIOIosSwift.d.ts +11 -0
- package/plugin/lib/typescript/ios/withGoogleServicesJsonFile.d.ts +14 -1
- package/plugin/lib/typescript/ios/withNotificationsXcodeProject.d.ts +53 -2
- package/plugin/lib/typescript/utils/resolveRNSDK.d.ts +7 -0
- package/plugin/lib/typescript/utils/writeExpoVersion.d.ts +3 -0
- package/plugin/src/android/withAndroidManifestUpdates.ts +83 -73
- package/plugin/src/android/withAppGoogleServices.ts +13 -11
- package/plugin/src/android/withGoogleServicesJSON.ts +30 -28
- package/plugin/src/android/withLocationGradleProperties.ts +23 -17
- package/plugin/src/android/withMainApplicationModifications.ts +25 -15
- package/plugin/src/android/withNotificationChannelMetadata.ts +1 -1
- package/plugin/src/android/withProjectBuildGradle.ts +37 -27
- package/plugin/src/android/withProjectGoogleServices.ts +14 -9
- package/plugin/src/helpers/constants/ios.ts +87 -8
- package/plugin/src/helpers/utils/injectCIOPodfileCode.ts +97 -50
- package/plugin/src/index.ts +7 -0
- package/plugin/src/ios/withAppDelegateModifications.ts +61 -48
- package/plugin/src/ios/withCIOIosSwift.ts +58 -62
- package/plugin/src/ios/withGoogleServicesJsonFile.ts +66 -48
- package/plugin/src/ios/withNotificationsXcodeProject.ts +257 -207
- package/plugin/src/postInstallHelper.js +75 -17
- package/plugin/src/utils/resolveRNSDK.ts +118 -0
- package/plugin/src/utils/writeExpoVersion.ts +62 -0
|
@@ -6,6 +6,65 @@ import { logger } from '../utils/logger';
|
|
|
6
6
|
import { FileManagement } from './../helpers/utils/fileManagement';
|
|
7
7
|
import { isFcmPushProvider } from './utils';
|
|
8
8
|
|
|
9
|
+
export type CopyGoogleServicePlistOptions = {
|
|
10
|
+
iosPath: string;
|
|
11
|
+
appName: string | undefined;
|
|
12
|
+
googleServicesFile: string | undefined;
|
|
13
|
+
expoIosGoogleServicesFileSet: boolean;
|
|
14
|
+
xcodeProject: XcodeProject;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Copies the FCM GoogleService-Info.plist into the iOS project (when needed) and registers it
|
|
19
|
+
* in the Xcode project's Resources group. Idempotent — no-ops if a plist is already present
|
|
20
|
+
* at either of the two well-known locations Expo / RN Firebase use.
|
|
21
|
+
*/
|
|
22
|
+
export function copyGoogleServicePlistFile({
|
|
23
|
+
iosPath,
|
|
24
|
+
appName,
|
|
25
|
+
googleServicesFile,
|
|
26
|
+
expoIosGoogleServicesFileSet,
|
|
27
|
+
xcodeProject,
|
|
28
|
+
}: CopyGoogleServicePlistOptions): void {
|
|
29
|
+
const destination = `${iosPath}/GoogleService-Info.plist`;
|
|
30
|
+
|
|
31
|
+
if (FileManagement.exists(destination)) {
|
|
32
|
+
logger.info(`File already exists: ${destination}. Skipping...`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (appName && FileManagement.exists(`${iosPath}/${appName}/GoogleService-Info.plist`)) {
|
|
37
|
+
// This is where RN Firebase potentially copies GoogleService-Info.plist
|
|
38
|
+
// Do not copy if it's already done by Firebase to avoid conflict in Resources
|
|
39
|
+
logger.info(
|
|
40
|
+
`File already exists: ${iosPath}/${appName}/GoogleService-Info.plist. Skipping...`
|
|
41
|
+
);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (googleServicesFile && FileManagement.exists(googleServicesFile)) {
|
|
46
|
+
if (expoIosGoogleServicesFileSet) {
|
|
47
|
+
logger.warn(
|
|
48
|
+
'Specifying both Expo ios.googleServicesFile and Customer.io ios.pushNotification.googleServicesFile can cause a conflict' +
|
|
49
|
+
' duplicating GoogleService-Info.plist in the iOS project resources. Please remove Customer.io ios.pushNotification.googleServicesFile'
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
FileManagement.copyFile(googleServicesFile, destination);
|
|
55
|
+
addFileToXcodeProject(xcodeProject, 'GoogleService-Info.plist');
|
|
56
|
+
} catch {
|
|
57
|
+
logger.error(
|
|
58
|
+
`There was an error copying your GoogleService-Info.plist file. You can copy it manually into ${destination}`
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
logger.error(
|
|
63
|
+
`The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${destination}`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
9
68
|
export const withGoogleServicesJsonFile: ConfigPlugin<
|
|
10
69
|
CustomerIOPluginOptionsIOS
|
|
11
70
|
> = (config, cioProps) => {
|
|
@@ -21,54 +80,13 @@ export const withGoogleServicesJsonFile: ConfigPlugin<
|
|
|
21
80
|
' GoogleService-Info.plist as part of Firebase integration'
|
|
22
81
|
);
|
|
23
82
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
`File already exists: ${iosPath}/GoogleService-Info.plist. Skipping...`
|
|
32
|
-
);
|
|
33
|
-
return props;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
FileManagement.exists(`${iosPath}/${appName}/GoogleService-Info.plist`)
|
|
38
|
-
) {
|
|
39
|
-
// This is where RN Firebase potentially copies GoogleService-Info.plist
|
|
40
|
-
// Do not copy if it's already done by Firebase to avoid conflict in Resources
|
|
41
|
-
logger.info(
|
|
42
|
-
`File already exists: ${iosPath}/${appName}/GoogleService-Info.plist. Skipping...`
|
|
43
|
-
);
|
|
44
|
-
return props;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (googleServicesFile && FileManagement.exists(googleServicesFile)) {
|
|
48
|
-
if (config.ios?.googleServicesFile) {
|
|
49
|
-
logger.warn(
|
|
50
|
-
'Specifying both Expo ios.googleServicesFile and Customer.io ios.pushNotification.googleServicesFile can cause a conflict' +
|
|
51
|
-
' duplicating GoogleService-Info.plist in the iOS project resources. Please remove Customer.io ios.pushNotification.googleServicesFile'
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
FileManagement.copyFile(
|
|
57
|
-
googleServicesFile,
|
|
58
|
-
`${iosPath}/GoogleService-Info.plist`
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
addFileToXcodeProject(props.modResults, 'GoogleService-Info.plist');
|
|
62
|
-
} catch {
|
|
63
|
-
logger.error(
|
|
64
|
-
`There was an error copying your GoogleService-Info.plist file. You can copy it manually into ${iosPath}/GoogleService-Info.plist`
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
logger.error(
|
|
69
|
-
`The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${iosPath}/GoogleService-Info.plist`
|
|
70
|
-
);
|
|
71
|
-
}
|
|
83
|
+
copyGoogleServicePlistFile({
|
|
84
|
+
iosPath: props.modRequest.platformProjectRoot,
|
|
85
|
+
appName: props.modRequest.projectName,
|
|
86
|
+
googleServicesFile: cioProps.pushNotification?.googleServicesFile,
|
|
87
|
+
expoIosGoogleServicesFileSet: Boolean(config.ios?.googleServicesFile),
|
|
88
|
+
xcodeProject: props.modResults,
|
|
89
|
+
});
|
|
72
90
|
|
|
73
91
|
return props;
|
|
74
92
|
});
|