customerio-expo-plugin 3.1.0 → 3.3.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 +3 -2
- package/plugin/lib/commonjs/android/withCIOAndroid.js +13 -2
- package/plugin/lib/commonjs/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/commonjs/android/withLocationGradleProperties.js +37 -0
- package/plugin/lib/commonjs/android/withLocationGradleProperties.js.map +1 -0
- package/plugin/lib/commonjs/android/withMainApplicationModifications.js +21 -5
- package/plugin/lib/commonjs/android/withMainApplicationModifications.js.map +1 -1
- package/plugin/lib/commonjs/helpers/native-files/android/CustomerIOSDKInitializer.kt +2 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/CustomerIOSDKInitializer.swift +2 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/apn/CioSdkAppDelegateHandler.swift +1 -1
- package/plugin/lib/commonjs/helpers/native-files/ios/apn/NotificationService.swift +1 -1
- package/plugin/lib/commonjs/helpers/native-files/ios/apn/PushService.swift +1 -1
- package/plugin/lib/commonjs/helpers/native-files/ios/fcm/CioSdkAppDelegateHandler.swift +1 -1
- package/plugin/lib/commonjs/helpers/native-files/ios/fcm/NotificationService.swift +1 -1
- package/plugin/lib/commonjs/helpers/native-files/ios/fcm/PushService.swift +1 -1
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +19 -2
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/commonjs/helpers/utils/patchLocationCode.js +50 -0
- package/plugin/lib/commonjs/helpers/utils/patchLocationCode.js.map +1 -0
- package/plugin/lib/commonjs/helpers/utils/patchPluginNativeCode.js +3 -1
- package/plugin/lib/commonjs/helpers/utils/patchPluginNativeCode.js.map +1 -1
- package/plugin/lib/commonjs/index.js +2 -2
- package/plugin/lib/commonjs/index.js.map +1 -1
- package/plugin/lib/commonjs/ios/withCIOIos.js +46 -4
- package/plugin/lib/commonjs/ios/withCIOIos.js.map +1 -1
- package/plugin/lib/commonjs/ios/withCIOIosSwift.js +25 -12
- package/plugin/lib/commonjs/ios/withCIOIosSwift.js.map +1 -1
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js +45 -11
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/commonjs/ios/withXcodeProject.js +4 -1
- package/plugin/lib/commonjs/ios/withXcodeProject.js.map +1 -1
- package/plugin/lib/commonjs/types/cio-types.js.map +1 -1
- package/plugin/lib/commonjs/utils/validation.js +13 -0
- package/plugin/lib/commonjs/utils/validation.js.map +1 -1
- package/plugin/lib/module/android/withCIOAndroid.js +13 -2
- package/plugin/lib/module/android/withCIOAndroid.js.map +1 -1
- package/plugin/lib/module/android/withLocationGradleProperties.js +30 -0
- package/plugin/lib/module/android/withLocationGradleProperties.js.map +1 -0
- package/plugin/lib/module/android/withMainApplicationModifications.js +20 -4
- package/plugin/lib/module/android/withMainApplicationModifications.js.map +1 -1
- package/plugin/lib/module/helpers/native-files/android/CustomerIOSDKInitializer.kt +2 -0
- package/plugin/lib/module/helpers/native-files/ios/CustomerIOSDKInitializer.swift +2 -0
- package/plugin/lib/module/helpers/native-files/ios/apn/CioSdkAppDelegateHandler.swift +1 -1
- package/plugin/lib/module/helpers/native-files/ios/apn/NotificationService.swift +1 -1
- package/plugin/lib/module/helpers/native-files/ios/apn/PushService.swift +1 -1
- package/plugin/lib/module/helpers/native-files/ios/fcm/CioSdkAppDelegateHandler.swift +1 -1
- package/plugin/lib/module/helpers/native-files/ios/fcm/NotificationService.swift +1 -1
- package/plugin/lib/module/helpers/native-files/ios/fcm/PushService.swift +1 -1
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js +18 -2
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/module/helpers/utils/patchLocationCode.js +44 -0
- package/plugin/lib/module/helpers/utils/patchLocationCode.js.map +1 -0
- package/plugin/lib/module/helpers/utils/patchPluginNativeCode.js +3 -2
- package/plugin/lib/module/helpers/utils/patchPluginNativeCode.js.map +1 -1
- package/plugin/lib/module/index.js +2 -2
- package/plugin/lib/module/index.js.map +1 -1
- package/plugin/lib/module/ios/withCIOIos.js +46 -4
- package/plugin/lib/module/ios/withCIOIos.js.map +1 -1
- package/plugin/lib/module/ios/withCIOIosSwift.js +25 -12
- package/plugin/lib/module/ios/withCIOIosSwift.js.map +1 -1
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js +45 -11
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/module/ios/withXcodeProject.js +5 -1
- package/plugin/lib/module/ios/withXcodeProject.js.map +1 -1
- package/plugin/lib/module/types/cio-types.js.map +1 -1
- package/plugin/lib/module/utils/validation.js +13 -1
- package/plugin/lib/module/utils/validation.js.map +1 -1
- package/plugin/lib/typescript/android/withCIOAndroid.d.ts +2 -2
- package/plugin/lib/typescript/android/withLocationGradleProperties.d.ts +9 -0
- package/plugin/lib/typescript/android/withMainApplicationModifications.d.ts +7 -2
- package/plugin/lib/typescript/helpers/utils/injectCIOPodfileCode.d.ts +9 -1
- package/plugin/lib/typescript/helpers/utils/patchLocationCode.d.ts +12 -0
- package/plugin/lib/typescript/helpers/utils/patchPluginNativeCode.d.ts +3 -1
- package/plugin/lib/typescript/index.d.ts +2 -1
- package/plugin/lib/typescript/ios/withCIOIos.d.ts +2 -2
- package/plugin/lib/typescript/ios/withCIOIosSwift.d.ts +2 -2
- package/plugin/lib/typescript/ios/withXcodeProject.d.ts +8 -1
- package/plugin/lib/typescript/types/cio-types.d.ts +35 -0
- package/plugin/lib/typescript/utils/validation.d.ts +3 -2
- package/plugin/src/android/withCIOAndroid.ts +13 -2
- package/plugin/src/android/withLocationGradleProperties.ts +41 -0
- package/plugin/src/android/withMainApplicationModifications.ts +26 -4
- package/plugin/src/helpers/native-files/android/CustomerIOSDKInitializer.kt +2 -0
- package/plugin/src/helpers/native-files/ios/CustomerIOSDKInitializer.swift +2 -0
- package/plugin/src/helpers/native-files/ios/apn/CioSdkAppDelegateHandler.swift +1 -1
- package/plugin/src/helpers/native-files/ios/apn/NotificationService.swift +1 -1
- package/plugin/src/helpers/native-files/ios/apn/PushService.swift +1 -1
- package/plugin/src/helpers/native-files/ios/fcm/CioSdkAppDelegateHandler.swift +1 -1
- package/plugin/src/helpers/native-files/ios/fcm/NotificationService.swift +1 -1
- package/plugin/src/helpers/native-files/ios/fcm/PushService.swift +1 -1
- package/plugin/src/helpers/utils/injectCIOPodfileCode.ts +35 -3
- package/plugin/src/helpers/utils/patchLocationCode.ts +80 -0
- package/plugin/src/helpers/utils/patchPluginNativeCode.ts +10 -1
- package/plugin/src/index.ts +9 -3
- package/plugin/src/ios/withCIOIos.ts +40 -3
- package/plugin/src/ios/withCIOIosSwift.ts +30 -4
- package/plugin/src/ios/withNotificationsXcodeProject.ts +56 -1
- package/plugin/src/ios/withXcodeProject.ts +20 -3
- package/plugin/src/types/cio-types.ts +38 -0
- package/plugin/src/utils/validation.ts +18 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_config","_logger","_validation","_utils","_withAppDelegateModifications","_withCIOIosSwift","_withGoogleServicesJsonFile","_withNotificationsXcodeProject","_withXcodeProject","withCIOIos","config","sdkConfig","props","location","isSwiftProject","isExpoVersion53OrHigher","platformConfig","mergeDeprecatedPropertiesAndLogWarnings","locationEnabled","enabled","pushNotification","_platformConfig$pushN","validatePushNotificationOptions","withCIOIosSwift","withAppDelegateModifications","env","mergeConfigWithEnvValues","withCioNotificationsXcodeProject","withCioXcodeProject","podfileOptions","hasPush","withGoogleServicesJsonFile","appGroupId","withEntitlementsPlist","entitlementsConfig","entitlements","modResults","existing","includes","deprecatedTopLevelProperties","showPushAppInForeground","autoTrackPushEvents","handleDeeplinkInKilledState","disableNotificationRegistration","autoFetchDeviceToken","Object","entries","forEach","key","value","undefined","logger","warn","propKey"],"sources":["withCIOIos.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\nimport { withEntitlementsPlist } from '@expo/config-plugins';\nimport type {\n CustomerIOPluginOptionsIOS,\n CustomerIOPluginPushNotificationOptions,\n CustomerIOPluginLocationOptions,\n NativeSDKConfig,\n} from '../types/cio-types';\nimport { mergeConfigWithEnvValues } from '../utils/config';\nimport { logger } from '../utils/logger';\nimport { validatePushNotificationOptions } from '../utils/validation';\nimport { isExpoVersion53OrHigher } from './utils';\nimport { withAppDelegateModifications } from './withAppDelegateModifications';\nimport { withCIOIosSwift } from './withCIOIosSwift';\nimport { withGoogleServicesJsonFile } from './withGoogleServicesJsonFile';\nimport { withCioNotificationsXcodeProject } from './withNotificationsXcodeProject';\nimport { withCioXcodeProject } from './withXcodeProject';\n\nexport function withCIOIos(\n config: ExpoConfig,\n sdkConfig?: NativeSDKConfig,\n props?: CustomerIOPluginOptionsIOS,\n location?: CustomerIOPluginLocationOptions,\n) {\n const isSwiftProject = isExpoVersion53OrHigher(config);\n const platformConfig = mergeDeprecatedPropertiesAndLogWarnings(props);\n const locationEnabled = location?.enabled === true;\n\n if (platformConfig?.pushNotification) {\n validatePushNotificationOptions(platformConfig.pushNotification);\n if (isSwiftProject) {\n config = withCIOIosSwift(config, sdkConfig, platformConfig, location);\n } else {\n // Auto initialization is only supported in Swift projects (Expo SDK 53+)\n // Legacy Objective-C projects only support push notifications\n config = withAppDelegateModifications(config, platformConfig);\n }\n\n platformConfig.pushNotification.env = platformConfig.pushNotification.env\n || mergeConfigWithEnvValues(platformConfig, sdkConfig);\n config = withCioNotificationsXcodeProject(config, platformConfig);\n config = withCioXcodeProject(config, {\n ...platformConfig,\n podfileOptions: {\n locationEnabled,\n hasPush: true,\n },\n });\n config = withGoogleServicesJsonFile(config, platformConfig);\n\n // Merge App Group entitlements on host only when appGroupId is explicitly set\n const appGroupId = platformConfig.pushNotification?.appGroupId;\n if (appGroupId) {\n config = withEntitlementsPlist(config, (entitlementsConfig) => {\n const entitlements = entitlementsConfig.modResults as Record<string, unknown>;\n const existing = (entitlements['com.apple.security.application-groups'] as string[] | undefined) ?? [];\n if (!existing.includes(appGroupId)) {\n entitlements['com.apple.security.application-groups'] = [...existing, appGroupId];\n }\n return entitlementsConfig;\n });\n }\n } else if (sdkConfig && isSwiftProject) {\n config = withCIOIosSwift(config, sdkConfig, platformConfig, location);\n if (locationEnabled) {\n config = withCioXcodeProject(config, {\n ...platformConfig,\n podfileOptions: { locationEnabled: true, hasPush: false },\n });\n }\n } else if (locationEnabled) {\n // Location-only: no push, no config. Still add Podfile location subspec so CIO_LOCATION_ENABLED is set and native location code is included.\n config = withCioXcodeProject(config, {\n ...platformConfig,\n podfileOptions: { locationEnabled: true, hasPush: false },\n });\n }\n\n return config;\n}\n\n/** The basic purpose of this function is to centralize where we handle the deprecation\n by merging the deprecated properties into the new ios.pushNotification.* properties\n and logging a warning if they are set. This way, we can remove the deprecated properties\n from the top level of the ios object in the future, and update this function\n while the rest of the plugin code remains unchanged.\n*/\nconst mergeDeprecatedPropertiesAndLogWarnings = (\n props?: CustomerIOPluginOptionsIOS,\n): CustomerIOPluginOptionsIOS | undefined => {\n // The deprecatedTopLevelProperties maps the top level properties\n // that are deprecated to the new ios.pushNotification.* properties\n // that should be used instead. The deprecated properties are\n // still available for backwards compatibility, but they will\n // be removed in the future.\n\n if (!props) {\n return props\n }\n\n const deprecatedTopLevelProperties = {\n showPushAppInForeground: props.showPushAppInForeground,\n autoTrackPushEvents: props.autoTrackPushEvents,\n handleDeeplinkInKilledState: props.handleDeeplinkInKilledState,\n disableNotificationRegistration: props.disableNotificationRegistration,\n autoFetchDeviceToken: props.autoFetchDeviceToken,\n };\n\n // loop over all the deprecated properties and log a warning if they are set\n Object.entries(deprecatedTopLevelProperties).forEach(([key, value]) => {\n if (value !== undefined) {\n logger.warn(\n `The ios.${key} property is deprecated. Please use ios.pushNotification.${key} instead.`\n );\n\n if (props.pushNotification === undefined) {\n props.pushNotification = {} as CustomerIOPluginPushNotificationOptions;\n }\n const propKey = key as keyof CustomerIOPluginPushNotificationOptions;\n if (props.pushNotification[propKey] === undefined) {\n props.pushNotification = {\n ...props.pushNotification,\n [propKey]: value,\n };\n } else {\n logger.warn(\n `The ios.${key} property is deprecated. Since the value of ios.pushNotification.${key} is set, it will be used.`\n );\n }\n }\n });\n\n return props;\n};\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,6BAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,2BAAA,GAAAP,OAAA;AACA,IAAAQ,8BAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AAEO,SAASU,UAAUA,CACxBC,MAAkB,EAClBC,SAA2B,EAC3BC,KAAkC,EAClCC,QAA0C,EAC1C;EACA,MAAMC,cAAc,GAAG,IAAAC,8BAAuB,EAACL,MAAM,CAAC;EACtD,MAAMM,cAAc,GAAGC,uCAAuC,CAACL,KAAK,CAAC;EACrE,MAAMM,eAAe,GAAG,CAAAL,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEM,OAAO,MAAK,IAAI;EAElD,IAAIH,cAAc,aAAdA,cAAc,eAAdA,cAAc,CAAEI,gBAAgB,EAAE;IAAA,IAAAC,qBAAA;IACpC,IAAAC,2CAA+B,EAACN,cAAc,CAACI,gBAAgB,CAAC;IAChE,IAAIN,cAAc,EAAE;MAClBJ,MAAM,GAAG,IAAAa,gCAAe,EAACb,MAAM,EAAEC,SAAS,EAAEK,cAAc,EAAEH,QAAQ,CAAC;IACvE,CAAC,MAAM;MACL;MACA;MACAH,MAAM,GAAG,IAAAc,0DAA4B,EAACd,MAAM,EAAEM,cAAc,CAAC;IAC/D;IAEAA,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AO,GAAGJ;QACb,CAAC;MACH,CAAC,MAAM;QACLE,cAAM,CAACC,IAAI,CACT,WAAWJ,GAAG,oEAAoEA,GAAG,2BACvF,CAAC;MACH;IACF;EACF,CAAC,CAAC;EAEF,OAAOpC,KAAK;AACd,CAAC","ignoreList":[]}
|
|
@@ -23,7 +23,7 @@ const CIO_SDK_APP_DELEGATE_HANDLER_FILENAME = `${CIO_SDK_APP_DELEGATE_HANDLER_CL
|
|
|
23
23
|
/**
|
|
24
24
|
* Copy and configure the CioSdkAppDelegateHandler.swift file
|
|
25
25
|
*/
|
|
26
|
-
const copyAndConfigureAppDelegateHandler = (config, sdkConfig, props) => {
|
|
26
|
+
const copyAndConfigureAppDelegateHandler = (config, sdkConfig, props, location) => {
|
|
27
27
|
// Destination path in the iOS project
|
|
28
28
|
const projectName = config.modRequest.projectName || '';
|
|
29
29
|
if (!projectName) {
|
|
@@ -44,7 +44,8 @@ const copyAndConfigureAppDelegateHandler = (config, sdkConfig, props) => {
|
|
|
44
44
|
iosProjectRoot,
|
|
45
45
|
projectName,
|
|
46
46
|
sdkConfig,
|
|
47
|
-
props
|
|
47
|
+
props,
|
|
48
|
+
location
|
|
48
49
|
});
|
|
49
50
|
} else if (sdkConfig) {
|
|
50
51
|
// Copy only CustomerIOSDKInitializer.swift for auto-init without push notifications
|
|
@@ -53,7 +54,8 @@ const copyAndConfigureAppDelegateHandler = (config, sdkConfig, props) => {
|
|
|
53
54
|
group,
|
|
54
55
|
iosProjectRoot,
|
|
55
56
|
projectName,
|
|
56
|
-
sdkConfig
|
|
57
|
+
sdkConfig,
|
|
58
|
+
location
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
61
|
return config;
|
|
@@ -64,9 +66,10 @@ const copyAndConfigurePushAppDelegateHandler = ({
|
|
|
64
66
|
iosProjectRoot,
|
|
65
67
|
projectName,
|
|
66
68
|
sdkConfig,
|
|
67
|
-
props
|
|
69
|
+
props,
|
|
70
|
+
location
|
|
68
71
|
}) => {
|
|
69
|
-
var _props$pushNotificati, _props$pushNotificati2, _props$pushNotificati3, _props$pushNotificati4;
|
|
72
|
+
var _props$pushNotificati, _props$pushNotificati2, _props$pushNotificati3, _props$pushNotificati4, _props$pushNotificati5;
|
|
70
73
|
const useFcm = (0, _utils.isFcmPushProvider)(props);
|
|
71
74
|
|
|
72
75
|
// Source path for the handler file
|
|
@@ -91,6 +94,9 @@ const copyAndConfigurePushAppDelegateHandler = ({
|
|
|
91
94
|
handlerFileContent = (0, _codeInjection.replaceCodeByRegex)(handlerFileContent, /\{\{AUTO_FETCH_DEVICE_TOKEN\}\}/, autoFetchDeviceToken.toString());
|
|
92
95
|
const showPushAppInForeground = ((_props$pushNotificati4 = props.pushNotification) === null || _props$pushNotificati4 === void 0 ? void 0 : _props$pushNotificati4.showPushAppInForeground) !== false;
|
|
93
96
|
handlerFileContent = (0, _codeInjection.replaceCodeByRegex)(handlerFileContent, /\{\{SHOW_PUSH_APP_IN_FOREGROUND\}\}/, showPushAppInForeground.toString());
|
|
97
|
+
const appGroupId = (_props$pushNotificati5 = props.pushNotification) === null || _props$pushNotificati5 === void 0 ? void 0 : _props$pushNotificati5.appGroupId;
|
|
98
|
+
const appGroupIdBuilderLine = appGroupId ? ` .appGroupId(${JSON.stringify(appGroupId)})\n` : '';
|
|
99
|
+
handlerFileContent = (0, _codeInjection.replaceCodeByRegex)(handlerFileContent, /\{\{APP_GROUP_ID_BUILDER_LINE\}\}/, appGroupIdBuilderLine);
|
|
94
100
|
|
|
95
101
|
// Add auto initialization if sdkConfig is provided
|
|
96
102
|
if (sdkConfig) {
|
|
@@ -100,7 +106,8 @@ const copyAndConfigurePushAppDelegateHandler = ({
|
|
|
100
106
|
group,
|
|
101
107
|
iosProjectRoot,
|
|
102
108
|
projectName,
|
|
103
|
-
sdkConfig
|
|
109
|
+
sdkConfig,
|
|
110
|
+
location
|
|
104
111
|
});
|
|
105
112
|
|
|
106
113
|
// Inject auto initialization call before MessagingPush initialization
|
|
@@ -113,8 +120,14 @@ const copyAndConfigureNativeSDKInitializer = ({
|
|
|
113
120
|
group,
|
|
114
121
|
iosProjectRoot,
|
|
115
122
|
projectName,
|
|
116
|
-
sdkConfig
|
|
123
|
+
sdkConfig,
|
|
124
|
+
location
|
|
117
125
|
}) => {
|
|
126
|
+
var _sdkConfig$location;
|
|
127
|
+
const locationOptions = location ? {
|
|
128
|
+
enabled: location.enabled === true,
|
|
129
|
+
trackingMode: sdkConfig === null || sdkConfig === void 0 || (_sdkConfig$location = sdkConfig.location) === null || _sdkConfig$location === void 0 ? void 0 : _sdkConfig$location.trackingMode
|
|
130
|
+
} : undefined;
|
|
118
131
|
const filename = 'CustomerIOSDKInitializer.swift';
|
|
119
132
|
const sourcePath = _path.default.join((0, _plugin.getIosNativeFilesPath)(), filename);
|
|
120
133
|
// Add the CustomerIOSDKInitializer.swift file to the same Xcode group as CioSdkAppDelegateHandler
|
|
@@ -124,14 +137,14 @@ const copyAndConfigureNativeSDKInitializer = ({
|
|
|
124
137
|
projectName,
|
|
125
138
|
sourceFilePath: sourcePath,
|
|
126
139
|
targetFileName: filename,
|
|
127
|
-
transform: content => (0, _patchPluginNativeCode.patchNativeSDKInitializer)(content, _common.PLATFORM.IOS, sdkConfig),
|
|
140
|
+
transform: content => (0, _patchPluginNativeCode.patchNativeSDKInitializer)(content, _common.PLATFORM.IOS, sdkConfig, locationOptions),
|
|
128
141
|
customerIOGroup: group
|
|
129
142
|
});
|
|
130
143
|
};
|
|
131
|
-
const withCIOIosSwift = (configOuter, sdkConfig, props) => {
|
|
144
|
+
const withCIOIosSwift = (configOuter, sdkConfig, props, location) => {
|
|
132
145
|
// First, copy required swift files to iOS folder and add it to Xcode project
|
|
133
146
|
configOuter = (0, _configPlugins.withXcodeProject)(configOuter, async config => {
|
|
134
|
-
return copyAndConfigureAppDelegateHandler(config, sdkConfig, props);
|
|
147
|
+
return copyAndConfigureAppDelegateHandler(config, sdkConfig, props, location);
|
|
135
148
|
});
|
|
136
149
|
|
|
137
150
|
// Modify the AppDelegate based on configuration
|
|
@@ -155,7 +168,7 @@ const withCIOIosSwift = (configOuter, sdkConfig, props) => {
|
|
|
155
168
|
*/
|
|
156
169
|
exports.withCIOIosSwift = withCIOIosSwift;
|
|
157
170
|
const modifyAppDelegateWithPushAppDelegateHandler = (config, props) => {
|
|
158
|
-
var _props$
|
|
171
|
+
var _props$pushNotificati6;
|
|
159
172
|
const appDelegateContent = config.modResults.contents;
|
|
160
173
|
|
|
161
174
|
// Check if modifications have already been applied
|
|
@@ -177,7 +190,7 @@ const modifyAppDelegateWithPushAppDelegateHandler = (config, props) => {
|
|
|
177
190
|
modifiedContent = addDidFailToRegisterForRemoteNotificationsWithError(modifiedContent);
|
|
178
191
|
|
|
179
192
|
// Add deep link handling for killed state if enabled
|
|
180
|
-
if (((_props$
|
|
193
|
+
if (((_props$pushNotificati6 = props.pushNotification) === null || _props$pushNotificati6 === void 0 ? void 0 : _props$pushNotificati6.handleDeeplinkInKilledState) === true) {
|
|
181
194
|
modifiedContent = addHandleDeeplinkInKilledState(modifiedContent);
|
|
182
195
|
}
|
|
183
196
|
config.modResults.contents = modifiedContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_configPlugins","require","_path","_interopRequireDefault","_common","_ios","_codeInjection","_fileManagement","_patchPluginNativeCode","_logger","_plugin","_xcode","_utils","e","__esModule","default","CIO_SDK_APP_DELEGATE_HANDLER_CLASS","CIO_SDK_APP_DELEGATE_HANDLER_FILENAME","copyAndConfigureAppDelegateHandler","config","sdkConfig","props","projectName","modRequest","logger","warn","xcodeProject","modResults","projectRoot","iosProjectRoot","path","join","group","getOrCreateCustomerIOGroup","pushNotification","copyAndConfigurePushAppDelegateHandler","copyAndConfigureNativeSDKInitializer","_props$pushNotificati","_props$pushNotificati2","_props$pushNotificati3","_props$pushNotificati4","useFcm","isFcmPushProvider","handlerSourcePath","getIosNativeFilesPath","handlerDestPath","FileManagement","copyFile","addSourceFile","handlerFileContent","readFile","disableNotificationRegistration","snippet","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET_v2","replaceCodeByRegex","CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground","replace","CIO_MESSAGING_PUSH_APP_DELEGATE_INIT_REGEX","CIO_NATIVE_SDK_INITIALIZE_SNIPPET","writeFile","filename","sourcePath","copyFileToXcode","sourceFilePath","targetFileName","transform","content","patchNativeSDKInitializer","PLATFORM","IOS","customerIOGroup","withCIOIosSwift","configOuter","withXcodeProject","withAppDelegate","modifyAppDelegateWithPushAppDelegateHandler","modifyAppDelegateWithNativeSDKInitializer","exports","_props$pushNotificati5","appDelegateContent","contents","includes","info","modifiedContent","addHandlerPropertyDeclaration","modifyDidFinishLaunchingWithOptions","addDidRegisterForRemoteNotificationsWithDeviceToken","addDidFailToRegisterForRemoteNotificationsWithError","handleDeeplinkInKilledState","addHandleDeeplinkInKilledState","CIO_NATIVE_SDK_INITIALIZE_CALL","methodExistsInAppDelegate","methodSignature","classDeclarationRegex","match","position","index","length","substring","codeToInject","returnStatementRegex","returnStatementMatch","insertPosition","methodRegex","methodContent","openBraceIndex","indexOf","modifiedMethod","classEndRegex","classEndMatch","deepLinkMarker","modifiedReturnStatement","replacementCode","CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SWIFT_SNIPPET"],"sources":["withCIOIosSwift.ts"],"sourcesContent":["import type {\n ExportedConfigWithProps,\n XcodeProject,\n} from '@expo/config-plugins';\nimport { withAppDelegate, withXcodeProject } from '@expo/config-plugins';\nimport type { ExpoConfig } from '@expo/config-types';\nimport path from 'path';\nimport { PLATFORM } from '../helpers/constants/common';\nimport {\n CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SWIFT_SNIPPET,\n CIO_MESSAGING_PUSH_APP_DELEGATE_INIT_REGEX,\n CIO_NATIVE_SDK_INITIALIZE_CALL,\n CIO_NATIVE_SDK_INITIALIZE_SNIPPET,\n CIO_REGISTER_PUSHNOTIFICATION_SNIPPET_v2,\n CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER,\n} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { FileManagement } from '../helpers/utils/fileManagement';\nimport { patchNativeSDKInitializer } from '../helpers/utils/patchPluginNativeCode';\nimport type { CustomerIOPluginOptionsIOS, NativeSDKConfig } from '../types/cio-types';\nimport { logger } from '../utils/logger';\nimport { getIosNativeFilesPath } from '../utils/plugin';\nimport { copyFileToXcode, getOrCreateCustomerIOGroup } from '../utils/xcode';\nimport { isFcmPushProvider } from './utils';\n\n// Constants\nconst CIO_SDK_APP_DELEGATE_HANDLER_CLASS = 'CioSdkAppDelegateHandler';\nconst CIO_SDK_APP_DELEGATE_HANDLER_FILENAME = `${CIO_SDK_APP_DELEGATE_HANDLER_CLASS}.swift`;\n\n/**\n * Copy and configure the CioSdkAppDelegateHandler.swift file\n */\nconst copyAndConfigureAppDelegateHandler = (\n config: ExportedConfigWithProps<XcodeProject>,\n sdkConfig?: NativeSDKConfig,\n props?: CustomerIOPluginOptionsIOS,\n): ExportedConfigWithProps<XcodeProject> => {\n // Destination path in the iOS project\n const projectName = config.modRequest.projectName || '';\n if (!projectName) {\n logger.warn(\n 'Project name is undefined, cannot copy CustomerIO files'\n );\n return config;\n }\n\n // Add files to the Xcode project\n const xcodeProject = config.modResults;\n const projectRoot = config.modRequest.projectRoot;\n const iosProjectRoot = path.join(projectRoot, 'ios');\n\n const group = getOrCreateCustomerIOGroup(xcodeProject, projectName);\n if (props?.pushNotification) {\n // Copy CioSdkAppDelegateHandler.swift for full push notification + auto-init support\n copyAndConfigurePushAppDelegateHandler({\n xcodeProject,\n group,\n iosProjectRoot,\n projectName,\n sdkConfig,\n props,\n });\n } else if (sdkConfig) {\n // Copy only CustomerIOSDKInitializer.swift for auto-init without push notifications\n copyAndConfigureNativeSDKInitializer({\n xcodeProject,\n group,\n iosProjectRoot,\n projectName,\n sdkConfig,\n });\n }\n\n return config;\n};\n\nconst copyAndConfigurePushAppDelegateHandler = ({\n xcodeProject,\n group,\n iosProjectRoot,\n projectName,\n sdkConfig,\n props,\n}: {\n xcodeProject: XcodeProject;\n group: XcodeProject['pbxCreateGroup'];\n iosProjectRoot: string;\n projectName: string;\n sdkConfig: NativeSDKConfig | undefined;\n props: CustomerIOPluginOptionsIOS;\n}) => {\n const useFcm = isFcmPushProvider(props);\n\n // Source path for the handler file\n const handlerSourcePath = path.join(\n getIosNativeFilesPath(),\n useFcm ? 'fcm' : 'apn',\n CIO_SDK_APP_DELEGATE_HANDLER_FILENAME\n );\n\n const handlerDestPath = path.join(\n iosProjectRoot,\n projectName,\n CIO_SDK_APP_DELEGATE_HANDLER_FILENAME\n );\n\n FileManagement.copyFile(handlerSourcePath, handlerDestPath);\n\n // Add the file to the Xcode project\n xcodeProject.addSourceFile(\n `${projectName}/${CIO_SDK_APP_DELEGATE_HANDLER_FILENAME}`,\n null,\n group\n );\n\n let handlerFileContent = FileManagement.readFile(handlerDestPath);\n\n const disableNotificationRegistration =\n props.pushNotification?.disableNotificationRegistration;\n let snippet = '';\n // unless this property is explicity set to true, push notification\n // registration will be added to the AppDelegate\n if (disableNotificationRegistration !== true) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET_v2;\n }\n handlerFileContent = replaceCodeByRegex(\n handlerFileContent,\n CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER,\n snippet\n );\n\n const autoTrackPushEvents =\n props.pushNotification?.autoTrackPushEvents !== false;\n handlerFileContent = replaceCodeByRegex(\n handlerFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const autoFetchDeviceToken =\n props.pushNotification?.autoFetchDeviceToken !== false;\n handlerFileContent = replaceCodeByRegex(\n handlerFileContent,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString()\n );\n\n const showPushAppInForeground =\n props.pushNotification?.showPushAppInForeground !== false;\n handlerFileContent = replaceCodeByRegex(\n handlerFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n // Add auto initialization if sdkConfig is provided\n if (sdkConfig) {\n // Also copy CustomerIOSDKInitializer.swift for auto-initialization\n copyAndConfigureNativeSDKInitializer({ xcodeProject, group, iosProjectRoot, projectName, sdkConfig });\n\n // Inject auto initialization call before MessagingPush initialization\n handlerFileContent = handlerFileContent.replace(CIO_MESSAGING_PUSH_APP_DELEGATE_INIT_REGEX, CIO_NATIVE_SDK_INITIALIZE_SNIPPET + '$1');\n }\n\n FileManagement.writeFile(handlerDestPath, handlerFileContent);\n};\n\nconst copyAndConfigureNativeSDKInitializer = ({\n xcodeProject,\n group,\n iosProjectRoot,\n projectName,\n sdkConfig,\n}: {\n xcodeProject: XcodeProject;\n group: XcodeProject['pbxCreateGroup'];\n iosProjectRoot: string;\n projectName: string;\n sdkConfig: NativeSDKConfig;\n}) => {\n const filename = 'CustomerIOSDKInitializer.swift';\n const sourcePath = path.join(getIosNativeFilesPath(), filename);\n // Add the CustomerIOSDKInitializer.swift file to the same Xcode group as CioSdkAppDelegateHandler\n copyFileToXcode({\n xcodeProject,\n iosProjectRoot,\n projectName,\n sourceFilePath: sourcePath,\n targetFileName: filename,\n transform: (content) => patchNativeSDKInitializer(content, PLATFORM.IOS, sdkConfig),\n customerIOGroup: group,\n });\n};\n\nexport const withCIOIosSwift = (\n configOuter: ExpoConfig,\n sdkConfig?: NativeSDKConfig,\n props?: CustomerIOPluginOptionsIOS,\n) => {\n // First, copy required swift files to iOS folder and add it to Xcode project\n configOuter = withXcodeProject(configOuter, async (config) => {\n return copyAndConfigureAppDelegateHandler(config, sdkConfig, props);\n });\n\n // Modify the AppDelegate based on configuration\n if (props?.pushNotification) {\n // With push notifications: delegate to CioSdkAppDelegateHandler for both push and auto-init\n return withAppDelegate(configOuter, async (config) => {\n return modifyAppDelegateWithPushAppDelegateHandler(config, props);\n });\n } else if (sdkConfig) {\n // Without push notifications: directly inject auto initialization into AppDelegate\n return withAppDelegate(configOuter, async (config) => {\n return modifyAppDelegateWithNativeSDKInitializer(config);\n });\n } else {\n return configOuter;\n }\n};\n\n/**\n * Modify the AppDelegate to integrate with Customer.io SDK\n */\nconst modifyAppDelegateWithPushAppDelegateHandler = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: any,\n props: CustomerIOPluginOptionsIOS\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any => {\n const appDelegateContent = config.modResults.contents;\n\n // Check if modifications have already been applied\n if (appDelegateContent.includes(CIO_SDK_APP_DELEGATE_HANDLER_CLASS)) {\n logger.info(\n 'CustomerIO Swift AppDelegate changes already exist. Skipping...'\n );\n return config;\n }\n\n // Add the handler property declaration\n let modifiedContent = addHandlerPropertyDeclaration(appDelegateContent);\n\n // Modify didFinishLaunchingWithOptions to initialize and call the handler\n modifiedContent = modifyDidFinishLaunchingWithOptions(\n modifiedContent,\n ` cioSdkHandler.application(application, didFinishLaunchingWithOptions: launchOptions)\\n\\n `\n );\n\n // Add didRegisterForRemoteNotificationsWithDeviceToken implementation\n modifiedContent =\n addDidRegisterForRemoteNotificationsWithDeviceToken(modifiedContent);\n\n // Add didFailToRegisterForRemoteNotificationsWithError implementation\n modifiedContent =\n addDidFailToRegisterForRemoteNotificationsWithError(modifiedContent);\n\n // Add deep link handling for killed state if enabled\n if (props.pushNotification?.handleDeeplinkInKilledState === true) {\n modifiedContent = addHandleDeeplinkInKilledState(modifiedContent);\n }\n\n config.modResults.contents = modifiedContent;\n return config;\n};\n\n/**\n * Modify the AppDelegate to integrate with Customer.io SDK\n */\nconst modifyAppDelegateWithNativeSDKInitializer = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any => {\n const appDelegateContent = config.modResults.contents;\n\n // Check if modifications have already been applied\n if (appDelegateContent.includes(CIO_NATIVE_SDK_INITIALIZE_CALL)) {\n logger.info(\n 'CustomerIO Swift AppDelegate changes already exist. Skipping...'\n );\n return config;\n }\n\n // Modify didFinishLaunchingWithOptions to initialize and call the handler\n const modifiedContent = modifyDidFinishLaunchingWithOptions(\n appDelegateContent,\n CIO_NATIVE_SDK_INITIALIZE_SNIPPET,\n );\n\n config.modResults.contents = modifiedContent;\n return config;\n};\n\n/**\n * Check if a method exists in the AppDelegate content\n * @param content The AppDelegate content\n * @param methodSignature The method signature to check for\n * @returns true if the method exists, false otherwise\n */\nconst methodExistsInAppDelegate = (\n content: string,\n methodSignature: string\n): boolean => {\n return content.includes(methodSignature);\n};\n\n/**\n * Add handler property declaration to the AppDelegate class\n * This adds the line: let cioSdkHandler = CioSdkAppDelegateHandler()\n * to the AppDelegate class\n */\nconst addHandlerPropertyDeclaration = (content: string): string => {\n // Look for the AppDelegate class declaration\n const classDeclarationRegex = /class\\s+AppDelegate\\s*:\\s*.*\\s*{/;\n const match = content.match(classDeclarationRegex);\n\n if (!match) {\n logger.warn('Could not find AppDelegate class declaration');\n return content;\n }\n\n const position = (match.index ?? 0) + match[0].length;\n return (\n content.substring(0, position) +\n `\\n let cioSdkHandler = ${CIO_SDK_APP_DELEGATE_HANDLER_CLASS}()\\n` +\n content.substring(position)\n );\n};\n\n/**\n * Modify didFinishLaunchingWithOptions to inject Customer.io code\n * Injects the provided code (either handler call or auto initialization) before the return statement\n */\nconst modifyDidFinishLaunchingWithOptions = (content: string, codeToInject: string): string => {\n // Find the return statement in didFinishLaunchingWithOptions\n // Always look for launchOptions since modifiedLaunchOptions is only set later\n const returnStatementRegex =\n /return\\s+super\\.application\\s*\\(\\s*application\\s*,\\s*didFinishLaunchingWithOptions\\s*:\\s*launchOptions\\s*\\)/;\n\n const returnStatementMatch = content.match(returnStatementRegex);\n\n if (!returnStatementMatch) {\n logger.warn(\n 'Could not find return statement with super.application in didFinishLaunchingWithOptions'\n );\n return content;\n }\n\n // Inject Customer.io code before the return statement\n const insertPosition = returnStatementMatch.index ?? 0;\n\n return (\n content.substring(0, insertPosition) +\n codeToInject +\n content.substring(insertPosition)\n );\n};\n\n/**\n * Add or modify didRegisterForRemoteNotificationsWithDeviceToken implementation\n * If the method already exists, it adds the handler call to the existing method\n * If the method doesn't exist, it adds a new method implementation\n */\nconst addDidRegisterForRemoteNotificationsWithDeviceToken = (\n content: string\n): string => {\n const methodSignature =\n 'func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken:';\n\n // Check if method already exists\n if (methodExistsInAppDelegate(content, methodSignature)) {\n // Method exists, modify it to call our handler\n const methodRegex =\n /func\\s+application\\s*\\(\\s*_\\s+application\\s*:\\s*UIApplication\\s*,\\s*didRegisterForRemoteNotificationsWithDeviceToken\\s+deviceToken\\s*:\\s*Data\\s*\\)\\s*{[\\s\\S]*?}/;\n const match = content.match(methodRegex);\n\n if (match) {\n // Add our handler call to the existing method\n const methodContent = match[0];\n const openBraceIndex = methodContent.indexOf('{') + 1;\n const modifiedMethod =\n methodContent.substring(0, openBraceIndex) +\n '\\n // Call CustomerIO SDK handler\\n' +\n ' cioSdkHandler.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)\\n' +\n methodContent.substring(openBraceIndex);\n\n return content.replace(methodRegex, modifiedMethod);\n }\n\n return content;\n } else {\n // Method doesn't exist, add it inside the AppDelegate class\n // Find the end of the AppDelegate class\n const classEndRegex = /^}(\\s*$|\\s*\\/\\/)/m;\n const classEndMatch = content.match(classEndRegex);\n\n if (!classEndMatch) {\n logger.warn('Could not find end of AppDelegate class');\n return content;\n }\n\n // Insert the method inside the class\n const position = classEndMatch.index ?? 0;\n return (\n content.substring(0, position) +\n '\\n // Handle device token registration\\n' +\n ' public override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {\\n' +\n ' // Call CustomerIO SDK handler\\n' +\n ' cioSdkHandler.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)\\n' +\n ' super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)\\n' +\n ' }\\n' +\n content.substring(position)\n );\n }\n};\n\n/**\n * Add or modify didFailToRegisterForRemoteNotificationsWithError implementation\n * If the method already exists, it adds the handler call to the existing method\n * If the method doesn't exist, it adds a new method implementation\n */\nconst addDidFailToRegisterForRemoteNotificationsWithError = (\n content: string\n): string => {\n const methodSignature =\n 'func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error:';\n\n // Check if method already exists\n if (methodExistsInAppDelegate(content, methodSignature)) {\n // Method exists, modify it to call our handler\n const methodRegex =\n /func\\s+application\\s*\\(\\s*_\\s+application\\s*:\\s*UIApplication\\s*,\\s*didFailToRegisterForRemoteNotificationsWithError\\s+error\\s*:\\s*Error\\s*\\)\\s*{[\\s\\S]*?}/;\n const match = content.match(methodRegex);\n\n if (match) {\n // Add our handler call to the existing method\n const methodContent = match[0];\n const openBraceIndex = methodContent.indexOf('{') + 1;\n const modifiedMethod =\n methodContent.substring(0, openBraceIndex) +\n '\\n // Call CustomerIO SDK handler\\n' +\n ' cioSdkHandler.application(application, didFailToRegisterForRemoteNotificationsWithError: error)\\n' +\n methodContent.substring(openBraceIndex);\n\n return content.replace(methodRegex, modifiedMethod);\n }\n\n return content;\n } else {\n // Method doesn't exist, add it inside the AppDelegate class\n // Find the end of the AppDelegate class\n const classEndRegex = /^}(\\s*$|\\s*\\/\\/)/m;\n const classEndMatch = content.match(classEndRegex);\n\n if (!classEndMatch) {\n logger.warn('Could not find end of AppDelegate class');\n return content;\n }\n\n // Insert the method inside the class\n const position = classEndMatch.index ?? 0;\n return (\n content.substring(0, position) +\n '\\n // Handle remote notification registration errors\\n' +\n ' public override func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {\\n' +\n ' // Call CustomerIO SDK handler\\n' +\n ' cioSdkHandler.application(application, didFailToRegisterForRemoteNotificationsWithError: error)\\n' +\n ' super.application(application, didFailToRegisterForRemoteNotificationsWithError: error)\\n' +\n ' }\\n' +\n content.substring(position)\n );\n }\n};\n\n/**\n * Add deep link handling for killed state\n * This replaces the return statement with deep link handling code\n * and a modified return statement that uses modifiedLaunchOptions\n */\nconst addHandleDeeplinkInKilledState = (content: string): string => {\n // Check if deep link code snippet is already present\n const deepLinkMarker = 'Deep link workaround for app killed state start';\n if (content.includes(deepLinkMarker)) {\n return content;\n }\n\n // Find the return statement with launchOptions\n const returnStatementRegex =\n /return\\s+super\\.application\\s*\\(\\s*application\\s*,\\s*didFinishLaunchingWithOptions\\s*:\\s*launchOptions\\s*\\)/;\n const returnStatementMatch = content.match(returnStatementRegex);\n\n if (!returnStatementMatch) {\n logger.warn('Could not find return statement with launchOptions');\n return content;\n }\n\n // Create the replacement code with deep link handling and modified return statement\n const modifiedReturnStatement =\n 'return super.application(application, didFinishLaunchingWithOptions: modifiedLaunchOptions)';\n const replacementCode =\n CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SWIFT_SNIPPET +\n '\\n\\n ' +\n modifiedReturnStatement;\n\n // Replace the return statement with deep link handling code and modified return statement\n return content.replace(returnStatementRegex, replacementCode);\n};\n"],"mappings":";;;;;;AAIA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AAQA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,sBAAA,GAAAP,OAAA;AAEA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAA4C,SAAAE,uBAAAU,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE5C;AACA,MAAMG,kCAAkC,GAAG,0BAA0B;AACr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AAG,mBAAmB;IACzC,MAAMC,aAAa,GAAG3C,OAAO,CAAC4B,KAAK,CAACc,aAAa,CAAC;IAElD,IAAI,CAACC,aAAa,EAAE;MAClBzF,cAAM,CAACC,IAAI,CAAC,yCAAyC,CAAC;MACtD,OAAO6C,OAAO;IAChB;;IAEA;IACA,MAAM6B,QAAQ,GAAGc,aAAa,CAACb,KAAK,IAAI,CAAC;IACzC,OACE9B,OAAO,CAACgC,SAAS,CAAC,CAAC,EAAEH,QAAQ,CAAC,GAC9B,yDAAyD,GACzD,qIAAqI,GACrI,sCAAsC,GACtC,uGAAuG,GACvG,+FAA+F,GAC/F,OAAO,GACP7B,OAAO,CAACgC,SAAS,CAACH,QAAQ,CAAC;EAE/B;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMN,8BAA8B,GAAIvB,OAAe,IAAa;EAClE;EACA,MAAM4C,cAAc,GAAG,iDAAiD;EACxE,IAAI5C,OAAO,CAACe,QAAQ,CAAC6B,cAAc,CAAC,EAAE;IACpC,OAAO5C,OAAO;EAChB;;EAEA;EACA,MAAMkC,oBAAoB,GACxB,6GAA6G;EAC/G,MAAMC,oBAAoB,GAAGnC,OAAO,CAAC4B,KAAK,CAACM,oBAAoB,CAAC;EAEhE,IAAI,CAACC,oBAAoB,EAAE;IACzBjF,cAAM,CAACC,IAAI,CAAC,oDAAoD,CAAC;IACjE,OAAO6C,OAAO;EAChB;;EAEA;EACA,MAAM6C,uBAAuB,GAC3B,6FAA6F;EAC/F,MAAMC,eAAe,GACnBC,oDAA+C,GAC/C,UAAU,GACVF,uBAAuB;;EAEzB;EACA,OAAO7C,OAAO,CAACV,OAAO,CAAC4C,oBAAoB,EAAEY,eAAe,CAAC;AAC/D,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_path","_interopRequireDefault","_common","_ios","_codeInjection","_fileManagement","_patchPluginNativeCode","_logger","_plugin","_xcode","_utils","e","__esModule","default","CIO_SDK_APP_DELEGATE_HANDLER_CLASS","CIO_SDK_APP_DELEGATE_HANDLER_FILENAME","copyAndConfigureAppDelegateHandler","config","sdkConfig","props","location","projectName","modRequest","logger","warn","xcodeProject","modResults","projectRoot","iosProjectRoot","path","join","group","getOrCreateCustomerIOGroup","pushNotification","copyAndConfigurePushAppDelegateHandler","copyAndConfigureNativeSDKInitializer","_props$pushNotificati","_props$pushNotificati2","_props$pushNotificati3","_props$pushNotificati4","_props$pushNotificati5","useFcm","isFcmPushProvider","handlerSourcePath","getIosNativeFilesPath","handlerDestPath","FileManagement","copyFile","addSourceFile","handlerFileContent","readFile","disableNotificationRegistration","snippet","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET_v2","replaceCodeByRegex","CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground","appGroupId","appGroupIdBuilderLine","JSON","stringify","replace","CIO_MESSAGING_PUSH_APP_DELEGATE_INIT_REGEX","CIO_NATIVE_SDK_INITIALIZE_SNIPPET","writeFile","_sdkConfig$location","locationOptions","enabled","trackingMode","undefined","filename","sourcePath","copyFileToXcode","sourceFilePath","targetFileName","transform","content","patchNativeSDKInitializer","PLATFORM","IOS","customerIOGroup","withCIOIosSwift","configOuter","withXcodeProject","withAppDelegate","modifyAppDelegateWithPushAppDelegateHandler","modifyAppDelegateWithNativeSDKInitializer","exports","_props$pushNotificati6","appDelegateContent","contents","includes","info","modifiedContent","addHandlerPropertyDeclaration","modifyDidFinishLaunchingWithOptions","addDidRegisterForRemoteNotificationsWithDeviceToken","addDidFailToRegisterForRemoteNotificationsWithError","handleDeeplinkInKilledState","addHandleDeeplinkInKilledState","CIO_NATIVE_SDK_INITIALIZE_CALL","methodExistsInAppDelegate","methodSignature","classDeclarationRegex","match","position","index","length","substring","codeToInject","returnStatementRegex","returnStatementMatch","insertPosition","methodRegex","methodContent","openBraceIndex","indexOf","modifiedMethod","classEndRegex","classEndMatch","deepLinkMarker","modifiedReturnStatement","replacementCode","CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SWIFT_SNIPPET"],"sources":["withCIOIosSwift.ts"],"sourcesContent":["import type {\n ExportedConfigWithProps,\n XcodeProject,\n} from '@expo/config-plugins';\nimport { withAppDelegate, withXcodeProject } from '@expo/config-plugins';\nimport type { ExpoConfig } from '@expo/config-types';\nimport path from 'path';\nimport { PLATFORM } from '../helpers/constants/common';\nimport {\n CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SWIFT_SNIPPET,\n CIO_MESSAGING_PUSH_APP_DELEGATE_INIT_REGEX,\n CIO_NATIVE_SDK_INITIALIZE_CALL,\n CIO_NATIVE_SDK_INITIALIZE_SNIPPET,\n CIO_REGISTER_PUSHNOTIFICATION_SNIPPET_v2,\n CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER,\n} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { FileManagement } from '../helpers/utils/fileManagement';\nimport { patchNativeSDKInitializer } from '../helpers/utils/patchPluginNativeCode';\nimport type {\n CustomerIOPluginOptionsIOS,\n CustomerIOPluginLocationOptions,\n NativeSDKConfig,\n} from '../types/cio-types';\nimport { logger } from '../utils/logger';\nimport { getIosNativeFilesPath } from '../utils/plugin';\nimport { copyFileToXcode, getOrCreateCustomerIOGroup } from '../utils/xcode';\nimport { isFcmPushProvider } from './utils';\n\n// Constants\nconst CIO_SDK_APP_DELEGATE_HANDLER_CLASS = 'CioSdkAppDelegateHandler';\nconst CIO_SDK_APP_DELEGATE_HANDLER_FILENAME = `${CIO_SDK_APP_DELEGATE_HANDLER_CLASS}.swift`;\n\n/**\n * Copy and configure the CioSdkAppDelegateHandler.swift file\n */\nconst copyAndConfigureAppDelegateHandler = (\n config: ExportedConfigWithProps<XcodeProject>,\n sdkConfig?: NativeSDKConfig,\n props?: CustomerIOPluginOptionsIOS,\n location?: CustomerIOPluginLocationOptions,\n): ExportedConfigWithProps<XcodeProject> => {\n // Destination path in the iOS project\n const projectName = config.modRequest.projectName || '';\n if (!projectName) {\n logger.warn(\n 'Project name is undefined, cannot copy CustomerIO files'\n );\n return config;\n }\n\n // Add files to the Xcode project\n const xcodeProject = config.modResults;\n const projectRoot = config.modRequest.projectRoot;\n const iosProjectRoot = path.join(projectRoot, 'ios');\n\n const group = getOrCreateCustomerIOGroup(xcodeProject, projectName);\n if (props?.pushNotification) {\n // Copy CioSdkAppDelegateHandler.swift for full push notification + auto-init support\n copyAndConfigurePushAppDelegateHandler({\n xcodeProject,\n group,\n iosProjectRoot,\n projectName,\n sdkConfig,\n props,\n location,\n });\n } else if (sdkConfig) {\n // Copy only CustomerIOSDKInitializer.swift for auto-init without push notifications\n copyAndConfigureNativeSDKInitializer({\n xcodeProject,\n group,\n iosProjectRoot,\n projectName,\n sdkConfig,\n location,\n });\n }\n\n return config;\n};\n\nconst copyAndConfigurePushAppDelegateHandler = ({\n xcodeProject,\n group,\n iosProjectRoot,\n projectName,\n sdkConfig,\n props,\n location,\n}: {\n xcodeProject: XcodeProject;\n group: XcodeProject['pbxCreateGroup'];\n iosProjectRoot: string;\n projectName: string;\n sdkConfig: NativeSDKConfig | undefined;\n props: CustomerIOPluginOptionsIOS;\n location?: CustomerIOPluginLocationOptions;\n}) => {\n const useFcm = isFcmPushProvider(props);\n\n // Source path for the handler file\n const handlerSourcePath = path.join(\n getIosNativeFilesPath(),\n useFcm ? 'fcm' : 'apn',\n CIO_SDK_APP_DELEGATE_HANDLER_FILENAME\n );\n\n const handlerDestPath = path.join(\n iosProjectRoot,\n projectName,\n CIO_SDK_APP_DELEGATE_HANDLER_FILENAME\n );\n\n FileManagement.copyFile(handlerSourcePath, handlerDestPath);\n\n // Add the file to the Xcode project\n xcodeProject.addSourceFile(\n `${projectName}/${CIO_SDK_APP_DELEGATE_HANDLER_FILENAME}`,\n null,\n group\n );\n\n let handlerFileContent = FileManagement.readFile(handlerDestPath);\n\n const disableNotificationRegistration =\n props.pushNotification?.disableNotificationRegistration;\n let snippet = '';\n // unless this property is explicity set to true, push notification\n // registration will be added to the AppDelegate\n if (disableNotificationRegistration !== true) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET_v2;\n }\n handlerFileContent = replaceCodeByRegex(\n handlerFileContent,\n CIO_REGISTER_PUSH_NOTIFICATION_PLACEHOLDER,\n snippet\n );\n\n const autoTrackPushEvents =\n props.pushNotification?.autoTrackPushEvents !== false;\n handlerFileContent = replaceCodeByRegex(\n handlerFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const autoFetchDeviceToken =\n props.pushNotification?.autoFetchDeviceToken !== false;\n handlerFileContent = replaceCodeByRegex(\n handlerFileContent,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString()\n );\n\n const showPushAppInForeground =\n props.pushNotification?.showPushAppInForeground !== false;\n handlerFileContent = replaceCodeByRegex(\n handlerFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n const appGroupId = props.pushNotification?.appGroupId;\n const appGroupIdBuilderLine = appGroupId\n ? ` .appGroupId(${JSON.stringify(appGroupId)})\\n`\n : '';\n handlerFileContent = replaceCodeByRegex(\n handlerFileContent,\n /\\{\\{APP_GROUP_ID_BUILDER_LINE\\}\\}/,\n appGroupIdBuilderLine\n );\n\n // Add auto initialization if sdkConfig is provided\n if (sdkConfig) {\n // Also copy CustomerIOSDKInitializer.swift for auto-initialization\n copyAndConfigureNativeSDKInitializer({ xcodeProject, group, iosProjectRoot, projectName, sdkConfig, location });\n\n // Inject auto initialization call before MessagingPush initialization\n handlerFileContent = handlerFileContent.replace(CIO_MESSAGING_PUSH_APP_DELEGATE_INIT_REGEX, CIO_NATIVE_SDK_INITIALIZE_SNIPPET + '$1');\n }\n\n FileManagement.writeFile(handlerDestPath, handlerFileContent);\n};\n\nconst copyAndConfigureNativeSDKInitializer = ({\n xcodeProject,\n group,\n iosProjectRoot,\n projectName,\n sdkConfig,\n location,\n}: {\n xcodeProject: XcodeProject;\n group: XcodeProject['pbxCreateGroup'];\n iosProjectRoot: string;\n projectName: string;\n sdkConfig: NativeSDKConfig;\n location?: CustomerIOPluginLocationOptions;\n}) => {\n const locationOptions = location\n ? { enabled: location.enabled === true, trackingMode: sdkConfig?.location?.trackingMode }\n : undefined;\n const filename = 'CustomerIOSDKInitializer.swift';\n const sourcePath = path.join(getIosNativeFilesPath(), filename);\n // Add the CustomerIOSDKInitializer.swift file to the same Xcode group as CioSdkAppDelegateHandler\n copyFileToXcode({\n xcodeProject,\n iosProjectRoot,\n projectName,\n sourceFilePath: sourcePath,\n targetFileName: filename,\n transform: (content) =>\n patchNativeSDKInitializer(content, PLATFORM.IOS, sdkConfig, locationOptions),\n customerIOGroup: group,\n });\n};\n\nexport const withCIOIosSwift = (\n configOuter: ExpoConfig,\n sdkConfig?: NativeSDKConfig,\n props?: CustomerIOPluginOptionsIOS,\n location?: CustomerIOPluginLocationOptions,\n) => {\n // First, copy required swift files to iOS folder and add it to Xcode project\n configOuter = withXcodeProject(configOuter, async (config) => {\n return copyAndConfigureAppDelegateHandler(config, sdkConfig, props, location);\n });\n\n // Modify the AppDelegate based on configuration\n if (props?.pushNotification) {\n // With push notifications: delegate to CioSdkAppDelegateHandler for both push and auto-init\n return withAppDelegate(configOuter, async (config) => {\n return modifyAppDelegateWithPushAppDelegateHandler(config, props);\n });\n } else if (sdkConfig) {\n // Without push notifications: directly inject auto initialization into AppDelegate\n return withAppDelegate(configOuter, async (config) => {\n return modifyAppDelegateWithNativeSDKInitializer(config);\n });\n } else {\n return configOuter;\n }\n};\n\n/**\n * Modify the AppDelegate to integrate with Customer.io SDK\n */\nconst modifyAppDelegateWithPushAppDelegateHandler = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: any,\n props: CustomerIOPluginOptionsIOS\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any => {\n const appDelegateContent = config.modResults.contents;\n\n // Check if modifications have already been applied\n if (appDelegateContent.includes(CIO_SDK_APP_DELEGATE_HANDLER_CLASS)) {\n logger.info(\n 'CustomerIO Swift AppDelegate changes already exist. Skipping...'\n );\n return config;\n }\n\n // Add the handler property declaration\n let modifiedContent = addHandlerPropertyDeclaration(appDelegateContent);\n\n // Modify didFinishLaunchingWithOptions to initialize and call the handler\n modifiedContent = modifyDidFinishLaunchingWithOptions(\n modifiedContent,\n ` cioSdkHandler.application(application, didFinishLaunchingWithOptions: launchOptions)\\n\\n `\n );\n\n // Add didRegisterForRemoteNotificationsWithDeviceToken implementation\n modifiedContent =\n addDidRegisterForRemoteNotificationsWithDeviceToken(modifiedContent);\n\n // Add didFailToRegisterForRemoteNotificationsWithError implementation\n modifiedContent =\n addDidFailToRegisterForRemoteNotificationsWithError(modifiedContent);\n\n // Add deep link handling for killed state if enabled\n if (props.pushNotification?.handleDeeplinkInKilledState === true) {\n modifiedContent = addHandleDeeplinkInKilledState(modifiedContent);\n }\n\n config.modResults.contents = modifiedContent;\n return config;\n};\n\n/**\n * Modify the AppDelegate to integrate with Customer.io SDK\n */\nconst modifyAppDelegateWithNativeSDKInitializer = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n config: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): any => {\n const appDelegateContent = config.modResults.contents;\n\n // Check if modifications have already been applied\n if (appDelegateContent.includes(CIO_NATIVE_SDK_INITIALIZE_CALL)) {\n logger.info(\n 'CustomerIO Swift AppDelegate changes already exist. Skipping...'\n );\n return config;\n }\n\n // Modify didFinishLaunchingWithOptions to initialize and call the handler\n const modifiedContent = modifyDidFinishLaunchingWithOptions(\n appDelegateContent,\n CIO_NATIVE_SDK_INITIALIZE_SNIPPET,\n );\n\n config.modResults.contents = modifiedContent;\n return config;\n};\n\n/**\n * Check if a method exists in the AppDelegate content\n * @param content The AppDelegate content\n * @param methodSignature The method signature to check for\n * @returns true if the method exists, false otherwise\n */\nconst methodExistsInAppDelegate = (\n content: string,\n methodSignature: string\n): boolean => {\n return content.includes(methodSignature);\n};\n\n/**\n * Add handler property declaration to the AppDelegate class\n * This adds the line: let cioSdkHandler = CioSdkAppDelegateHandler()\n * to the AppDelegate class\n */\nconst addHandlerPropertyDeclaration = (content: string): string => {\n // Look for the AppDelegate class declaration\n const classDeclarationRegex = /class\\s+AppDelegate\\s*:\\s*.*\\s*{/;\n const match = content.match(classDeclarationRegex);\n\n if (!match) {\n logger.warn('Could not find AppDelegate class declaration');\n return content;\n }\n\n const position = (match.index ?? 0) + match[0].length;\n return (\n content.substring(0, position) +\n `\\n let cioSdkHandler = ${CIO_SDK_APP_DELEGATE_HANDLER_CLASS}()\\n` +\n content.substring(position)\n );\n};\n\n/**\n * Modify didFinishLaunchingWithOptions to inject Customer.io code\n * Injects the provided code (either handler call or auto initialization) before the return statement\n */\nconst modifyDidFinishLaunchingWithOptions = (content: string, codeToInject: string): string => {\n // Find the return statement in didFinishLaunchingWithOptions\n // Always look for launchOptions since modifiedLaunchOptions is only set later\n const returnStatementRegex =\n /return\\s+super\\.application\\s*\\(\\s*application\\s*,\\s*didFinishLaunchingWithOptions\\s*:\\s*launchOptions\\s*\\)/;\n\n const returnStatementMatch = content.match(returnStatementRegex);\n\n if (!returnStatementMatch) {\n logger.warn(\n 'Could not find return statement with super.application in didFinishLaunchingWithOptions'\n );\n return content;\n }\n\n // Inject Customer.io code before the return statement\n const insertPosition = returnStatementMatch.index ?? 0;\n\n return (\n content.substring(0, insertPosition) +\n codeToInject +\n content.substring(insertPosition)\n );\n};\n\n/**\n * Add or modify didRegisterForRemoteNotificationsWithDeviceToken implementation\n * If the method already exists, it adds the handler call to the existing method\n * If the method doesn't exist, it adds a new method implementation\n */\nconst addDidRegisterForRemoteNotificationsWithDeviceToken = (\n content: string\n): string => {\n const methodSignature =\n 'func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken:';\n\n // Check if method already exists\n if (methodExistsInAppDelegate(content, methodSignature)) {\n // Method exists, modify it to call our handler\n const methodRegex =\n /func\\s+application\\s*\\(\\s*_\\s+application\\s*:\\s*UIApplication\\s*,\\s*didRegisterForRemoteNotificationsWithDeviceToken\\s+deviceToken\\s*:\\s*Data\\s*\\)\\s*{[\\s\\S]*?}/;\n const match = content.match(methodRegex);\n\n if (match) {\n // Add our handler call to the existing method\n const methodContent = match[0];\n const openBraceIndex = methodContent.indexOf('{') + 1;\n const modifiedMethod =\n methodContent.substring(0, openBraceIndex) +\n '\\n // Call CustomerIO SDK handler\\n' +\n ' cioSdkHandler.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)\\n' +\n methodContent.substring(openBraceIndex);\n\n return content.replace(methodRegex, modifiedMethod);\n }\n\n return content;\n } else {\n // Method doesn't exist, add it inside the AppDelegate class\n // Find the end of the AppDelegate class\n const classEndRegex = /^}(\\s*$|\\s*\\/\\/)/m;\n const classEndMatch = content.match(classEndRegex);\n\n if (!classEndMatch) {\n logger.warn('Could not find end of AppDelegate class');\n return content;\n }\n\n // Insert the method inside the class\n const position = classEndMatch.index ?? 0;\n return (\n content.substring(0, position) +\n '\\n // Handle device token registration\\n' +\n ' public override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {\\n' +\n ' // Call CustomerIO SDK handler\\n' +\n ' cioSdkHandler.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)\\n' +\n ' super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)\\n' +\n ' }\\n' +\n content.substring(position)\n );\n }\n};\n\n/**\n * Add or modify didFailToRegisterForRemoteNotificationsWithError implementation\n * If the method already exists, it adds the handler call to the existing method\n * If the method doesn't exist, it adds a new method implementation\n */\nconst addDidFailToRegisterForRemoteNotificationsWithError = (\n content: string\n): string => {\n const methodSignature =\n 'func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error:';\n\n // Check if method already exists\n if (methodExistsInAppDelegate(content, methodSignature)) {\n // Method exists, modify it to call our handler\n const methodRegex =\n /func\\s+application\\s*\\(\\s*_\\s+application\\s*:\\s*UIApplication\\s*,\\s*didFailToRegisterForRemoteNotificationsWithError\\s+error\\s*:\\s*Error\\s*\\)\\s*{[\\s\\S]*?}/;\n const match = content.match(methodRegex);\n\n if (match) {\n // Add our handler call to the existing method\n const methodContent = match[0];\n const openBraceIndex = methodContent.indexOf('{') + 1;\n const modifiedMethod =\n methodContent.substring(0, openBraceIndex) +\n '\\n // Call CustomerIO SDK handler\\n' +\n ' cioSdkHandler.application(application, didFailToRegisterForRemoteNotificationsWithError: error)\\n' +\n methodContent.substring(openBraceIndex);\n\n return content.replace(methodRegex, modifiedMethod);\n }\n\n return content;\n } else {\n // Method doesn't exist, add it inside the AppDelegate class\n // Find the end of the AppDelegate class\n const classEndRegex = /^}(\\s*$|\\s*\\/\\/)/m;\n const classEndMatch = content.match(classEndRegex);\n\n if (!classEndMatch) {\n logger.warn('Could not find end of AppDelegate class');\n return content;\n }\n\n // Insert the method inside the class\n const position = classEndMatch.index ?? 0;\n return (\n content.substring(0, position) +\n '\\n // Handle remote notification registration errors\\n' +\n ' public override func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {\\n' +\n ' // Call CustomerIO SDK handler\\n' +\n ' cioSdkHandler.application(application, didFailToRegisterForRemoteNotificationsWithError: error)\\n' +\n ' super.application(application, didFailToRegisterForRemoteNotificationsWithError: error)\\n' +\n ' }\\n' +\n content.substring(position)\n );\n }\n};\n\n/**\n * Add deep link handling for killed state\n * This replaces the return statement with deep link handling code\n * and a modified return statement that uses modifiedLaunchOptions\n */\nconst addHandleDeeplinkInKilledState = (content: string): string => {\n // Check if deep link code snippet is already present\n const deepLinkMarker = 'Deep link workaround for app killed state start';\n if (content.includes(deepLinkMarker)) {\n return content;\n }\n\n // Find the return statement with launchOptions\n const returnStatementRegex =\n /return\\s+super\\.application\\s*\\(\\s*application\\s*,\\s*didFinishLaunchingWithOptions\\s*:\\s*launchOptions\\s*\\)/;\n const returnStatementMatch = content.match(returnStatementRegex);\n\n if (!returnStatementMatch) {\n logger.warn('Could not find return statement with launchOptions');\n return content;\n }\n\n // Create the replacement code with deep link handling and modified return statement\n const modifiedReturnStatement =\n 'return super.application(application, didFinishLaunchingWithOptions: modifiedLaunchOptions)';\n const replacementCode =\n CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SWIFT_SNIPPET +\n '\\n\\n ' +\n modifiedReturnStatement;\n\n // Replace the return statement with deep link handling code and modified return statement\n return content.replace(returnStatementRegex, replacementCode);\n};\n"],"mappings":";;;;;;AAIA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AAQA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,sBAAA,GAAAP,OAAA;AAMA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAA4C,SAAAE,uBAAAU,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE5C;AACA,MAAMG,kCAAkC,GAAG,0BAA0B;AACrE,MAAMC,qCAAqC,GAAG,GAAGD,kCAAkC,QAAQ;;AAE3F;AACA;AACA;AACA,MAAME,kCAAkC,GAAGA,CACzCC,MAA6C,EAC7CC,SAA2B,EAC3BC,KAAkC,EAClCC,QAA0C,KACA;EAC1C;EACA,MAAMC,WAAW,GAAGJ,MAAM,CAACK,UAAU,CAACD,WAAW,IAAI,EAAE;EACvD,IAAI,CAACA,WAAW,EAAE;IAChBE,cAAM,CAACC,IAAI,CACT,yDACF,CAAC;IACD,OAAOP,MAAM;EACf;;EAEA;EACA,MAAM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,MAAM6C,uBAAuB,GAC3B,6FAA6F;EAC/F,MAAMC,eAAe,GACnBC,oDAA+C,GAC/C,UAAU,GACVF,uBAAuB;;EAEzB;EACA,OAAO7C,OAAO,CAACf,OAAO,CAACiD,oBAAoB,EAAEY,eAAe,CAAC;AAC/D,CAAC","ignoreList":[]}
|
|
@@ -84,7 +84,7 @@ const withCioNotificationsXcodeProject = (configOuter, props) => {
|
|
|
84
84
|
};
|
|
85
85
|
exports.withCioNotificationsXcodeProject = withCioNotificationsXcodeProject;
|
|
86
86
|
const addRichPushXcodeProj = async (options, xcodeProject) => {
|
|
87
|
-
var _options$pushNotifica2;
|
|
87
|
+
var _options$pushNotifica2, _options$pushNotifica3, _options$pushNotifica4;
|
|
88
88
|
const {
|
|
89
89
|
appleTeamId,
|
|
90
90
|
bundleIdentifier,
|
|
@@ -108,6 +108,24 @@ const addRichPushXcodeProj = async (options, xcodeProject) => {
|
|
|
108
108
|
recursive: true
|
|
109
109
|
});
|
|
110
110
|
const platformSpecificFiles = ['NotificationService.swift'];
|
|
111
|
+
const nseEntitlementsFilename = 'NotificationService.entitlements';
|
|
112
|
+
const appGroupId = (_options$pushNotifica2 = options.pushNotification) === null || _options$pushNotifica2 === void 0 ? void 0 : _options$pushNotifica2.appGroupId;
|
|
113
|
+
|
|
114
|
+
// Write NSE entitlements file only when appGroupId is explicitly configured
|
|
115
|
+
if (appGroupId) {
|
|
116
|
+
const nseEntitlementsContent = `<?xml version="1.0" encoding="UTF-8"?>
|
|
117
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
118
|
+
<plist version="1.0">
|
|
119
|
+
<dict>
|
|
120
|
+
<key>com.apple.security.application-groups</key>
|
|
121
|
+
<array>
|
|
122
|
+
<string>${appGroupId}</string>
|
|
123
|
+
</array>
|
|
124
|
+
</dict>
|
|
125
|
+
</plist>
|
|
126
|
+
`;
|
|
127
|
+
_fileManagement.FileManagement.writeFile(`${nsePath}/${nseEntitlementsFilename}`, nseEntitlementsContent);
|
|
128
|
+
}
|
|
111
129
|
const commonFiles = [PLIST_FILENAME, 'NotificationService.h', 'NotificationService.m', ENV_FILENAME];
|
|
112
130
|
const getTargetFile = filename => `${nsePath}/${filename}`;
|
|
113
131
|
// Copy platform-specific files
|
|
@@ -129,12 +147,15 @@ const addRichPushXcodeProj = async (options, xcodeProject) => {
|
|
|
129
147
|
bundleShortVersion,
|
|
130
148
|
infoPlistTargetFile
|
|
131
149
|
});
|
|
132
|
-
updateNseEnv(getTargetFile(ENV_FILENAME), (_options$
|
|
150
|
+
updateNseEnv(getTargetFile(ENV_FILENAME), (_options$pushNotifica3 = options.pushNotification) === null || _options$pushNotifica3 === void 0 ? void 0 : _options$pushNotifica3.env);
|
|
151
|
+
updateNseNotificationService(getTargetFile('NotificationService.swift'), (_options$pushNotifica4 = options.pushNotification) === null || _options$pushNotifica4 === void 0 ? void 0 : _options$pushNotifica4.appGroupId);
|
|
152
|
+
|
|
153
|
+
// The entitlements file is generated (not copied from source), so it's listed separately
|
|
154
|
+
// for the Xcode group so it appears in the file navigator
|
|
155
|
+
const allGroupFiles = [...platformSpecificFiles, ...commonFiles, ...(appGroupId ? [nseEntitlementsFilename] : [])];
|
|
133
156
|
|
|
134
157
|
// Create new PBXGroup for the extension
|
|
135
|
-
const extGroup = xcodeProject.addPbxGroup(
|
|
136
|
-
// Combine platform-specific and common files,
|
|
137
|
-
_ios.CIO_NOTIFICATION_TARGET_NAME, _ios.CIO_NOTIFICATION_TARGET_NAME);
|
|
158
|
+
const extGroup = xcodeProject.addPbxGroup(allGroupFiles, _ios.CIO_NOTIFICATION_TARGET_NAME, _ios.CIO_NOTIFICATION_TARGET_NAME);
|
|
138
159
|
|
|
139
160
|
// Add the new PBXGroup to the top level group. This makes the
|
|
140
161
|
// files / folder appear in the file explorer in Xcode.
|
|
@@ -176,6 +197,9 @@ const addRichPushXcodeProj = async (options, xcodeProject) => {
|
|
|
176
197
|
buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;
|
|
177
198
|
buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';
|
|
178
199
|
buildSettingsObj.SWIFT_VERSION = 4.2;
|
|
200
|
+
if (appGroupId) {
|
|
201
|
+
buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${_ios.CIO_NOTIFICATION_TARGET_NAME}/${nseEntitlementsFilename}`;
|
|
202
|
+
}
|
|
179
203
|
}
|
|
180
204
|
}
|
|
181
205
|
|
|
@@ -195,6 +219,13 @@ const updateNseInfoPlist = payload => {
|
|
|
195
219
|
}
|
|
196
220
|
_fileManagement.FileManagement.writeFile(payload.infoPlistTargetFile, plistFileString);
|
|
197
221
|
};
|
|
222
|
+
const updateNseNotificationService = (notificationServiceFile, appGroupId) => {
|
|
223
|
+
const APP_GROUP_ID_BUILDER_LINE_RE = /\{\{APP_GROUP_ID_BUILDER_LINE\}\}/;
|
|
224
|
+
let content = _fileManagement.FileManagement.readFile(notificationServiceFile);
|
|
225
|
+
const builderLine = appGroupId ? ` .appGroupId(${JSON.stringify(appGroupId)})\n` : '';
|
|
226
|
+
content = (0, _codeInjection.replaceCodeByRegex)(content, APP_GROUP_ID_BUILDER_LINE_RE, builderLine);
|
|
227
|
+
_fileManagement.FileManagement.writeFile(notificationServiceFile, content);
|
|
228
|
+
};
|
|
198
229
|
const updateNseEnv = (envFileName, richPushConfig) => {
|
|
199
230
|
const CDP_API_KEY_RE = /\{\{CDP_API_KEY\}\}/;
|
|
200
231
|
const REGION_RE = /\{\{REGION\}\}/;
|
|
@@ -258,11 +289,11 @@ async function addPushNotificationFile(options, xcodeProject) {
|
|
|
258
289
|
xcodeProject.addSourceFile(`${appName}/${targetFileName}`, null, group);
|
|
259
290
|
}
|
|
260
291
|
const updatePushFile = (options, envFileName) => {
|
|
261
|
-
var _options$
|
|
292
|
+
var _options$pushNotifica5, _options$pushNotifica6, _options$pushNotifica7, _options$pushNotifica8, _options$pushNotifica9, _options$pushNotifica0;
|
|
262
293
|
const REGISTER_RE = /\{\{REGISTER_SNIPPET\}\}/;
|
|
263
294
|
let envFileContent = _fileManagement.FileManagement.readFile(envFileName);
|
|
264
|
-
const disableNotificationRegistration = (_options$
|
|
265
|
-
const richPushConfig = (_options$
|
|
295
|
+
const disableNotificationRegistration = (_options$pushNotifica5 = options.pushNotification) === null || _options$pushNotifica5 === void 0 ? void 0 : _options$pushNotifica5.disableNotificationRegistration;
|
|
296
|
+
const richPushConfig = (_options$pushNotifica6 = options.pushNotification) === null || _options$pushNotifica6 === void 0 ? void 0 : _options$pushNotifica6.env;
|
|
266
297
|
const {
|
|
267
298
|
cdpApiKey,
|
|
268
299
|
region
|
|
@@ -284,12 +315,15 @@ const updatePushFile = (options, envFileName) => {
|
|
|
284
315
|
if (region) {
|
|
285
316
|
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{REGION\}\}/, region.toUpperCase());
|
|
286
317
|
}
|
|
287
|
-
const autoTrackPushEvents = ((_options$
|
|
318
|
+
const autoTrackPushEvents = ((_options$pushNotifica7 = options.pushNotification) === null || _options$pushNotifica7 === void 0 ? void 0 : _options$pushNotifica7.autoTrackPushEvents) !== false;
|
|
288
319
|
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{AUTO_TRACK_PUSH_EVENTS\}\}/, autoTrackPushEvents.toString());
|
|
289
|
-
const autoFetchDeviceToken = ((_options$
|
|
320
|
+
const autoFetchDeviceToken = ((_options$pushNotifica8 = options.pushNotification) === null || _options$pushNotifica8 === void 0 ? void 0 : _options$pushNotifica8.autoFetchDeviceToken) !== false;
|
|
290
321
|
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{AUTO_FETCH_DEVICE_TOKEN\}\}/, autoFetchDeviceToken.toString());
|
|
291
|
-
const showPushAppInForeground = ((_options$
|
|
322
|
+
const showPushAppInForeground = ((_options$pushNotifica9 = options.pushNotification) === null || _options$pushNotifica9 === void 0 ? void 0 : _options$pushNotifica9.showPushAppInForeground) !== false;
|
|
292
323
|
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{SHOW_PUSH_APP_IN_FOREGROUND\}\}/, showPushAppInForeground.toString());
|
|
324
|
+
const appGroupId = (_options$pushNotifica0 = options.pushNotification) === null || _options$pushNotifica0 === void 0 ? void 0 : _options$pushNotifica0.appGroupId;
|
|
325
|
+
const appGroupIdBuilderLine = appGroupId ? ` .appGroupId(${JSON.stringify(appGroupId)})\n` : '';
|
|
326
|
+
envFileContent = (0, _codeInjection.replaceCodeByRegex)(envFileContent, /\{\{APP_GROUP_ID_BUILDER_LINE\}\}/, appGroupIdBuilderLine);
|
|
293
327
|
_fileManagement.FileManagement.writeFile(envFileName, envFileContent);
|
|
294
328
|
};
|
|
295
329
|
//# sourceMappingURL=withNotificationsXcodeProject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_configPlugins","require","_ios","_codeInjection","_injectCIOPodfileCode","_logger","_plugin","_validation","_fileManagement","_utils","PLIST_FILENAME","CIO_NOTIFICATION_TARGET_NAME","ENV_FILENAME","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","isExpo53OrHigher","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","logger","String","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","isExpoVersion53OrHigher","exports","_options$pushNotifica2","isFcmProvider","isFcmPushProvider","injectCIONotificationPodfileCode","pbxTargetByName","warn","nsePath","FileManagement","mkdir","recursive","platformSpecificFiles","commonFiles","getTargetFile","filename","forEach","targetFile","copyFile","getIosNativeFilesPath","infoPlistTargetFile","updateNseInfoPlist","updateNseEnv","env","extGroup","addPbxGroup","groups","hash","project","objects","PBXGroup","Object","keys","key","name","path","addToPbxGroup","uuid","projObjects","PBXTargetDependency","PBXContainerItemProxy","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","richPushConfig","CDP_API_KEY_RE","REGION_RE","envFileContent","cdpApiKey","region","validateRichPushConfig","regionKey","toLowerCase","regionMap","us","eu","mappedRegion","sourceFile","targetFileName","appPath","exists","info","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","_options$pushNotifica3","_options$pushNotifica4","_options$pushNotifica5","_options$pushNotifica6","_options$pushNotifica7","REGISTER_RE","disableNotificationRegistration","snippet","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","toUpperCase","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import type { ConfigPlugin, XcodeProject } from '@expo/config-plugins';\nimport { withXcodeProject } from '@expo/config-plugins';\n\nimport {\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_REGISTER_PUSHNOTIFICATION_SNIPPET,\n DEFAULT_BUNDLE_VERSION,\n} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { injectCIONotificationPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS, RichPushConfig } from '../types/cio-types';\nimport { logger } from '../utils/logger';\nimport { getIosNativeFilesPath } from '../utils/plugin';\nimport { validateRichPushConfig } from '../utils/validation';\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport { isExpoVersion53OrHigher, 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 isExpo53OrHigher: boolean,\n) => {\n try {\n // PushService file is only needed for pre-Expo 53 code generation\n if (options.pushNotification && !isExpo53OrHigher) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush === true) {\n await addRichPushXcodeProj(options, xcodeProject);\n }\n return xcodeProject;\n } catch (error: unknown) {\n logger.error(String(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 { appleTeamId, iosDeploymentTarget, useFrameworks } = 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 } satisfies CustomerIOPluginOptionsIOS;\n\n const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults,\n isExpoVersion53OrHigher(configOuter),\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: XcodeProject,\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 logger.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 = ['NotificationService.swift'];\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 `${getIosNativeFilesPath()}/${isFcmProvider ? 'fcm' : 'apn'\n }/${filename}`,\n targetFile\n );\n });\n\n // Copy common files\n commonFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${getIosNativeFilesPath()}/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(getTargetFile(ENV_FILENAME), options.pushNotification?.env);\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 = projObjects.PBXTargetDependency || {};\n\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n logger.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 envFileName: string,\n richPushConfig?: RichPushConfig\n) => {\n const CDP_API_KEY_RE = /\\{\\{CDP_API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n // Use merged config values (config takes precedence over env)\n const cdpApiKey = richPushConfig?.cdpApiKey;\n const region = richPushConfig?.region;\n\n if (!validateRichPushConfig(richPushConfig)) {\n return;\n }\n envFileContent = replaceCodeByRegex(\n envFileContent,\n CDP_API_KEY_RE,\n cdpApiKey || 'MISSING_API_KEY',\n );\n\n // Simplify region mapping with case insensitive keys and fallback for invalid regions\n const regionKey = region?.toLowerCase() ?? '';\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n } as const;\n const mappedRegion = regionMap[regionKey as keyof typeof regionMap];\n if (!mappedRegion) {\n logger.warn(\n `${regionKey} is an invalid region. Please use the values from the docs: https://docs.customer.io/integrations/sdk/expo/getting-started/packages-options/#configuring-the-expo-plugin`\n );\n // Fallback to US if invalid region provided\n envFileContent = replaceCodeByRegex(envFileContent, REGION_RE, regionMap.us);\n } else {\n envFileContent = replaceCodeByRegex(envFileContent, REGION_RE, mappedRegion);\n }\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n\nasync function addPushNotificationFile(\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject\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 `${getIosNativeFilesPath()}/${sourceFile}`,\n targetFile\n );\n } else {\n logger.info(`${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 const disableNotificationRegistration =\n options.pushNotification?.disableNotificationRegistration;\n const richPushConfig = options.pushNotification?.env;\n const { cdpApiKey, region } = richPushConfig || {\n cdpApiKey: 'MISSING_API_KEY',\n region: undefined,\n };\n if (!validateRichPushConfig(richPushConfig)) {\n return;\n }\n\n let snippet = '';\n // unless this property is explicitly set to true, push notification\n // registration will be added to the AppDelegate\n if (disableNotificationRegistration !== true) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{CDP_API_KEY\\}\\}/,\n cdpApiKey,\n );\n\n if (region) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.pushNotification?.autoTrackPushEvents !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const autoFetchDeviceToken =\n options.pushNotification?.autoFetchDeviceToken !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString()\n );\n\n const showPushAppInForeground =\n options.pushNotification?.showPushAppInForeground !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":";;;;;;AACA,IAA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5B,cAAc,GAAG,IAAAN,iCAAkB,EACjCM,cAAc,EACd,qBAAqB,EACrBC,SACF,CAAC;EAED,IAAIC,MAAM,EAAE;IACVF,cAAc,GAAG,IAAAN,iCAAkB,EACjCM,cAAc,EACd,gBAAgB,EAChBE,MAAM,CAAC4B,WAAW,CAAC,CACrB,CAAC;EACH;EAEA,MAAMC,mBAAmB,GACvB,EAAAR,sBAAA,GAAA3H,OAAO,CAACI,gBAAgB,cAAAuH,sBAAA,uBAAxBA,sBAAA,CAA0BQ,mBAAmB,MAAK,KAAK;EACzD/B,cAAc,GAAG,IAAAN,iCAAkB,EACjCM,cAAc,EACd,gCAAgC,EAChC+B,mBAAmB,CAACC,QAAQ,CAAC,CAC/B,CAAC;EAED,MAAMC,oBAAoB,GACxB,EAAAT,sBAAA,GAAA5H,OAAO,CAACI,gBAAgB,cAAAwH,sBAAA,uBAAxBA,sBAAA,CAA0BS,oBAAoB,MAAK,KAAK;EAC1DjC,cAAc,GAAG,IAAAN,iCAAkB,EACjCM,cAAc,EACd,iCAAiC,EACjCiC,oBAAoB,CAACD,QAAQ,CAAC,CAChC,CAAC;EAED,MAAME,uBAAuB,GAC3B,EAAAT,sBAAA,GAAA7H,OAAO,CAACI,gBAAgB,cAAAyH,sBAAA,uBAAxBA,sBAAA,CAA0BS,uBAAuB,MAAK,KAAK;EAC7DlC,cAAc,GAAG,IAAAN,iCAAkB,EACjCM,cAAc,EACd,qCAAqC,EACrCkC,uBAAuB,CAACF,QAAQ,CAAC,CACnC,CAAC;EAEDxF,8BAAc,CAACmD,SAAS,CAACC,WAAW,EAAEI,cAAc,CAAC;AACvD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_ios","_codeInjection","_injectCIOPodfileCode","_logger","_plugin","_validation","_fileManagement","_utils","PLIST_FILENAME","CIO_NOTIFICATION_TARGET_NAME","ENV_FILENAME","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","isExpo53OrHigher","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","logger","String","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","isExpoVersion53OrHigher","exports","_options$pushNotifica2","_options$pushNotifica3","_options$pushNotifica4","isFcmProvider","isFcmPushProvider","injectCIONotificationPodfileCode","pbxTargetByName","warn","nsePath","FileManagement","mkdir","recursive","platformSpecificFiles","nseEntitlementsFilename","appGroupId","nseEntitlementsContent","writeFile","commonFiles","getTargetFile","filename","forEach","targetFile","copyFile","getIosNativeFilesPath","infoPlistTargetFile","updateNseInfoPlist","updateNseEnv","env","updateNseNotificationService","allGroupFiles","extGroup","addPbxGroup","groups","hash","project","objects","PBXGroup","Object","keys","key","name","path","addToPbxGroup","uuid","projObjects","PBXTargetDependency","PBXContainerItemProxy","nseTarget","addTarget","addBuildPhase","configurations","pbxXCBuildConfigurationSection","buildSettings","PRODUCT_NAME","buildSettingsObj","DEVELOPMENT_TEAM","IPHONEOS_DEPLOYMENT_TARGET","CODE_SIGN_STYLE","SWIFT_VERSION","CODE_SIGN_ENTITLEMENTS","addTargetAttribute","payload","BUNDLE_SHORT_VERSION_RE","BUNDLE_VERSION_RE","plistFileString","readFile","replaceCodeByRegex","notificationServiceFile","APP_GROUP_ID_BUILDER_LINE_RE","content","builderLine","JSON","stringify","envFileName","richPushConfig","CDP_API_KEY_RE","REGION_RE","envFileContent","cdpApiKey","region","validateRichPushConfig","regionKey","toLowerCase","regionMap","us","eu","mappedRegion","sourceFile","targetFileName","appPath","exists","info","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","_options$pushNotifica5","_options$pushNotifica6","_options$pushNotifica7","_options$pushNotifica8","_options$pushNotifica9","_options$pushNotifica0","REGISTER_RE","disableNotificationRegistration","snippet","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","toUpperCase","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground","appGroupIdBuilderLine"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import type { ConfigPlugin, XcodeProject } from '@expo/config-plugins';\nimport { withXcodeProject } from '@expo/config-plugins';\n\nimport {\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_REGISTER_PUSHNOTIFICATION_SNIPPET,\n DEFAULT_BUNDLE_VERSION,\n} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { injectCIONotificationPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS, RichPushConfig } from '../types/cio-types';\nimport { logger } from '../utils/logger';\nimport { getIosNativeFilesPath } from '../utils/plugin';\nimport { validateRichPushConfig } from '../utils/validation';\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport { isExpoVersion53OrHigher, 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 isExpo53OrHigher: boolean,\n) => {\n try {\n // PushService file is only needed for pre-Expo 53 code generation\n if (options.pushNotification && !isExpo53OrHigher) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush === true) {\n await addRichPushXcodeProj(options, xcodeProject);\n }\n return xcodeProject;\n } catch (error: unknown) {\n logger.error(String(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 { appleTeamId, iosDeploymentTarget, useFrameworks } = 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 } satisfies CustomerIOPluginOptionsIOS;\n\n const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults,\n isExpoVersion53OrHigher(configOuter),\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: XcodeProject,\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 logger.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 = ['NotificationService.swift'];\n\n const nseEntitlementsFilename = 'NotificationService.entitlements';\n const appGroupId = options.pushNotification?.appGroupId;\n\n // Write NSE entitlements file only when appGroupId is explicitly configured\n if (appGroupId) {\n const nseEntitlementsContent = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>com.apple.security.application-groups</key>\n <array>\n <string>${appGroupId}</string>\n </array>\n</dict>\n</plist>\n`;\n FileManagement.writeFile(`${nsePath}/${nseEntitlementsFilename}`, nseEntitlementsContent);\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 `${getIosNativeFilesPath()}/${isFcmProvider ? 'fcm' : 'apn'\n }/${filename}`,\n targetFile\n );\n });\n\n // Copy common files\n commonFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${getIosNativeFilesPath()}/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(getTargetFile(ENV_FILENAME), options.pushNotification?.env);\n updateNseNotificationService(getTargetFile('NotificationService.swift'), options.pushNotification?.appGroupId);\n\n // The entitlements file is generated (not copied from source), so it's listed separately\n // for the Xcode group so it appears in the file navigator\n const allGroupFiles = [\n ...platformSpecificFiles,\n ...commonFiles,\n ...(appGroupId ? [nseEntitlementsFilename] : []),\n ];\n\n // Create new PBXGroup for the extension\n const extGroup = xcodeProject.addPbxGroup(\n allGroupFiles,\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 = projObjects.PBXTargetDependency || {};\n\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n logger.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 if (appGroupId) {\n buildSettingsObj.CODE_SIGN_ENTITLEMENTS = `${CIO_NOTIFICATION_TARGET_NAME}/${nseEntitlementsFilename}`;\n }\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 updateNseNotificationService = (\n notificationServiceFile: string,\n appGroupId?: string,\n) => {\n const APP_GROUP_ID_BUILDER_LINE_RE = /\\{\\{APP_GROUP_ID_BUILDER_LINE\\}\\}/;\n\n let content = FileManagement.readFile(notificationServiceFile);\n const builderLine = appGroupId\n ? ` .appGroupId(${JSON.stringify(appGroupId)})\\n`\n : '';\n content = replaceCodeByRegex(content, APP_GROUP_ID_BUILDER_LINE_RE, builderLine);\n FileManagement.writeFile(notificationServiceFile, content);\n};\n\nconst updateNseEnv = (\n envFileName: string,\n richPushConfig?: RichPushConfig\n) => {\n const CDP_API_KEY_RE = /\\{\\{CDP_API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n // Use merged config values (config takes precedence over env)\n const cdpApiKey = richPushConfig?.cdpApiKey;\n const region = richPushConfig?.region;\n\n if (!validateRichPushConfig(richPushConfig)) {\n return;\n }\n envFileContent = replaceCodeByRegex(\n envFileContent,\n CDP_API_KEY_RE,\n cdpApiKey || 'MISSING_API_KEY',\n );\n\n // Simplify region mapping with case insensitive keys and fallback for invalid regions\n const regionKey = region?.toLowerCase() ?? '';\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n } as const;\n const mappedRegion = regionMap[regionKey as keyof typeof regionMap];\n if (!mappedRegion) {\n logger.warn(\n `${regionKey} is an invalid region. Please use the values from the docs: https://docs.customer.io/integrations/sdk/expo/getting-started/packages-options/#configuring-the-expo-plugin`\n );\n // Fallback to US if invalid region provided\n envFileContent = replaceCodeByRegex(envFileContent, REGION_RE, regionMap.us);\n } else {\n envFileContent = replaceCodeByRegex(envFileContent, REGION_RE, mappedRegion);\n }\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n\nasync function addPushNotificationFile(\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject\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 `${getIosNativeFilesPath()}/${sourceFile}`,\n targetFile\n );\n } else {\n logger.info(`${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 const disableNotificationRegistration =\n options.pushNotification?.disableNotificationRegistration;\n const richPushConfig = options.pushNotification?.env;\n const { cdpApiKey, region } = richPushConfig || {\n cdpApiKey: 'MISSING_API_KEY',\n region: undefined,\n };\n if (!validateRichPushConfig(richPushConfig)) {\n return;\n }\n\n let snippet = '';\n // unless this property is explicitly set to true, push notification\n // registration will be added to the AppDelegate\n if (disableNotificationRegistration !== true) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{CDP_API_KEY\\}\\}/,\n cdpApiKey,\n );\n\n if (region) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.pushNotification?.autoTrackPushEvents !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const autoFetchDeviceToken =\n options.pushNotification?.autoFetchDeviceToken !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString()\n );\n\n const showPushAppInForeground =\n options.pushNotification?.showPushAppInForeground !== false;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n const appGroupId = options.pushNotification?.appGroupId;\n const appGroupIdBuilderLine = appGroupId\n ? ` .appGroupId(${JSON.stringify(appGroupId)})\\n`\n : '';\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{APP_GROUP_ID_BUILDER_LINE\\}\\}/,\n appGroupIdBuilderLine\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AAKA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAEA,MAAMS,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,EAC1BC,gBAAyB,KACtB;EACH,IAAI;IAAA,IAAAC,qBAAA;IACF;IACA,IAAIH,OAAO,CAACI,gBAAgB,IAAI,CAACF,gBAAgB,EAAE;MACjD,MAAMG,uBAAuB,CAACL,OAAO,EAAEC,YAAY,CAAC;IAC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C,oBAAoB,CAACD,QAAQ,CAAC,CAChC,CAAC;EAED,MAAME,uBAAuB,GAC3B,EAAAV,sBAAA,GAAA3I,OAAO,CAACI,gBAAgB,cAAAuI,sBAAA,uBAAxBA,sBAAA,CAA0BU,uBAAuB,MAAK,KAAK;EAC7DnC,cAAc,GAAG,IAAAX,iCAAkB,EACjCW,cAAc,EACd,qCAAqC,EACrCmC,uBAAuB,CAACF,QAAQ,CAAC,CACnC,CAAC;EAED,MAAMhG,UAAU,IAAAyF,sBAAA,GAAG5I,OAAO,CAACI,gBAAgB,cAAAwI,sBAAA,uBAAxBA,sBAAA,CAA0BzF,UAAU;EACvD,MAAMmG,qBAAqB,GAAGnG,UAAU,GACpC,uBAAuByD,IAAI,CAACC,SAAS,CAAC1D,UAAU,CAAC,KAAK,GACtD,EAAE;EACN+D,cAAc,GAAG,IAAAX,iCAAkB,EACjCW,cAAc,EACd,mCAAmC,EACnCoC,qBACF,CAAC;EAEDxG,8BAAc,CAACO,SAAS,CAACyD,WAAW,EAAEI,cAAc,CAAC;AACvD,CAAC","ignoreList":[]}
|
|
@@ -7,10 +7,13 @@ exports.withCioXcodeProject = void 0;
|
|
|
7
7
|
var _configPlugins = require("@expo/config-plugins");
|
|
8
8
|
var _injectCIOPodfileCode = require("../helpers/utils/injectCIOPodfileCode");
|
|
9
9
|
var _utils = require("./utils");
|
|
10
|
+
/** Props for the CIO Xcode project mod; push options are optional when only location is enabled. */
|
|
11
|
+
|
|
10
12
|
const withCioXcodeProject = (config, cioProps) => {
|
|
11
13
|
return (0, _configPlugins.withXcodeProject)(config, async props => {
|
|
12
14
|
const iosPath = props.modRequest.platformProjectRoot;
|
|
13
|
-
|
|
15
|
+
const podfileOptions = cioProps === null || cioProps === void 0 ? void 0 : cioProps.podfileOptions;
|
|
16
|
+
await (0, _injectCIOPodfileCode.injectCIOPodfileCode)(iosPath, (0, _utils.isFcmPushProvider)(cioProps), podfileOptions);
|
|
14
17
|
return props;
|
|
15
18
|
});
|
|
16
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_configPlugins","require","_injectCIOPodfileCode","_utils","withCioXcodeProject","config","cioProps","withXcodeProject","props","iosPath","modRequest","platformProjectRoot","injectCIOPodfileCode","isFcmPushProvider","exports"],"sources":["withXcodeProject.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withXcodeProject } from '@expo/config-plugins';\n\nimport {
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_injectCIOPodfileCode","_utils","withCioXcodeProject","config","cioProps","withXcodeProject","props","iosPath","modRequest","platformProjectRoot","podfileOptions","injectCIOPodfileCode","isFcmPushProvider","exports"],"sources":["withXcodeProject.ts"],"sourcesContent":["import type { ConfigPlugin } from '@expo/config-plugins';\nimport { withXcodeProject } from '@expo/config-plugins';\n\nimport {\n injectCIOPodfileCode,\n type InjectCIOPodfileOptions,\n} from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { isFcmPushProvider } from './utils';\n\nexport type WithCioXcodeProjectOptions = {\n /** Options for Podfile host app snippet (location subspec, etc.) */\n podfileOptions?: InjectCIOPodfileOptions;\n};\n\n/** Props for the CIO Xcode project mod; push options are optional when only location is enabled. */\nexport type WithCioXcodeProjectProps = Partial<CustomerIOPluginOptionsIOS> &\n WithCioXcodeProjectOptions;\n\nexport const withCioXcodeProject: ConfigPlugin<WithCioXcodeProjectProps> = (\n config,\n cioProps\n) => {\n return withXcodeProject(config, async (props) => {\n const iosPath = props.modRequest.platformProjectRoot;\n const podfileOptions = cioProps?.podfileOptions;\n\n await injectCIOPodfileCode(\n iosPath,\n isFcmPushProvider(cioProps as CustomerIOPluginOptionsIOS | undefined),\n podfileOptions\n );\n\n return props;\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,qBAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AAOA;;AAIO,MAAMG,mBAA2D,GAAGA,CACzEC,MAAM,EACNC,QAAQ,KACL;EACH,OAAO,IAAAC,+BAAgB,EAACF,MAAM,EAAE,MAAOG,KAAK,IAAK;IAC/C,MAAMC,OAAO,GAAGD,KAAK,CAACE,UAAU,CAACC,mBAAmB;IACpD,MAAMC,cAAc,GAAGN,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEM,cAAc;IAE/C,MAAM,IAAAC,0CAAoB,EACxBJ,OAAO,EACP,IAAAK,wBAAiB,EAACR,QAAkD,CAAC,EACrEM,cACF,CAAC;IAED,OAAOJ,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACO,OAAA,CAAAX,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|