customerio-expo-plugin 0.0.5 → 1.0.0-alpha.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/lib/commonjs/analytics/injectAnalytics.js +31 -0
- package/lib/commonjs/analytics/injectAnalytics.js.map +1 -0
- package/lib/commonjs/android/withAppGoogleServices.js +22 -0
- package/lib/commonjs/android/withAppGoogleServices.js.map +1 -0
- package/lib/commonjs/android/withCIOAndroid.js +18 -0
- package/lib/commonjs/android/withCIOAndroid.js.map +1 -0
- package/lib/commonjs/android/withGistMavenRepository.js +21 -0
- package/lib/commonjs/android/withGistMavenRepository.js.map +1 -0
- package/lib/commonjs/android/withGoogleServicesJSON.js +34 -0
- package/lib/commonjs/android/withGoogleServicesJSON.js.map +1 -0
- package/lib/commonjs/android/withProjectGoogleServices.js +20 -0
- package/lib/commonjs/android/withProjectGoogleServices.js.map +1 -0
- package/lib/commonjs/helpers/constants/android.js +21 -0
- package/lib/commonjs/helpers/constants/android.js.map +1 -0
- package/lib/commonjs/helpers/constants/globals.d.js +2 -0
- package/lib/commonjs/helpers/constants/globals.d.js.map +1 -0
- package/lib/commonjs/helpers/constants/ios.js +140 -0
- package/lib/commonjs/helpers/constants/ios.js.map +1 -0
- package/{build/helpers/ios/CIONotificationService-Info.plist → lib/commonjs/helpers/native-files/ios/NotificationService-Info.plist} +2 -2
- package/{build/helpers/ios/CIONotificationService.h → lib/commonjs/helpers/native-files/ios/NotificationService.h} +0 -0
- package/{build/helpers/ios/CIONotificationService.m → lib/commonjs/helpers/native-files/ios/NotificationService.m} +2 -6
- package/{build/helpers/ios/CIONotificationService.swift → lib/commonjs/helpers/native-files/ios/NotificationService.swift} +0 -2
- package/{build/helpers → lib/commonjs/helpers/native-files}/ios/PushNotification.swift +1 -10
- package/lib/commonjs/helpers/utils/codeInjection.js +33 -0
- package/lib/commonjs/helpers/utils/codeInjection.js.map +1 -0
- package/lib/commonjs/helpers/utils/fileManagement.js +76 -0
- package/lib/commonjs/helpers/utils/fileManagement.js.map +1 -0
- package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +37 -0
- package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -0
- package/lib/commonjs/index.js +23 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/ios/withAppDelegateModifications.js +85 -0
- package/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -0
- package/lib/commonjs/ios/withAppDelegateXcodeProject.js +79 -0
- package/lib/commonjs/ios/withAppDelegateXcodeProject.js.map +1 -0
- package/lib/commonjs/ios/withCIOIos.js +23 -0
- package/lib/commonjs/ios/withCIOIos.js.map +1 -0
- package/lib/commonjs/ios/withNotificationsXcodeProject.js +158 -0
- package/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -0
- package/lib/commonjs/ios/withXcodeProject.js +28 -0
- package/lib/commonjs/ios/withXcodeProject.js.map +1 -0
- package/lib/commonjs/types/cio-types.js +2 -0
- package/lib/commonjs/types/cio-types.js.map +1 -0
- package/lib/commonjs/version.js +9 -0
- package/lib/commonjs/version.js.map +1 -0
- package/lib/module/analytics/injectAnalytics.js +24 -0
- package/lib/module/analytics/injectAnalytics.js.map +1 -0
- package/lib/module/android/withAppGoogleServices.js +15 -0
- package/lib/module/android/withAppGoogleServices.js.map +1 -0
- package/lib/module/android/withCIOAndroid.js +12 -0
- package/lib/module/android/withCIOAndroid.js.map +1 -0
- package/lib/module/android/withGistMavenRepository.js +14 -0
- package/lib/module/android/withGistMavenRepository.js.map +1 -0
- package/lib/module/android/withGoogleServicesJSON.js +27 -0
- package/lib/module/android/withGoogleServicesJSON.js.map +1 -0
- package/lib/module/android/withProjectGoogleServices.js +13 -0
- package/lib/module/android/withProjectGoogleServices.js.map +1 -0
- package/lib/module/helpers/constants/android.js +8 -0
- package/lib/module/helpers/constants/android.js.map +1 -0
- package/lib/module/helpers/constants/globals.d.js +2 -0
- package/lib/module/helpers/constants/globals.d.js.map +1 -0
- package/lib/module/helpers/constants/ios.js +103 -0
- package/lib/module/helpers/constants/ios.js.map +1 -0
- package/lib/module/helpers/native-files/ios/NotificationService-Info.plist +31 -0
- package/lib/module/helpers/native-files/ios/NotificationService.h +5 -0
- package/lib/module/helpers/native-files/ios/NotificationService.m +26 -0
- package/lib/module/helpers/native-files/ios/NotificationService.swift +19 -0
- package/lib/module/helpers/native-files/ios/PushNotification.swift +47 -0
- package/lib/module/helpers/utils/codeInjection.js +24 -0
- package/lib/module/helpers/utils/codeInjection.js.map +1 -0
- package/lib/module/helpers/utils/fileManagement.js +69 -0
- package/lib/module/helpers/utils/fileManagement.js.map +1 -0
- package/lib/module/helpers/utils/injectCIOPodfileCode.js +30 -0
- package/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -0
- package/lib/module/index.js +16 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/ios/withAppDelegateModifications.js +78 -0
- package/lib/module/ios/withAppDelegateModifications.js.map +1 -0
- package/lib/module/ios/withAppDelegateXcodeProject.js +71 -0
- package/lib/module/ios/withAppDelegateXcodeProject.js.map +1 -0
- package/lib/module/ios/withCIOIos.js +17 -0
- package/lib/module/ios/withCIOIos.js.map +1 -0
- package/lib/module/ios/withNotificationsXcodeProject.js +150 -0
- package/lib/module/ios/withNotificationsXcodeProject.js.map +1 -0
- package/lib/module/ios/withXcodeProject.js +21 -0
- package/lib/module/ios/withXcodeProject.js.map +1 -0
- package/lib/module/types/cio-types.js +2 -0
- package/lib/module/types/cio-types.js.map +1 -0
- package/lib/module/version.js +2 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/analytics/injectAnalytics.d.ts +3 -0
- package/lib/typescript/android/withAppGoogleServices.d.ts +3 -0
- package/lib/typescript/android/withCIOAndroid.d.ts +3 -0
- package/lib/typescript/android/withGistMavenRepository.d.ts +3 -0
- package/lib/typescript/android/withGoogleServicesJSON.d.ts +3 -0
- package/lib/typescript/android/withProjectGoogleServices.d.ts +3 -0
- package/lib/typescript/helpers/constants/android.d.ts +7 -0
- package/lib/typescript/helpers/constants/ios.d.ts +31 -0
- package/lib/typescript/helpers/utils/codeInjection.d.ts +4 -0
- package/lib/typescript/helpers/utils/fileManagement.d.ts +12 -0
- package/lib/typescript/helpers/utils/injectCIOPodfileCode.d.ts +2 -0
- package/lib/typescript/index.d.ts +4 -0
- package/lib/typescript/ios/withAppDelegateModifications.d.ts +2 -0
- package/lib/typescript/ios/withAppDelegateXcodeProject.d.ts +3 -0
- package/lib/typescript/ios/withCIOIos.d.ts +3 -0
- package/lib/typescript/ios/withNotificationsXcodeProject.d.ts +3 -0
- package/lib/typescript/ios/withXcodeProject.d.ts +3 -0
- package/lib/typescript/types/cio-types.d.ts +25 -0
- package/lib/typescript/version.d.ts +1 -0
- package/package.json +88 -13
- package/src/analytics/injectAnalytics.ts +36 -0
- package/src/android/withAppGoogleServices.ts +26 -0
- package/src/android/withCIOAndroid.ts +19 -0
- package/src/android/withGistMavenRepository.ts +26 -0
- package/src/android/withGoogleServicesJSON.ts +36 -0
- package/src/android/withProjectGoogleServices.ts +24 -0
- package/src/helpers/constants/android.ts +14 -0
- package/src/helpers/constants/globals.d.ts +8 -0
- package/src/helpers/constants/ios.ts +116 -0
- package/src/helpers/native-files/ios/NotificationService-Info.plist +31 -0
- package/src/helpers/native-files/ios/NotificationService.h +5 -0
- package/src/helpers/native-files/ios/NotificationService.m +26 -0
- package/src/helpers/native-files/ios/NotificationService.swift +19 -0
- package/src/helpers/native-files/ios/PushNotification.swift +47 -0
- package/src/helpers/utils/codeInjection.ts +46 -0
- package/src/helpers/utils/fileManagement.ts +87 -0
- package/src/helpers/utils/injectCIOPodfileCode.ts +53 -0
- package/src/index.ts +26 -0
- package/src/ios/withAppDelegateModifications.ts +166 -0
- package/src/ios/withAppDelegateXcodeProject.ts +89 -0
- package/src/ios/withCIOIos.ts +25 -0
- package/src/ios/withNotificationsXcodeProject.ts +237 -0
- package/src/ios/withXcodeProject.ts +25 -0
- package/src/types/cio-types.ts +31 -0
- package/src/version.ts +1 -0
- package/build/helpers/.DS_Store +0 -0
- package/build/helpers/ios/.DS_Store +0 -0
- package/build/package.json +0 -36
- package/build/src/android/withAppGoogleServices.js +0 -12
- package/build/src/android/withCIOAndroid.js +0 -15
- package/build/src/android/withGistMavenRepository.js +0 -12
- package/build/src/android/withGoogleServicesJSON.js +0 -24
- package/build/src/android/withProjectGoogleServices.js +0 -12
- package/build/src/helpers/constants/android.js +0 -9
- package/build/src/helpers/constants/ios.js +0 -102
- package/build/src/helpers/utils/codeInjection.js +0 -30
- package/build/src/helpers/utils/fileManagement.js +0 -40
- package/build/src/helpers/utils/injectCIOPodfileCode.js +0 -37
- package/build/src/index.js +0 -11
- package/build/src/ios/withAppDelegateModifications.js +0 -77
- package/build/src/ios/withAppDelegateXcodeProject.js +0 -78
- package/build/src/ios/withCIOIos.js +0 -15
- package/build/src/ios/withNotificationsXcodeProject.js +0 -133
- package/build/src/ios/withXcodeProject.js +0 -22
- package/build/src/types/cio-types.js +0 -8
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.withCioNotificationsXcodeProject = void 0;
|
|
7
|
-
const config_plugins_1 = require("@expo/config-plugins");
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const xcode_1 = __importDefault(require("xcode"));
|
|
10
|
-
const ios_1 = require("../helpers/constants/ios");
|
|
11
|
-
const injectCIOPodfileCode_1 = require("../helpers/utils/injectCIOPodfileCode");
|
|
12
|
-
const PLIST_FILENAME = `${ios_1.CIO_NOTIFICATION_TARGET_NAME}-Info.plist`;
|
|
13
|
-
const TARGETED_DEVICE_FAMILY = `"1,2"`;
|
|
14
|
-
const addNotificationServiceExtension = async (options) => {
|
|
15
|
-
const { appleTeamId, bundleIdentifier, bundleShortVersion, bundleVersion, iosPath, appName, iosDeploymentTarget, } = options;
|
|
16
|
-
const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`;
|
|
17
|
-
const xcodeProject = xcode_1.default.project(projPath);
|
|
18
|
-
xcodeProject.parse(async function (err) {
|
|
19
|
-
if (err) {
|
|
20
|
-
throw new Error(`Error parsing iOS project: ${JSON.stringify(err)}`);
|
|
21
|
-
}
|
|
22
|
-
await (0, injectCIOPodfileCode_1.injectCIONotificationPodfileCode)(iosPath);
|
|
23
|
-
fs_1.default.mkdirSync(`${iosPath}/${ios_1.CIO_NOTIFICATION_TARGET_NAME}`, {
|
|
24
|
-
recursive: true,
|
|
25
|
-
});
|
|
26
|
-
const files = [
|
|
27
|
-
PLIST_FILENAME,
|
|
28
|
-
'CIONotificationService.h',
|
|
29
|
-
'CIONotificationService.swift',
|
|
30
|
-
'CIONotificationService.m',
|
|
31
|
-
];
|
|
32
|
-
const getTargetFile = (filename) => `${iosPath}/${ios_1.CIO_NOTIFICATION_TARGET_NAME}/${filename}`;
|
|
33
|
-
files.forEach((filename) => {
|
|
34
|
-
const targetFile = getTargetFile(filename);
|
|
35
|
-
fs_1.default.copyFileSync(`${ios_1.LOCAL_PATH_TO_CIO_NSE_FILES}/${filename}`, targetFile);
|
|
36
|
-
});
|
|
37
|
-
/* MODIFY COPIED EXTENSION FILES */
|
|
38
|
-
const infoPlistTargetFile = getTargetFile(PLIST_FILENAME);
|
|
39
|
-
updateNseInfoPlist({
|
|
40
|
-
bundleVersion,
|
|
41
|
-
bundleShortVersion,
|
|
42
|
-
infoPlistTargetFile,
|
|
43
|
-
});
|
|
44
|
-
// Create new PBXGroup for the extension
|
|
45
|
-
const extGroup = xcodeProject.addPbxGroup(files, ios_1.CIO_NOTIFICATION_TARGET_NAME, ios_1.CIO_NOTIFICATION_TARGET_NAME);
|
|
46
|
-
// Add the new PBXGroup to the top level group. This makes the
|
|
47
|
-
// files / folder appear in the file explorer in Xcode.
|
|
48
|
-
const groups = xcodeProject.hash.project.objects['PBXGroup'];
|
|
49
|
-
Object.keys(groups).forEach((key) => {
|
|
50
|
-
if (groups[key].name === undefined) {
|
|
51
|
-
xcodeProject.addToPbxGroup(extGroup.uuid, key);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
// WORK AROUND for codeProject.addTarget BUG
|
|
55
|
-
// Xcode projects don't contain these if there is only one target
|
|
56
|
-
// An upstream fix should be made to the code referenced in this link:
|
|
57
|
-
// - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860
|
|
58
|
-
const projObjects = xcodeProject.hash.project.objects;
|
|
59
|
-
projObjects['PBXTargetDependency'] =
|
|
60
|
-
projObjects['PBXTargetDependency'] || {};
|
|
61
|
-
projObjects['PBXContainerItemProxy'] =
|
|
62
|
-
projObjects['PBXTargetDependency'] || {};
|
|
63
|
-
if (xcodeProject.pbxTargetByName(ios_1.CIO_NOTIFICATION_TARGET_NAME)) {
|
|
64
|
-
console.warn(`${ios_1.CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
// Add the NSE target
|
|
68
|
-
// This also adds PBXTargetDependency and PBXContainerItemProxy
|
|
69
|
-
const nseTarget = xcodeProject.addTarget(ios_1.CIO_NOTIFICATION_TARGET_NAME, 'app_extension', ios_1.CIO_NOTIFICATION_TARGET_NAME, `${bundleIdentifier}.richpush`);
|
|
70
|
-
// Add build phases to the new target
|
|
71
|
-
xcodeProject.addBuildPhase(['CIONotificationService.m', 'CIONotificationService.swift'], 'PBXSourcesBuildPhase', 'Sources', nseTarget.uuid);
|
|
72
|
-
xcodeProject.addBuildPhase([], 'PBXResourcesBuildPhase', 'Resources', nseTarget.uuid);
|
|
73
|
-
xcodeProject.addBuildPhase([], 'PBXFrameworksBuildPhase', 'Frameworks', nseTarget.uuid);
|
|
74
|
-
// Edit the Deployment info of the target
|
|
75
|
-
const configurations = xcodeProject.pbxXCBuildConfigurationSection();
|
|
76
|
-
for (const key in configurations) {
|
|
77
|
-
if (typeof configurations[key].buildSettings !== 'undefined' &&
|
|
78
|
-
configurations[key].buildSettings.PRODUCT_NAME ===
|
|
79
|
-
`"${ios_1.CIO_NOTIFICATION_TARGET_NAME}"`) {
|
|
80
|
-
const buildSettingsObj = configurations[key].buildSettings;
|
|
81
|
-
buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;
|
|
82
|
-
buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =
|
|
83
|
-
iosDeploymentTarget !== null && iosDeploymentTarget !== void 0 ? iosDeploymentTarget : '13.0';
|
|
84
|
-
buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;
|
|
85
|
-
buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';
|
|
86
|
-
buildSettingsObj.SWIFT_VERSION = 4.2;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// Add development team to the target & the main
|
|
90
|
-
xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId, nseTarget);
|
|
91
|
-
xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId);
|
|
92
|
-
fs_1.default.writeFileSync(projPath, xcodeProject.writeSync());
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
const withCioNotificationsXcodeProject = (configOuter, props) => {
|
|
96
|
-
return (0, config_plugins_1.withXcodeProject)(configOuter, async (config) => {
|
|
97
|
-
const { modRequest, ios, version: bundleShortVersion } = config;
|
|
98
|
-
const { appleTeamId, iosDeploymentTarget } = props;
|
|
99
|
-
if (ios === undefined)
|
|
100
|
-
throw new Error('Adding NotificationServiceExtension failed: ios config missing from app.config.js.');
|
|
101
|
-
const { projectName, platformProjectRoot } = modRequest;
|
|
102
|
-
const { bundleIdentifier, buildNumber } = ios;
|
|
103
|
-
if (bundleShortVersion === undefined) {
|
|
104
|
-
throw new Error('Adding NotificationServiceExtension failed: version missing from app.config.js');
|
|
105
|
-
}
|
|
106
|
-
if (bundleIdentifier === undefined) {
|
|
107
|
-
throw new Error('Adding NotificationServiceExtension failed: ios.bundleIdentifier missing from app.config.js');
|
|
108
|
-
}
|
|
109
|
-
if (projectName === undefined) {
|
|
110
|
-
throw new Error('Adding NotificationServiceExtension failed: name missing from app.config.js');
|
|
111
|
-
}
|
|
112
|
-
const options = {
|
|
113
|
-
appleTeamId,
|
|
114
|
-
bundleIdentifier,
|
|
115
|
-
bundleShortVersion,
|
|
116
|
-
bundleVersion: buildNumber !== null && buildNumber !== void 0 ? buildNumber : ios_1.DEFAULT_BUNDLE_VERSION,
|
|
117
|
-
iosPath: platformProjectRoot,
|
|
118
|
-
appName: projectName,
|
|
119
|
-
iosDeploymentTarget,
|
|
120
|
-
};
|
|
121
|
-
await addNotificationServiceExtension(options);
|
|
122
|
-
return config;
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
exports.withCioNotificationsXcodeProject = withCioNotificationsXcodeProject;
|
|
126
|
-
const updateNseInfoPlist = ({ bundleVersion, bundleShortVersion, infoPlistTargetFile, }) => {
|
|
127
|
-
const BUNDLE_SHORT_VERSION_RE = /\{\{BUNDLE_SHORT_VERSION\}\}/;
|
|
128
|
-
const BUNDLE_VERSION_RE = /\{\{BUNDLE_VERSION\}\}/;
|
|
129
|
-
let plistFileString = fs_1.default.readFileSync(infoPlistTargetFile, 'utf-8');
|
|
130
|
-
plistFileString = plistFileString.replace(BUNDLE_VERSION_RE, bundleVersion);
|
|
131
|
-
plistFileString = plistFileString.replace(BUNDLE_SHORT_VERSION_RE, bundleShortVersion);
|
|
132
|
-
fs_1.default.writeFileSync(infoPlistTargetFile, plistFileString);
|
|
133
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withCioXcodeProject = void 0;
|
|
4
|
-
const config_plugins_1 = require("@expo/config-plugins");
|
|
5
|
-
const injectCIOPodfileCode_1 = require("../helpers/utils/injectCIOPodfileCode");
|
|
6
|
-
const withCioXcodeProject = (config, cioProps) => {
|
|
7
|
-
return (0, config_plugins_1.withXcodeProject)(config, async (props) => {
|
|
8
|
-
var _a, _b;
|
|
9
|
-
const options = {
|
|
10
|
-
iosPath: props.modRequest.platformProjectRoot,
|
|
11
|
-
bundleIdentifier: (_a = props.ios) === null || _a === void 0 ? void 0 : _a.bundleIdentifier,
|
|
12
|
-
devTeam: cioProps === null || cioProps === void 0 ? void 0 : cioProps.devTeam,
|
|
13
|
-
bundleVersion: (_b = props.ios) === null || _b === void 0 ? void 0 : _b.buildNumber,
|
|
14
|
-
bundleShortVersion: props === null || props === void 0 ? void 0 : props.version,
|
|
15
|
-
iosDeploymentTarget: cioProps === null || cioProps === void 0 ? void 0 : cioProps.iosDeploymentTarget,
|
|
16
|
-
};
|
|
17
|
-
const { iosPath } = options;
|
|
18
|
-
await (0, injectCIOPodfileCode_1.injectCIOPodfileCode)(iosPath);
|
|
19
|
-
return props;
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
exports.withCioXcodeProject = withCioXcodeProject;
|