customerio-expo-plugin 1.0.0-beta.9 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/package.json +32 -24
- package/plugin/app.plugin.js +1 -0
- package/{lib → plugin/lib}/commonjs/android/withAndroidManifestUpdates.js.map +1 -1
- package/{lib → plugin/lib}/commonjs/android/withAppGoogleServices.js.map +1 -1
- package/{lib → plugin/lib}/commonjs/android/withCIOAndroid.js +2 -0
- package/plugin/lib/commonjs/android/withCIOAndroid.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/android/withGistMavenRepository.js.map +1 -1
- package/{lib → plugin/lib}/commonjs/android/withGoogleServicesJSON.js.map +1 -1
- package/{lib → plugin/lib}/commonjs/android/withProjectGoogleServices.js.map +1 -1
- package/plugin/lib/commonjs/android/withProjectStrings.js +70 -0
- package/plugin/lib/commonjs/android/withProjectStrings.js.map +1 -0
- package/plugin/lib/commonjs/helpers/constants/android.js +14 -0
- package/{lib → plugin/lib}/commonjs/helpers/constants/android.js.map +1 -1
- package/{lib → plugin/lib}/commonjs/helpers/constants/globals.d.js.map +1 -1
- package/plugin/lib/commonjs/helpers/constants/ios.js +119 -0
- package/plugin/lib/commonjs/helpers/constants/ios.js.map +1 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/apn/NotificationService.swift +25 -0
- package/{src/helpers/native-files/ios → plugin/lib/commonjs/helpers/native-files/ios/apn}/PushService.swift +11 -13
- package/plugin/lib/commonjs/helpers/native-files/ios/common/Env.swift +7 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/fcm/NotificationService.swift +25 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/fcm/PushService.swift +59 -0
- package/{lib → plugin/lib}/commonjs/helpers/utils/codeInjection.js +9 -1
- package/plugin/lib/commonjs/helpers/utils/codeInjection.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/helpers/utils/fileManagement.js.map +1 -1
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +50 -0
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -0
- package/plugin/lib/commonjs/helpers/utils/pluginUtils.js +26 -0
- package/plugin/lib/commonjs/helpers/utils/pluginUtils.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/index.js +1 -2
- package/{lib → plugin/lib}/commonjs/index.js.map +1 -1
- package/plugin/lib/commonjs/ios/utils.js +17 -0
- package/plugin/lib/commonjs/ios/utils.js.map +1 -0
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js +151 -0
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/ios/withCIOIos.js +2 -0
- package/plugin/lib/commonjs/ios/withCIOIos.js.map +1 -0
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js +68 -0
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/ios/withNotificationsXcodeProject.js +59 -45
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/ios/withXcodeProject.js +2 -1
- package/plugin/lib/commonjs/ios/withXcodeProject.js.map +1 -0
- package/{lib → plugin/lib}/commonjs/postInstall.js.map +1 -1
- package/plugin/lib/commonjs/postInstallHelper.js +22 -0
- package/plugin/lib/commonjs/postInstallHelper.js.map +1 -0
- package/plugin/lib/commonjs/types/cio-types.js.map +1 -0
- package/{lib → plugin/lib}/module/android/withAndroidManifestUpdates.js.map +1 -1
- package/{lib → plugin/lib}/module/android/withAppGoogleServices.js.map +1 -1
- package/{lib → plugin/lib}/module/android/withCIOAndroid.js +2 -0
- package/plugin/lib/module/android/withCIOAndroid.js.map +1 -0
- package/{lib → plugin/lib}/module/android/withGistMavenRepository.js.map +1 -1
- package/{lib → plugin/lib}/module/android/withGoogleServicesJSON.js.map +1 -1
- package/{lib → plugin/lib}/module/android/withProjectGoogleServices.js.map +1 -1
- package/plugin/lib/module/android/withProjectStrings.js +63 -0
- package/plugin/lib/module/android/withProjectStrings.js.map +1 -0
- package/{lib → plugin/lib}/module/helpers/constants/android.js.map +1 -1
- package/{lib → plugin/lib}/module/helpers/constants/globals.d.js.map +1 -1
- package/plugin/lib/module/helpers/constants/ios.js +112 -0
- package/plugin/lib/module/helpers/constants/ios.js.map +1 -0
- package/plugin/lib/module/helpers/native-files/ios/apn/NotificationService.swift +25 -0
- package/{lib/commonjs/helpers/native-files/ios → plugin/lib/module/helpers/native-files/ios/apn}/PushService.swift +11 -13
- package/plugin/lib/module/helpers/native-files/ios/common/Env.swift +7 -0
- package/plugin/lib/module/helpers/native-files/ios/fcm/NotificationService.swift +25 -0
- package/plugin/lib/module/helpers/native-files/ios/fcm/PushService.swift +59 -0
- package/{lib → plugin/lib}/module/helpers/utils/codeInjection.js +7 -1
- package/plugin/lib/module/helpers/utils/codeInjection.js.map +1 -0
- package/{lib → plugin/lib}/module/helpers/utils/fileManagement.js.map +1 -1
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js +43 -0
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -0
- package/plugin/lib/module/helpers/utils/pluginUtils.js +19 -0
- package/plugin/lib/module/helpers/utils/pluginUtils.js.map +1 -0
- package/{lib → plugin/lib}/module/index.js.map +1 -1
- package/plugin/lib/module/ios/utils.js +10 -0
- package/plugin/lib/module/ios/utils.js.map +1 -0
- package/plugin/lib/module/ios/withAppDelegateModifications.js +144 -0
- package/plugin/lib/module/ios/withAppDelegateModifications.js.map +1 -0
- package/{lib → plugin/lib}/module/ios/withCIOIos.js +2 -0
- package/plugin/lib/module/ios/withCIOIos.js.map +1 -0
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js +61 -0
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js.map +1 -0
- package/{lib → plugin/lib}/module/ios/withNotificationsXcodeProject.js +59 -44
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js.map +1 -0
- package/{lib → plugin/lib}/module/ios/withXcodeProject.js +2 -1
- package/plugin/lib/module/ios/withXcodeProject.js.map +1 -0
- package/{lib → plugin/lib}/module/postInstall.js.map +1 -1
- package/plugin/lib/module/postInstallHelper.js +20 -0
- package/plugin/lib/module/postInstallHelper.js.map +1 -0
- package/plugin/lib/module/types/cio-types.js.map +1 -0
- package/plugin/lib/typescript/android/withProjectStrings.d.ts +15 -0
- package/plugin/lib/typescript/helpers/constants/ios.d.ts +30 -0
- package/{lib → plugin/lib}/typescript/helpers/utils/codeInjection.d.ts +3 -1
- package/{lib → plugin/lib}/typescript/helpers/utils/injectCIOPodfileCode.d.ts +2 -2
- package/plugin/lib/typescript/helpers/utils/pluginUtils.d.ts +4 -0
- package/plugin/lib/typescript/ios/utils.d.ts +7 -0
- package/plugin/lib/typescript/ios/withGoogleServicesJsonFile.d.ts +3 -0
- package/{lib → plugin/lib}/typescript/types/cio-types.d.ts +11 -2
- package/{src → plugin/src}/android/withCIOAndroid.ts +2 -0
- package/plugin/src/android/withProjectStrings.ts +57 -0
- package/plugin/src/helpers/constants/ios.ts +144 -0
- package/plugin/src/helpers/native-files/ios/apn/NotificationService.swift +25 -0
- package/{lib/module/helpers/native-files/ios → plugin/src/helpers/native-files/ios/apn}/PushService.swift +11 -13
- package/plugin/src/helpers/native-files/ios/common/Env.swift +7 -0
- package/plugin/src/helpers/native-files/ios/fcm/NotificationService.swift +25 -0
- package/plugin/src/helpers/native-files/ios/fcm/PushService.swift +59 -0
- package/{src → plugin/src}/helpers/utils/codeInjection.ts +12 -1
- package/plugin/src/helpers/utils/injectCIOPodfileCode.ts +68 -0
- package/plugin/src/helpers/utils/pluginUtils.ts +22 -0
- package/plugin/src/ios/utils.ts +10 -0
- package/{src → plugin/src}/ios/withAppDelegateModifications.ts +133 -23
- package/{src → plugin/src}/ios/withCIOIos.ts +2 -0
- package/plugin/src/ios/withGoogleServicesJsonFile.ts +97 -0
- package/{src → plugin/src}/ios/withNotificationsXcodeProject.ts +97 -47
- package/{src → plugin/src}/ios/withXcodeProject.ts +2 -1
- package/plugin/src/postInstallHelper.js +32 -0
- package/{src → plugin/src}/types/cio-types.ts +11 -2
- package/lib/commonjs/android/withCIOAndroid.js.map +0 -1
- package/lib/commonjs/helpers/constants/android.js +0 -21
- package/lib/commonjs/helpers/constants/ios.js +0 -121
- package/lib/commonjs/helpers/constants/ios.js.map +0 -1
- package/lib/commonjs/helpers/native-files/ios/Env.swift +0 -8
- package/lib/commonjs/helpers/native-files/ios/NotificationService.swift +0 -22
- package/lib/commonjs/helpers/utils/codeInjection.js.map +0 -1
- package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +0 -36
- package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +0 -1
- package/lib/commonjs/ios/withAppDelegateModifications.js +0 -89
- package/lib/commonjs/ios/withAppDelegateModifications.js.map +0 -1
- package/lib/commonjs/ios/withCIOIos.js.map +0 -1
- package/lib/commonjs/ios/withNotificationsXcodeProject.js.map +0 -1
- package/lib/commonjs/ios/withXcodeProject.js.map +0 -1
- package/lib/commonjs/postInstallHelper.js +0 -20
- package/lib/commonjs/postInstallHelper.js.map +0 -1
- package/lib/commonjs/types/cio-types.js.map +0 -1
- package/lib/module/android/withCIOAndroid.js.map +0 -1
- package/lib/module/helpers/constants/ios.js +0 -84
- package/lib/module/helpers/constants/ios.js.map +0 -1
- package/lib/module/helpers/native-files/ios/Env.swift +0 -8
- package/lib/module/helpers/native-files/ios/NotificationService.swift +0 -22
- package/lib/module/helpers/utils/codeInjection.js.map +0 -1
- package/lib/module/helpers/utils/injectCIOPodfileCode.js +0 -29
- package/lib/module/helpers/utils/injectCIOPodfileCode.js.map +0 -1
- package/lib/module/ios/withAppDelegateModifications.js +0 -82
- package/lib/module/ios/withAppDelegateModifications.js.map +0 -1
- package/lib/module/ios/withCIOIos.js.map +0 -1
- package/lib/module/ios/withNotificationsXcodeProject.js.map +0 -1
- package/lib/module/ios/withXcodeProject.js.map +0 -1
- package/lib/module/postInstallHelper.js +0 -18
- package/lib/module/postInstallHelper.js.map +0 -1
- package/lib/module/types/cio-types.js.map +0 -1
- package/lib/typescript/helpers/constants/ios.d.ts +0 -31
- package/src/helpers/constants/ios.ts +0 -104
- package/src/helpers/native-files/ios/Env.swift +0 -8
- package/src/helpers/native-files/ios/NotificationService.swift +0 -22
- package/src/helpers/utils/injectCIOPodfileCode.ts +0 -54
- package/src/postInstallHelper.js +0 -22
- /package/{lib → plugin/lib}/commonjs/android/withAndroidManifestUpdates.js +0 -0
- /package/{lib → plugin/lib}/commonjs/android/withAppGoogleServices.js +0 -0
- /package/{lib → plugin/lib}/commonjs/android/withGistMavenRepository.js +0 -0
- /package/{lib → plugin/lib}/commonjs/android/withGoogleServicesJSON.js +0 -0
- /package/{lib → plugin/lib}/commonjs/android/withProjectGoogleServices.js +0 -0
- /package/{lib → plugin/lib}/commonjs/helpers/constants/globals.d.js +0 -0
- /package/{lib/commonjs/helpers/native-files/ios → plugin/lib/commonjs/helpers/native-files/ios/common}/NotificationService-Info.plist +0 -0
- /package/{lib/commonjs/helpers/native-files/ios → plugin/lib/commonjs/helpers/native-files/ios/common}/NotificationService.h +0 -0
- /package/{lib/commonjs/helpers/native-files/ios → plugin/lib/commonjs/helpers/native-files/ios/common}/NotificationService.m +0 -0
- /package/{lib → plugin/lib}/commonjs/helpers/utils/fileManagement.js +0 -0
- /package/{lib → plugin/lib}/commonjs/postInstall.js +0 -0
- /package/{lib → plugin/lib}/commonjs/types/cio-types.js +0 -0
- /package/{lib → plugin/lib}/module/android/withAndroidManifestUpdates.js +0 -0
- /package/{lib → plugin/lib}/module/android/withAppGoogleServices.js +0 -0
- /package/{lib → plugin/lib}/module/android/withGistMavenRepository.js +0 -0
- /package/{lib → plugin/lib}/module/android/withGoogleServicesJSON.js +0 -0
- /package/{lib → plugin/lib}/module/android/withProjectGoogleServices.js +0 -0
- /package/{lib → plugin/lib}/module/helpers/constants/android.js +0 -0
- /package/{lib → plugin/lib}/module/helpers/constants/globals.d.js +0 -0
- /package/{lib/module/helpers/native-files/ios → plugin/lib/module/helpers/native-files/ios/common}/NotificationService-Info.plist +0 -0
- /package/{lib/module/helpers/native-files/ios → plugin/lib/module/helpers/native-files/ios/common}/NotificationService.h +0 -0
- /package/{lib/module/helpers/native-files/ios → plugin/lib/module/helpers/native-files/ios/common}/NotificationService.m +0 -0
- /package/{lib → plugin/lib}/module/helpers/utils/fileManagement.js +0 -0
- /package/{lib → plugin/lib}/module/index.js +0 -0
- /package/{lib → plugin/lib}/module/postInstall.js +0 -0
- /package/{lib → plugin/lib}/module/types/cio-types.js +0 -0
- /package/{lib → plugin/lib}/typescript/android/withAndroidManifestUpdates.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/android/withAppGoogleServices.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/android/withCIOAndroid.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/android/withGistMavenRepository.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/android/withGoogleServicesJSON.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/android/withProjectGoogleServices.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/helpers/constants/android.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/helpers/utils/fileManagement.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/index.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/ios/withAppDelegateModifications.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/ios/withCIOIos.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/ios/withNotificationsXcodeProject.d.ts +0 -0
- /package/{lib → plugin/lib}/typescript/ios/withXcodeProject.d.ts +0 -0
- /package/{src → plugin/src}/android/withAndroidManifestUpdates.ts +0 -0
- /package/{src → plugin/src}/android/withAppGoogleServices.ts +0 -0
- /package/{src → plugin/src}/android/withGistMavenRepository.ts +0 -0
- /package/{src → plugin/src}/android/withGoogleServicesJSON.ts +0 -0
- /package/{src → plugin/src}/android/withProjectGoogleServices.ts +0 -0
- /package/{src → plugin/src}/helpers/constants/android.ts +0 -0
- /package/{src → plugin/src}/helpers/constants/globals.d.ts +0 -0
- /package/{src/helpers/native-files/ios → plugin/src/helpers/native-files/ios/common}/NotificationService-Info.plist +0 -0
- /package/{src/helpers/native-files/ios → plugin/src/helpers/native-files/ios/common}/NotificationService.h +0 -0
- /package/{src/helpers/native-files/ios → plugin/src/helpers/native-files/ios/common}/NotificationService.m +0 -0
- /package/{src → plugin/src}/helpers/utils/fileManagement.ts +0 -0
- /package/{src → plugin/src}/index.ts +0 -0
- /package/{src → plugin/src}/postInstall.js +0 -0
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import UserNotifications
|
|
3
|
-
import CioTracking
|
|
4
|
-
import CioMessagingPushAPN
|
|
5
|
-
|
|
6
|
-
@objc
|
|
7
|
-
public class NotificationServiceCioManager : NSObject {
|
|
8
|
-
|
|
9
|
-
public override init() {}
|
|
10
|
-
|
|
11
|
-
@objc(didReceive:withContentHandler:)
|
|
12
|
-
public func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
|
13
|
-
CustomerIO
|
|
14
|
-
.initialize(siteId: Env.customerIOSiteId, apiKey: Env.customerIOApiKey, region: Env.customerIORegion) { config in }
|
|
15
|
-
MessagingPush.shared.didReceive(request, withContentHandler: contentHandler)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@objc(serviceExtensionTimeWillExpire)
|
|
19
|
-
public func serviceExtensionTimeWillExpire() {
|
|
20
|
-
MessagingPush.shared.serviceExtensionTimeWillExpire()
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["injectCodeByRegex","fileContent","lineRegex","snippet","lines","split","index","findIndex","line","test","content","slice","injectCodeByMultiLineRegex","replace","replaceCodeByRegex","injectCodeByMultiLineRegexAndReplaceLine","injectCodeByLineNumber"],"sources":["codeInjection.ts"],"sourcesContent":["export function injectCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n const index = lines.findIndex((line) => lineRegex.test(line));\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content;\n}\n\nexport function injectCodeByMultiLineRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `$&\\n${snippet}`);\n}\n\nexport function replaceCodeByRegex(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, snippet);\n}\n\nexport function injectCodeByMultiLineRegexAndReplaceLine(\n fileContent: string,\n lineRegex: RegExp,\n snippet: string\n) {\n return fileContent.replace(lineRegex, `${snippet}`);\n}\n\nexport function injectCodeByLineNumber(\n fileContent: string,\n index: number,\n snippet: string\n) {\n const lines = fileContent.split('\\n');\n let content: string[] = lines;\n\n if (index > -1) {\n content = [...lines.slice(0, index), snippet, ...lines.slice(index)];\n }\n\n return content;\n}\n"],"mappings":"AAAA,OAAO,SAASA,iBAAiBA,CAC/BC,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,MAAMC,KAAK,GAAGH,WAAW,CAACI,KAAK,CAAC,IAAI,CAAC;EACrC,MAAMC,KAAK,GAAGF,KAAK,CAACG,SAAS,CAAEC,IAAI,IAAKN,SAAS,CAACO,IAAI,CAACD,IAAI,CAAC,CAAC;EAC7D,IAAIE,OAAiB,GAAGN,KAAK;EAE7B,IAAIE,KAAK,GAAG,CAAC,CAAC,EAAE;IACdI,OAAO,GAAG,CAAC,GAAGN,KAAK,CAACO,KAAK,CAAC,CAAC,EAAEL,KAAK,CAAC,EAAEH,OAAO,EAAE,GAAGC,KAAK,CAACO,KAAK,CAACL,KAAK,CAAC,CAAC;EACtE;EAEA,OAAOI,OAAO;AAChB;AAEA,OAAO,SAASE,0BAA0BA,CACxCX,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,OAAMC,OAAQ,EAAC,CAAC;AACzD;AAEA,OAAO,SAASW,kBAAkBA,CAChCb,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAEC,OAAO,CAAC;AAChD;AAEA,OAAO,SAASY,wCAAwCA,CACtDd,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,GAAEC,OAAQ,EAAC,CAAC;AACrD;AAEA,OAAO,SAASa,sBAAsBA,CACpCf,WAAmB,EACnBK,KAAa,EACbH,OAAe,EACf;EACA,MAAMC,KAAK,GAAGH,WAAW,CAACI,KAAK,CAAC,IAAI,CAAC;EACrC,IAAIK,OAAiB,GAAGN,KAAK;EAE7B,IAAIE,KAAK,GAAG,CAAC,CAAC,EAAE;IACdI,OAAO,GAAG,CAAC,GAAGN,KAAK,CAACO,KAAK,CAAC,CAAC,EAAEL,KAAK,CAAC,EAAEH,OAAO,EAAE,GAAGC,KAAK,CAACO,KAAK,CAACL,KAAK,CAAC,CAAC;EACtE;EAEA,OAAOI,OAAO;AAChB"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { CIO_PODFILE_REGEX, CIO_PODFILE_SNIPPET, CIO_PODFILE_NOTIFICATION_SNIPPET, CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET, CIO_PODFILE_NOTIFICATION_REGEX, CIO_CIO_TARGET_REGEX, CIO_PODFILE_POST_INSTALL_REGEX } from '../constants/ios';
|
|
2
|
-
import { FileManagement } from './fileManagement';
|
|
3
|
-
export async function injectCIOPodfileCode(iosPath) {
|
|
4
|
-
const filename = `${iosPath}/Podfile`;
|
|
5
|
-
const podfile = await FileManagement.read(filename);
|
|
6
|
-
const matches = podfile.match(CIO_PODFILE_REGEX);
|
|
7
|
-
const targetMatch = podfile.match(CIO_CIO_TARGET_REGEX);
|
|
8
|
-
if (!targetMatch) {
|
|
9
|
-
const lines = podfile.split('\n');
|
|
10
|
-
const index = lines.findIndex(line => CIO_PODFILE_POST_INSTALL_REGEX.test(line));
|
|
11
|
-
let content = lines;
|
|
12
|
-
if (index > -1) {
|
|
13
|
-
content = [...lines.slice(0, index - 1), !matches ? CIO_PODFILE_SNIPPET : '', ...lines.slice(index - 1)];
|
|
14
|
-
}
|
|
15
|
-
FileManagement.write(filename, content.join('\n'));
|
|
16
|
-
} else {
|
|
17
|
-
console.log('Customerio Podfile snippets already exists. Skipping...');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export async function injectCIONotificationPodfileCode(iosPath, useFrameworks) {
|
|
21
|
-
const filename = `${iosPath}/Podfile`;
|
|
22
|
-
const podfile = await FileManagement.read(filename);
|
|
23
|
-
const matches = podfile.match(CIO_PODFILE_NOTIFICATION_REGEX);
|
|
24
|
-
if (!matches) {
|
|
25
|
-
const snippet = useFrameworks === 'static' ? CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET : CIO_PODFILE_NOTIFICATION_SNIPPET;
|
|
26
|
-
FileManagement.append(filename, snippet);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=injectCIOPodfileCode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["CIO_PODFILE_REGEX","CIO_PODFILE_SNIPPET","CIO_PODFILE_NOTIFICATION_SNIPPET","CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET","CIO_PODFILE_NOTIFICATION_REGEX","CIO_CIO_TARGET_REGEX","CIO_PODFILE_POST_INSTALL_REGEX","FileManagement","injectCIOPodfileCode","iosPath","filename","podfile","read","matches","match","targetMatch","lines","split","index","findIndex","line","test","content","slice","write","join","console","log","injectCIONotificationPodfileCode","useFrameworks","snippet","append"],"sources":["injectCIOPodfileCode.ts"],"sourcesContent":["import type { CustomerIOPluginOptionsIOS } from '../../types/cio-types';\nimport {\n CIO_PODFILE_REGEX,\n CIO_PODFILE_SNIPPET,\n CIO_PODFILE_NOTIFICATION_SNIPPET,\n CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET,\n CIO_PODFILE_NOTIFICATION_REGEX,\n CIO_CIO_TARGET_REGEX,\n CIO_PODFILE_POST_INSTALL_REGEX,\n} from '../constants/ios';\nimport { FileManagement } from './fileManagement';\n\nexport async function injectCIOPodfileCode(iosPath: string) {\n const filename = `${iosPath}/Podfile`;\n const podfile = await FileManagement.read(filename);\n const matches = podfile.match(CIO_PODFILE_REGEX);\n const targetMatch = podfile.match(CIO_CIO_TARGET_REGEX);\n\n if (!targetMatch) {\n const lines = podfile.split('\\n');\n const index = lines.findIndex((line) =>\n CIO_PODFILE_POST_INSTALL_REGEX.test(line)\n );\n let content: string[] = lines;\n if (index > -1) {\n content = [\n ...lines.slice(0, index - 1),\n !matches ? CIO_PODFILE_SNIPPET : '',\n ...lines.slice(index - 1),\n ];\n }\n\n FileManagement.write(filename, content.join('\\n'));\n } else {\n console.log('Customerio Podfile snippets already exists. Skipping...');\n }\n}\n\nexport async function injectCIONotificationPodfileCode(\n iosPath: string,\n useFrameworks: CustomerIOPluginOptionsIOS['useFrameworks']\n) {\n const filename = `${iosPath}/Podfile`;\n const podfile = await FileManagement.read(filename);\n const matches = podfile.match(CIO_PODFILE_NOTIFICATION_REGEX);\n\n if (!matches) {\n const snippet =\n useFrameworks === 'static'\n ? CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET\n : CIO_PODFILE_NOTIFICATION_SNIPPET;\n FileManagement.append(filename, snippet);\n }\n}\n"],"mappings":"AACA,SACEA,iBAAiB,EACjBC,mBAAmB,EACnBC,gCAAgC,EAChCC,iDAAiD,EACjDC,8BAA8B,EAC9BC,oBAAoB,EACpBC,8BAA8B,QACzB,kBAAkB;AAC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E7D,IAAI,CAACS,OAAO,EAAE;IACZ,MAAMiB,OAAO,GACXD,aAAa,KAAK,QAAQ,GACtB1B,iDAAiD,GACjDD,gCAAgC;IACtCK,cAAc,CAACwB,MAAM,CAACrB,QAAQ,EAAEoB,OAAO,CAAC;EAC1C;AACF"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { withAppDelegate } from '@expo/config-plugins';
|
|
2
|
-
import { getAppDelegateHeaderFilePath } from '@expo/config-plugins/build/ios/Paths';
|
|
3
|
-
import { CIO_APPDELEGATEDECLARATION_REGEX, CIO_APPDELEGATEHEADER_REGEX, CIO_APPDELEGATEHEADER_SNIPPET, CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET, CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX, CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX, CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET, CIO_DIDFINISHLAUNCHINGMETHOD_REGEX, CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET, CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX, CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET, CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET, CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET } from '../helpers/constants/ios';
|
|
4
|
-
import { injectCodeByLineNumber, injectCodeByMultiLineRegex, injectCodeByMultiLineRegexAndReplaceLine } from '../helpers/utils/codeInjection';
|
|
5
|
-
import { FileManagement } from '../helpers/utils/fileManagement';
|
|
6
|
-
const pushCodeSnippets = [CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET, CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET];
|
|
7
|
-
const additionalMethodsForPushNotifications = `${pushCodeSnippets.join('\n')}\n`; // Join newlines and ensure a newline at the end.
|
|
8
|
-
|
|
9
|
-
const addImport = (stringContents, appName) => {
|
|
10
|
-
const importRegex = /^(#import .*)\n/gm;
|
|
11
|
-
const addedImport = getImportSnippet(appName);
|
|
12
|
-
const match = stringContents.match(importRegex);
|
|
13
|
-
let endOfMatchIndex;
|
|
14
|
-
if (!match || match.index === undefined) {
|
|
15
|
-
// No imports found, just add to start of file:
|
|
16
|
-
endOfMatchIndex = 0;
|
|
17
|
-
} else {
|
|
18
|
-
// Add after first import:
|
|
19
|
-
endOfMatchIndex = match.index + match[0].length;
|
|
20
|
-
}
|
|
21
|
-
stringContents = injectCodeByLineNumber(stringContents, endOfMatchIndex, addedImport).join('\n');
|
|
22
|
-
return stringContents;
|
|
23
|
-
};
|
|
24
|
-
const addNotificationHandlerDeclaration = stringContents => {
|
|
25
|
-
stringContents = injectCodeByMultiLineRegex(stringContents, CIO_APPDELEGATEDECLARATION_REGEX, CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET);
|
|
26
|
-
return stringContents;
|
|
27
|
-
};
|
|
28
|
-
const addNotificationConfiguration = stringContents => {
|
|
29
|
-
stringContents = injectCodeByMultiLineRegex(stringContents, CIO_DIDFINISHLAUNCHINGMETHOD_REGEX, CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET);
|
|
30
|
-
return stringContents;
|
|
31
|
-
};
|
|
32
|
-
const addDidFailToRegisterForRemoteNotificationsWithError = stringContents => {
|
|
33
|
-
stringContents = injectCodeByMultiLineRegexAndReplaceLine(stringContents, CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX, CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET);
|
|
34
|
-
return stringContents;
|
|
35
|
-
};
|
|
36
|
-
const addDidRegisterForRemoteNotificationsWithDeviceToken = stringContents => {
|
|
37
|
-
stringContents = injectCodeByMultiLineRegexAndReplaceLine(stringContents, CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX, CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET);
|
|
38
|
-
return stringContents;
|
|
39
|
-
};
|
|
40
|
-
const addAdditionalMethodsForPushNotifications = stringContents => {
|
|
41
|
-
stringContents = injectCodeByMultiLineRegex(stringContents, CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX, additionalMethodsForPushNotifications);
|
|
42
|
-
return stringContents;
|
|
43
|
-
};
|
|
44
|
-
const addAppdelegateHeaderModification = stringContents => {
|
|
45
|
-
stringContents = injectCodeByMultiLineRegexAndReplaceLine(stringContents, CIO_APPDELEGATEHEADER_REGEX, CIO_APPDELEGATEHEADER_SNIPPET);
|
|
46
|
-
return stringContents;
|
|
47
|
-
};
|
|
48
|
-
export const withAppDelegateModifications = (configOuter, props) => {
|
|
49
|
-
return withAppDelegate(configOuter, async config => {
|
|
50
|
-
let stringContents = config.modResults.contents;
|
|
51
|
-
const regex = new RegExp(`#import <${config.modRequest.projectName}-Swift.h>`);
|
|
52
|
-
const match = stringContents.match(regex);
|
|
53
|
-
if (!match) {
|
|
54
|
-
const headerPath = getAppDelegateHeaderFilePath(config.modRequest.projectRoot);
|
|
55
|
-
let headerContent = await FileManagement.read(headerPath);
|
|
56
|
-
headerContent = addAppdelegateHeaderModification(headerContent);
|
|
57
|
-
FileManagement.write(headerPath, headerContent);
|
|
58
|
-
stringContents = addImport(stringContents, config.modRequest.projectName);
|
|
59
|
-
stringContents = addNotificationHandlerDeclaration(stringContents);
|
|
60
|
-
|
|
61
|
-
// any other value would be treated as true, it has to be explicitly false to disable
|
|
62
|
-
if (props.disableNotificationRegistration !== undefined && props.disableNotificationRegistration === false) {
|
|
63
|
-
stringContents = addNotificationConfiguration(stringContents);
|
|
64
|
-
}
|
|
65
|
-
stringContents = addAdditionalMethodsForPushNotifications(stringContents);
|
|
66
|
-
stringContents = addDidFailToRegisterForRemoteNotificationsWithError(stringContents);
|
|
67
|
-
stringContents = addDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);
|
|
68
|
-
config.modResults.contents = stringContents;
|
|
69
|
-
} else {
|
|
70
|
-
console.log('Customerio AppDelegate changes already exist. Skipping...');
|
|
71
|
-
}
|
|
72
|
-
return config;
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
function getImportSnippet(appName) {
|
|
76
|
-
return `
|
|
77
|
-
// Add swift bridge imports
|
|
78
|
-
#import <ExpoModulesCore-Swift.h>
|
|
79
|
-
#import <${appName}-Swift.h>
|
|
80
|
-
`;
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=withAppDelegateModifications.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["withAppDelegate","getAppDelegateHeaderFilePath","CIO_APPDELEGATEDECLARATION_REGEX","CIO_APPDELEGATEHEADER_REGEX","CIO_APPDELEGATEHEADER_SNIPPET","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET","injectCodeByLineNumber","injectCodeByMultiLineRegex","injectCodeByMultiLineRegexAndReplaceLine","FileManagement","pushCodeSnippets","additionalMethodsForPushNotifications","join","addImport","stringContents","appName","importRegex","addedImport","getImportSnippet","match","endOfMatchIndex","index","undefined","length","addNotificationHandlerDeclaration","addNotificationConfiguration","addDidFailToRegisterForRemoteNotificationsWithError","addDidRegisterForRemoteNotificationsWithDeviceToken","addAdditionalMethodsForPushNotifications","addAppdelegateHeaderModification","withAppDelegateModifications","configOuter","props","config","modResults","contents","regex","RegExp","modRequest","projectName","headerPath","projectRoot","headerContent","read","write","disableNotificationRegistration","console","log"],"sources":["withAppDelegateModifications.ts"],"sourcesContent":["import { ConfigPlugin, withAppDelegate } from '@expo/config-plugins';\nimport { getAppDelegateHeaderFilePath } from '@expo/config-plugins/build/ios/Paths';\n\nimport {\n CIO_APPDELEGATEDECLARATION_REGEX,\n CIO_APPDELEGATEHEADER_REGEX,\n CIO_APPDELEGATEHEADER_SNIPPET,\n CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET,\n CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET,\n} from '../helpers/constants/ios';\nimport {\n injectCodeByLineNumber,\n injectCodeByMultiLineRegex,\n injectCodeByMultiLineRegexAndReplaceLine,\n} from '../helpers/utils/codeInjection';\nimport { FileManagement } from '../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\n\nconst pushCodeSnippets = [\n CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET,\n CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET,\n];\n\nconst additionalMethodsForPushNotifications = `${pushCodeSnippets.join(\n '\\n'\n)}\\n`; // Join newlines and ensure a newline at the end.\n\nconst addImport = (stringContents: string, appName: string) => {\n const importRegex = /^(#import .*)\\n/gm;\n const addedImport = getImportSnippet(appName);\n\n const match = stringContents.match(importRegex);\n let endOfMatchIndex: number;\n if (!match || match.index === undefined) {\n // No imports found, just add to start of file:\n endOfMatchIndex = 0;\n } else {\n // Add after first import:\n endOfMatchIndex = match.index + match[0].length;\n }\n\n stringContents = injectCodeByLineNumber(\n stringContents,\n endOfMatchIndex,\n addedImport\n ).join('\\n');\n\n return stringContents;\n};\n\nconst addNotificationHandlerDeclaration = (stringContents: string) => {\n stringContents = injectCodeByMultiLineRegex(\n stringContents,\n CIO_APPDELEGATEDECLARATION_REGEX,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addNotificationConfiguration = (stringContents: string) => {\n stringContents = injectCodeByMultiLineRegex(\n stringContents,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addDidFailToRegisterForRemoteNotificationsWithError = (\n stringContents: string\n) => {\n stringContents = injectCodeByMultiLineRegexAndReplaceLine(\n stringContents,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addDidRegisterForRemoteNotificationsWithDeviceToken = (\n stringContents: string\n) => {\n stringContents = injectCodeByMultiLineRegexAndReplaceLine(\n stringContents,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addAdditionalMethodsForPushNotifications = (stringContents: string) => {\n stringContents = injectCodeByMultiLineRegex(\n stringContents,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX,\n additionalMethodsForPushNotifications\n );\n\n return stringContents;\n};\n\nconst addAppdelegateHeaderModification = (stringContents: string) => {\n stringContents = injectCodeByMultiLineRegexAndReplaceLine(\n stringContents,\n CIO_APPDELEGATEHEADER_REGEX,\n CIO_APPDELEGATEHEADER_SNIPPET\n );\n\n return stringContents;\n};\n\nexport const withAppDelegateModifications: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withAppDelegate(configOuter, async (config) => {\n let stringContents = config.modResults.contents;\n const regex = new RegExp(\n `#import <${config.modRequest.projectName}-Swift.h>`\n );\n const match = stringContents.match(regex);\n\n if (!match) {\n const headerPath = getAppDelegateHeaderFilePath(\n config.modRequest.projectRoot\n );\n let headerContent = await FileManagement.read(headerPath);\n headerContent = addAppdelegateHeaderModification(headerContent);\n FileManagement.write(headerPath, headerContent);\n\n stringContents = addImport(\n stringContents,\n config.modRequest.projectName as string\n );\n stringContents = addNotificationHandlerDeclaration(stringContents);\n\n // any other value would be treated as true, it has to be explicitly false to disable\n if (\n props.disableNotificationRegistration !== undefined &&\n props.disableNotificationRegistration === false\n ) {\n stringContents = addNotificationConfiguration(stringContents);\n }\n stringContents = addAdditionalMethodsForPushNotifications(stringContents);\n stringContents =\n addDidFailToRegisterForRemoteNotificationsWithError(stringContents);\n stringContents =\n addDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);\n\n config.modResults.contents = stringContents;\n } else {\n console.log('Customerio AppDelegate changes already exist. Skipping...');\n }\n\n return config;\n });\n};\nfunction getImportSnippet(appName: string) {\n return `\n// Add swift bridge imports\n#import <ExpoModulesCore-Swift.h>\n#import <${appName}-Swift.h>\n `;\n}\n"],"mappings":"AAAA,SAAuBA,eAAe,QAAQ,sBAAsB;AACpE,SAASC,4BAA4B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,MAAMjC,cAAc,CAACkC,IAAI,CAACH,UAAU,CAAC;MACzDE,aAAa,GAAGb,gCAAgC,CAACa,aAAa,CAAC;MAC/DjC,cAAc,CAACmC,KAAK,CAACJ,UAAU,EAAEE,aAAa,CAAC;MAE/C5B,cAAc,GAAGD,SAAS,CACxBC,cAAc,EACdmB,MAAM,CAACK,UAAU,CAACC,WACpB,CAAC;MACDzB,cAAc,GAAGU,iCAAiC,CAACV,cAAc,CAAC;;MAElE;MACA,IACEkB,KAAK,CAACa,+BAA+B,KAAKvB,SAAS,IACnDU,KAAK,CAACa,+BAA+B,KAAK,KAAK,EAC/C;QACA/B,cAAc,GAAGW,4BAA4B,CAACX,cAAc,CAAC;MAC/D;MACAA,cAAc,GAAGc,wCAAwC,CAACd,cAAc,CAAC;MACzEA,cAAc,GACZY,mDAAmD,CAACZ,cAAc,CAAC;MACrEA,cAAc,GACZa,mDAAmD,CAACb,cAAc,CAAC;MAErEmB,MAAM,CAACC,UAAU,CAACC,QAAQ,GAAGrB,cAAc;IAC7C,CAAC,MAAM;MACLgC,OAAO,CAACC,GAAG,CAAC,2DAA2D,CAAC;IAC1E;IAEA,OAAOd,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AACD,SAASf,gBAAgBA,CAACH,OAAe,EAAE;EACzC,OAAQ;AACV;AACA;AACA,WAAWA,OAAQ;AACnB,GAAG;AACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["withAppDelegateModifications","withCioNotificationsXcodeProject","withCioXcodeProject","withCIOIos","config","props","pushNotification"],"sources":["withCIOIos.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { withAppDelegateModifications } from './withAppDelegateModifications';\nimport { withCioNotificationsXcodeProject } from './withNotificationsXcodeProject';\nimport { withCioXcodeProject } from './withXcodeProject';\n\nexport function withCIOIos(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsIOS\n) {\n if (props.pushNotification) {\n config = withAppDelegateModifications(config, props);\n config = withCioNotificationsXcodeProject(config, props);\n config = withCioXcodeProject(config, props);\n }\n\n return config;\n}\n"],"mappings":"AAGA,SAASA,4BAA4B,QAAQ,gCAAgC;AAC7E,SAASC,gCAAgC,QAAQ,iCAAiC;AAClF,SAASC,mBAAmB,QAAQ,oBAAoB;AAExD,OAAO,SAASC,UAAUA,CACxBC,MAAkB,EAClBC,KAAiC,EACjC;EACA,IAAIA,KAAK,CAACC,gBAAgB,EAAE;IAC1BF,MAAM,GAAGJ,4BAA4B,CAACI,MAAM,EAAEC,KAAK,CAAC;IACpDD,MAAM,GAAGH,gCAAgC,CAACG,MAAM,EAAEC,KAAK,CAAC;IACxDD,MAAM,GAAGF,mBAAmB,CAACE,MAAM,EAAEC,KAAK,CAAC;EAC7C;EAEA,OAAOD,MAAM;AACf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["withXcodeProject","xcode","CIO_NOTIFICATION_TARGET_NAME","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","DEFAULT_BUNDLE_VERSION","LOCAL_PATH_TO_CIO_NSE_FILES","replaceCodeByRegex","injectCIONotificationPodfileCode","FileManagement","PLIST_FILENAME","ENV_FILENAME","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","iosPath","appName","projPath","xcodeProject","project","parse","err","_options$pushNotifica","Error","JSON","stringify","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","writeFile","writeSync","withCioNotificationsXcodeProject","configOuter","props","config","modRequest","ios","version","bundleShortVersion","appleTeamId","iosDeploymentTarget","useFrameworks","undefined","projectName","platformProjectRoot","bundleIdentifier","buildNumber","bundleVersion","pbxTargetByName","console","warn","nsePath","mkdir","recursive","files","getTargetFile","filename","forEach","targetFile","copyFile","infoPlistTargetFile","updateNseInfoPlist","updateNseEnv","extGroup","addPbxGroup","groups","hash","objects","Object","keys","key","name","path","addToPbxGroup","uuid","projObjects","nseTarget","addTarget","addBuildPhase","configurations","pbxXCBuildConfigurationSection","buildSettings","PRODUCT_NAME","buildSettingsObj","DEVELOPMENT_TEAM","IPHONEOS_DEPLOYMENT_TARGET","CODE_SIGN_STYLE","SWIFT_VERSION","addTargetAttribute","payload","BUNDLE_SHORT_VERSION_RE","BUNDLE_VERSION_RE","plistFileString","readFile","envFileName","_options$pushNotifica2","_options$pushNotifica3","_options$pushNotifica6","_options$pushNotifica7","_options$pushNotifica10","_options$pushNotifica11","SITE_ID_RE","API_KEY_RE","REGION_RE","envFileContent","env","siteId","_options$pushNotifica4","_options$pushNotifica5","apiKey","_options$pushNotifica8","_options$pushNotifica9","region","_options$pushNotifica12","_options$pushNotifica13","_options$pushNotifica14","regionMap","us","eu","toLowerCase","mappedRegion","_options$pushNotifica15","_options$pushNotifica16","file","appPath","exists","log","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","REGISTER_RE","snippet","disableNotificationRegistration"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins';\nimport xcode from 'xcode';\n\nimport {\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_REGISTER_PUSHNOTIFICATION_SNIPPET,\n DEFAULT_BUNDLE_VERSION,\n LOCAL_PATH_TO_CIO_NSE_FILES,\n} from '../helpers/constants/ios';\nimport { replaceCodeByRegex } from '../helpers/utils/codeInjection';\nimport { injectCIONotificationPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { FileManagement } from './../helpers/utils/fileManagement';\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) => {\n // iosPath and appName are predefined from Expo config.\n // See function withCioNotificationsXcodeProject to get where the variabes are pulled from.\n const { iosPath, appName } = options;\n\n const projPath = `${iosPath}/${appName}.xcodeproj/project.pbxproj`;\n\n const xcodeProject = xcode.project(projPath);\n\n xcodeProject.parse(async function (err: Error) {\n if (err) {\n throw new Error(`Error parsing iOS project: ${JSON.stringify(err)}`);\n }\n\n if (options.pushNotification) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush) {\n await addRichPushXcodeProj(options, xcodeProject);\n }\n\n FileManagement.writeFile(projPath, xcodeProject.writeSync());\n });\n};\n\nexport const withCioNotificationsXcodeProject: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withXcodeProject(configOuter, async (config) => {\n const { modRequest, ios, version: bundleShortVersion } = config;\n const {\n appleTeamId,\n iosDeploymentTarget,\n pushNotification,\n useFrameworks,\n } = props;\n\n if (ios === undefined)\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios config missing from app.config.js or app.json.'\n );\n\n // projectName and platformProjectRoot translates to appName and iosPath in addNotificationServiceExtension()\n const { projectName, platformProjectRoot } = modRequest;\n const { bundleIdentifier, buildNumber } = ios;\n\n if (bundleShortVersion === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: version missing from app.config.js or app.json'\n );\n }\n\n if (bundleIdentifier === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: ios.bundleIdentifier missing from app.config.js or app.json'\n );\n }\n\n if (projectName === undefined) {\n throw new Error(\n 'Adding NotificationServiceExtension failed: name missing from app.config.js or app.json'\n );\n }\n\n const options = {\n ...props,\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion: buildNumber || DEFAULT_BUNDLE_VERSION,\n iosPath: platformProjectRoot,\n appName: projectName,\n useFrameworks,\n iosDeploymentTarget,\n pushNotification,\n };\n\n await addNotificationServiceExtension(options);\n\n return config;\n });\n};\n\nconst addRichPushXcodeProj = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: any\n) => {\n const {\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion,\n iosPath,\n iosDeploymentTarget,\n useFrameworks,\n } = options;\n\n await injectCIONotificationPodfileCode(iosPath, useFrameworks);\n\n // Check if `CIO_NOTIFICATION_TARGET_NAME` group already exist in the project\n // If true then skip creating a new group to avoid duplicate folders\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n console.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n const nsePath = `${iosPath}/${CIO_NOTIFICATION_TARGET_NAME}`;\n FileManagement.mkdir(nsePath, {\n recursive: true,\n });\n\n const files = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.swift',\n 'NotificationService.m',\n ENV_FILENAME,\n ];\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n\n files.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${filename}`,\n targetFile\n );\n });\n\n /* MODIFY COPIED EXTENSION FILES */\n const infoPlistTargetFile = getTargetFile(PLIST_FILENAME);\n updateNseInfoPlist({\n bundleVersion,\n bundleShortVersion,\n infoPlistTargetFile,\n });\n updateNseEnv(options, getTargetFile(ENV_FILENAME));\n\n // Create new PBXGroup for the extension\n const extGroup = xcodeProject.addPbxGroup(\n files,\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_NOTIFICATION_TARGET_NAME\n );\n\n // Add the new PBXGroup to the top level group. This makes the\n // files / folder appear in the file explorer in Xcode.\n const groups = xcodeProject.hash.project.objects['PBXGroup'];\n Object.keys(groups).forEach((key) => {\n if (groups[key].name === undefined && groups[key].path === undefined) {\n xcodeProject.addToPbxGroup(extGroup.uuid, key);\n }\n });\n\n // WORK AROUND for codeProject.addTarget BUG\n // Xcode projects don't contain these if there is only one target\n // An upstream fix should be made to the code referenced in this link:\n // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860\n const projObjects = xcodeProject.hash.project.objects;\n projObjects['PBXTargetDependency'] = projObjects['PBXTargetDependency'] || {};\n projObjects['PBXContainerItemProxy'] =\n projObjects['PBXTargetDependency'] || {};\n\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n console.warn(\n `${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`\n );\n return;\n }\n\n // Add the NSE target\n // This also adds PBXTargetDependency and PBXContainerItemProxy\n const nseTarget = xcodeProject.addTarget(\n CIO_NOTIFICATION_TARGET_NAME,\n 'app_extension',\n CIO_NOTIFICATION_TARGET_NAME,\n `${bundleIdentifier}.richpush`\n );\n\n // Add build phases to the new target\n xcodeProject.addBuildPhase(\n ['NotificationService.m', 'NotificationService.swift', 'Env.swift'],\n 'PBXSourcesBuildPhase',\n 'Sources',\n nseTarget.uuid\n );\n xcodeProject.addBuildPhase(\n [],\n 'PBXResourcesBuildPhase',\n 'Resources',\n nseTarget.uuid\n );\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXFrameworksBuildPhase',\n 'Frameworks',\n nseTarget.uuid\n );\n\n // Edit the Deployment info of the target\n const configurations = xcodeProject.pbxXCBuildConfigurationSection();\n for (const key in configurations) {\n if (\n typeof configurations[key].buildSettings !== 'undefined' &&\n configurations[key].buildSettings.PRODUCT_NAME ===\n `\"${CIO_NOTIFICATION_TARGET_NAME}\"`\n ) {\n const buildSettingsObj = configurations[key].buildSettings;\n buildSettingsObj.DEVELOPMENT_TEAM = appleTeamId;\n buildSettingsObj.IPHONEOS_DEPLOYMENT_TARGET =\n iosDeploymentTarget || '13.0';\n buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;\n buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';\n buildSettingsObj.SWIFT_VERSION = 4.2;\n }\n }\n\n // Add development team to the target & the main\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId, nseTarget);\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId);\n};\n\nconst updateNseInfoPlist = (payload: {\n bundleVersion?: string;\n bundleShortVersion?: string;\n infoPlistTargetFile: string;\n}) => {\n const BUNDLE_SHORT_VERSION_RE = /\\{\\{BUNDLE_SHORT_VERSION\\}\\}/;\n const BUNDLE_VERSION_RE = /\\{\\{BUNDLE_VERSION\\}\\}/;\n\n let plistFileString = FileManagement.readFile(payload.infoPlistTargetFile);\n\n if (payload.bundleVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_VERSION_RE,\n payload.bundleVersion\n );\n }\n\n if (payload.bundleShortVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_SHORT_VERSION_RE,\n payload.bundleShortVersion\n );\n }\n\n FileManagement.writeFile(payload.infoPlistTargetFile, plistFileString);\n};\n\nconst updateNseEnv = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const SITE_ID_RE = /\\{\\{SITE_ID\\}\\}/;\n const API_KEY_RE = /\\{\\{API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n if (options.pushNotification?.env?.siteId) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n SITE_ID_RE,\n options.pushNotification?.env?.siteId\n );\n }\n\n if (options.pushNotification?.env?.apiKey) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n API_KEY_RE,\n options.pushNotification?.env?.apiKey\n );\n }\n\n if (options.pushNotification?.env?.region) {\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n };\n const region = options.pushNotification?.env?.region?.toLowerCase();\n const mappedRegion = (regionMap as any)[region] || '';\n if (!mappedRegion) {\n console.warn(\n `${options.pushNotification?.env?.region} is an invalid region. Please use the values from the docs: https://customer.io/docs/sdk/expo/getting-started/#configure-the-plugin`\n );\n } else {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n REGION_RE,\n mappedRegion\n );\n }\n }\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n\nasync function addPushNotificationFile(\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: any\n) {\n const { iosPath, appName } = options;\n const file = 'PushService.swift';\n const appPath = `${iosPath}/${appName}`;\n const getTargetFile = (filename: string) => `${appPath}/${filename}`;\n const targetFile = getTargetFile(file);\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(file))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${file}`,\n targetFile\n );\n } else {\n console.log(`${getTargetFile(file)} 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}/${file}`, null, group);\n}\n\nconst updatePushFile = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const REGISTER_RE = /\\{\\{REGISTER_SNIPPET\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n let snippet = '';\n if (\n options.disableNotificationRegistration !== undefined &&\n options.disableNotificationRegistration === false\n ) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":"AAAA,SAAuBA,gBAAgB,QAAQ,sBAAsB;AACrE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SACEC,4BAA4B,EAC5BC,qCAAqC,EACrCC,sBAAsB,EACtBC,2BAA2B,QACtB,0BAA0B;AACjC,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,gCAAgC,QAAQ,uCAAuC;AAEx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,QAAQ,CACpB,GAAEtD,2BAA4B,IAAGsH,IAAK,EAAC,EACxCjE,UACF,CAAC;EACH,CAAC,MAAM;IACLT,OAAO,CAAC6E,GAAG,CAAE,GAAEvE,aAAa,CAACoE,IAAI,CAAE,8BAA6B,CAAC;IACjE;EACF;EAEAI,cAAc,CAAClH,OAAO,EAAE6C,UAAU,CAAC;EAEnC,MAAMsE,KAAK,GAAG/G,YAAY,CAACgH,cAAc,CAAC,yBAAyB,CAAC;EACpE,MAAMC,UAAU,GAAGjH,YAAY,CAACkH,eAAe,CAAC;IAAE5D,IAAI,EAAG,GAAExD,OAAQ;EAAE,CAAC,CAAC;EACvEE,YAAY,CAACwD,aAAa,CAACuD,KAAK,EAAEE,UAAU,CAAC;EAE7CjH,YAAY,CAACmH,aAAa,CAAE,GAAErH,OAAQ,IAAG4G,IAAK,EAAC,EAAE,IAAI,EAAEK,KAAK,CAAC;AAC/D;AAEA,MAAMD,cAAc,GAAGA,CACrBlH,OAAmC,EACnCiF,WAAmB,KAChB;EACH,MAAMuC,WAAW,GAAG,0BAA0B;EAE9C,IAAI7B,cAAc,GAAGhG,cAAc,CAACqF,QAAQ,CAACC,WAAW,CAAC;EAEzD,IAAIwC,OAAO,GAAG,EAAE;EAChB,IACEzH,OAAO,CAAC0H,+BAA+B,KAAK7F,SAAS,IACrD7B,OAAO,CAAC0H,+BAA+B,KAAK,KAAK,EACjD;IACAD,OAAO,GAAGnI,qCAAqC;EACjD;EAEAqG,cAAc,GAAGlG,kBAAkB,CAACkG,cAAc,EAAE6B,WAAW,EAAEC,OAAO,CAAC;EAEzE9H,cAAc,CAACqB,SAAS,CAACiE,WAAW,EAAEU,cAAc,CAAC;AACvD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["withXcodeProject","injectCIOPodfileCode","withCioXcodeProject","config","cioProps","props","_props$ios","_props$ios2","options","iosPath","modRequest","platformProjectRoot","bundleIdentifier","ios","devTeam","bundleVersion","buildNumber","bundleShortVersion","version","iosDeploymentTarget"],"sources":["withXcodeProject.ts"],"sourcesContent":["import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins';\n\nimport { injectCIOPodfileCode } from '../helpers/utils/injectCIOPodfileCode';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\n\nexport const withCioXcodeProject: ConfigPlugin<CustomerIOPluginOptionsIOS> = (\n config,\n cioProps\n) => {\n return withXcodeProject(config, async (props) => {\n const options: CustomerIOPluginOptionsIOS = {\n iosPath: props.modRequest.platformProjectRoot,\n bundleIdentifier: props.ios?.bundleIdentifier,\n devTeam: cioProps?.devTeam,\n bundleVersion: props.ios?.buildNumber,\n bundleShortVersion: props?.version,\n iosDeploymentTarget: cioProps?.iosDeploymentTarget,\n };\n const { iosPath } = options;\n\n await injectCIOPodfileCode(iosPath);\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,gBAAgB,QAAQ,sBAAsB;AAErE,SAASC,oBAAoB,QAAQ,uCAAuC;AAG5E,OAAO,MAAMC,mBAA6D,GAAGA,CAC3EC,MAAM,EACNC,QAAQ,KACL;EACH,OAAOJ,gBAAgB,CAACG,MAAM,EAAE,MAAOE,KAAK,IAAK;IAAA,IAAAC,UAAA,EAAAC,WAAA;IAC/C,MAAMC,OAAmC,GAAG;MAC1CC,OAAO,EAAEJ,KAAK,CAACK,UAAU,CAACC,mBAAmB;MAC7CC,gBAAgB,GAAAN,UAAA,GAAED,KAAK,CAACQ,GAAG,cAAAP,UAAA,uBAATA,UAAA,CAAWM,gBAAgB;MAC7CE,OAAO,EAAEV,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEU,OAAO;MAC1BC,aAAa,GAAAR,WAAA,GAAEF,KAAK,CAACQ,GAAG,cAAAN,WAAA,uBAATA,WAAA,CAAWS,WAAW;MACrCC,kBAAkB,EAAEZ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEa,OAAO;MAClCC,mBAAmB,EAAEf,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEe;IACjC,CAAC;IACD,MAAM;MAAEV;IAAQ,CAAC,GAAGD,OAAO;IAE3B,MAAMP,oBAAoB,CAACQ,OAAO,CAAC;IAEnC,OAAOJ,KAAK;EACd,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
function runPostInstall() {
|
|
3
|
-
// react native SDK package.json path
|
|
4
|
-
const rnPjsonFile = `${__dirname}/../../customerio-reactnative/package.json`;
|
|
5
|
-
const expoPjsonFile = `${__dirname}/../package.json`;
|
|
6
|
-
try {
|
|
7
|
-
// if react native SDK is installed
|
|
8
|
-
if (fs.existsSync(rnPjsonFile)) {
|
|
9
|
-
const rnPJson = fs.readFileSync(rnPjsonFile, 'utf8');
|
|
10
|
-
expoPjson = require(expoPjsonFile);
|
|
11
|
-
const rnPackage = JSON.parse(rnPJson);
|
|
12
|
-
rnPackage.expoVersion = expoPjson.version;
|
|
13
|
-
fs.writeFileSync(rnPjsonFile, JSON.stringify(rnPackage, null, 2));
|
|
14
|
-
}
|
|
15
|
-
} catch (error) {}
|
|
16
|
-
}
|
|
17
|
-
exports.runPostInstall = runPostInstall;
|
|
18
|
-
//# sourceMappingURL=postInstallHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["fs","require","runPostInstall","rnPjsonFile","__dirname","expoPjsonFile","existsSync","rnPJson","readFileSync","expoPjson","rnPackage","JSON","parse","expoVersion","version","writeFileSync","stringify","error","exports"],"sources":["postInstallHelper.js"],"sourcesContent":["const fs = require('fs');\n\nfunction runPostInstall() {\n // react native SDK package.json path\n const rnPjsonFile = `${__dirname}/../../customerio-reactnative/package.json`;\n const expoPjsonFile = `${__dirname}/../package.json`;\n try {\n // if react native SDK is installed\n if (fs.existsSync(rnPjsonFile)) {\n const rnPJson = fs.readFileSync(rnPjsonFile, 'utf8');\n expoPjson = require(expoPjsonFile);\n\n const rnPackage = JSON.parse(rnPJson);\n rnPackage.expoVersion = expoPjson.version;\n\n\n fs.writeFileSync(rnPjsonFile, JSON.stringify(rnPackage, null, 2));\n }\n } catch (error) {}\n}\n\nexports.runPostInstall = runPostInstall;"],"mappings":"AAAA,MAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AAExB,SAASC,cAAcA,CAAA,EAAG;EACxB;EACA,MAAMC,WAAW,GAAI,GAAEC,SAAU,4CAA2C;EAC5E,MAAMC,aAAa,GAAI,GAAED,SAAU,kBAAiB;EACpD,IAAI;IACF;IACA,IAAIJ,EAAE,CAACM,UAAU,CAACH,WAAW,CAAC,EAAE;MAC9B,MAAMI,OAAO,GAAGP,EAAE,CAACQ,YAAY,CAACL,WAAW,EAAE,MAAM,CAAC;MACpDM,SAAS,GAAGR,OAAO,CAACI,aAAa,CAAC;MAElC,MAAMK,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACL,OAAO,CAAC;MACrCG,SAAS,CAACG,WAAW,GAAGJ,SAAS,CAACK,OAAO;MAGzCd,EAAE,CAACe,aAAa,CAACZ,WAAW,EAAEQ,IAAI,CAACK,SAAS,CAACN,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACnE;EACF,CAAC,CAAC,OAAOO,KAAK,EAAE,CAAC;AACnB;AAEAC,OAAO,CAAChB,cAAc,GAAGA,cAAc"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["cio-types.ts"],"sourcesContent":["// properties set by the user in their app config file (e.g: app.json or app.plugin.js)\nexport type CustomerIOPluginProperties = {\n // (iOS only) Environment name and bundle identifier\n devTeam: string;\n iosDeploymentTarget: string;\n};\n\n// Plugin options for pre-build\nexport type CustomerIOPluginOptionsIOS = {\n iosPath: string;\n devTeam?: string;\n bundleVersion?: string;\n bundleShortVersion?: string;\n bundleIdentifier?: string;\n iosDeploymentTarget?: string;\n appleTeamId?: string;\n appName?: string;\n disableNotificationRegistration?: boolean;\n useFrameworks?: 'static' | 'dynamic';\n pushNotification?: {\n useRichPush: boolean;\n env: {\n siteId: string;\n apiKey: string;\n region: string;\n };\n };\n};\n\nexport type CustomerIOPluginOptionsAndroid = {\n androidPath: string;\n googleServicesFile?: string;\n setHighPriorityPushHandler?: boolean;\n};\n\nexport type CustomerIOPluginOptions = {\n android: CustomerIOPluginOptionsAndroid;\n ios: CustomerIOPluginOptionsIOS;\n};\n"],"mappings":""}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export declare const LOCAL_PATH_TO_CIO_NSE_FILES: any;
|
|
2
|
-
export declare const IOS_DEPLOYMENT_TARGET = "13.0";
|
|
3
|
-
export declare const CIO_SDK_VERSION = "'~> 2.0'";
|
|
4
|
-
export declare const CIO_PODFILE_REGEX: RegExp;
|
|
5
|
-
export declare const CIO_CIO_TARGET_REGEX: RegExp;
|
|
6
|
-
export declare const CIO_PODFILE_NOTIFICATION_REGEX: RegExp;
|
|
7
|
-
export declare const CIO_PODFILE_POST_INSTALL_REGEX: RegExp;
|
|
8
|
-
export declare const GROUP_IDENTIFIER_TEMPLATE_REGEX: RegExp;
|
|
9
|
-
export declare const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX: RegExp;
|
|
10
|
-
export declare const BUNDLE_VERSION_TEMPLATE_REGEX: RegExp;
|
|
11
|
-
export declare const CIO_DIDFINISHLAUNCHINGMETHOD_REGEX: RegExp;
|
|
12
|
-
export declare const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX: RegExp;
|
|
13
|
-
export declare const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX: RegExp;
|
|
14
|
-
export declare const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX: RegExp;
|
|
15
|
-
export declare const CIO_APPDELEGATEDECLARATION_REGEX: RegExp;
|
|
16
|
-
export declare const CIO_APPDELEGATEHEADER_REGEX: RegExp;
|
|
17
|
-
export declare const DEFAULT_BUNDLE_VERSION = "1";
|
|
18
|
-
export declare const DEFAULT_BUNDLE_SHORT_VERSION = "1.0";
|
|
19
|
-
export declare const CIO_TARGET_NAME = "CustomerIOSDK";
|
|
20
|
-
export declare const CIO_NOTIFICATION_TARGET_NAME = "NotificationService";
|
|
21
|
-
export declare const CIO_APPDELEGATEHEADER_SNIPPET = "\n#import <UserNotifications/UserNotifications.h>\n\n@interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate, UNUserNotificationCenterDelegate>\n";
|
|
22
|
-
export declare const CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = "\nCIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler alloc] init];\n";
|
|
23
|
-
export declare const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = "\n [super application:application didFailToRegisterForRemoteNotificationsWithError:error];\n [pnHandlerObj application:application error:error];\n";
|
|
24
|
-
export declare const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = "\n [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];\n return [pnHandlerObj application:application deviceToken:deviceToken];\n";
|
|
25
|
-
export declare const CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = "\n // Register for push notifications\n [pnHandlerObj registerPushNotification:self];\n";
|
|
26
|
-
export declare const CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET = "\n- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {\n [pnHandlerObj userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];\n}";
|
|
27
|
-
export declare const CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET = "\n// show push when the app is in foreground\n- (void)userNotificationCenter:(UNUserNotificationCenter* )center willPresentNotification:(UNNotification* )notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {\n completionHandler( UNNotificationPresentationOptionAlert + UNNotificationPresentationOptionSound);\n}";
|
|
28
|
-
export declare const CIO_PODFILE_SNIPPET: string;
|
|
29
|
-
export declare const CIO_PODFILE_NOTIFICATION_SNIPPET: string;
|
|
30
|
-
export declare const CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET: string;
|
|
31
|
-
export declare const CIO_REGISTER_PUSHNOTIFICATION_SNIPPET = "\n@objc(registerPushNotification:)\n public func registerPushNotification(withNotificationDelegate notificationDelegate: UNUserNotificationCenterDelegate) {\n\n let center = UNUserNotificationCenter.current()\n center.delegate = notificationDelegate\n center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in\n if error == nil{\n DispatchQueue.main.async {\n UIApplication.shared.registerForRemoteNotifications()\n }\n }\n }\n }";
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
const finder = require('find-package-json');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const f = finder(__dirname);
|
|
5
|
-
let pluginPackageRoot = f.next().filename;
|
|
6
|
-
// This is the path to the root of the customerio-expo-plugin package
|
|
7
|
-
pluginPackageRoot = path.dirname(pluginPackageRoot);
|
|
8
|
-
|
|
9
|
-
export const LOCAL_PATH_TO_CIO_NSE_FILES = path.join(
|
|
10
|
-
pluginPackageRoot,
|
|
11
|
-
'src/helpers/native-files/ios'
|
|
12
|
-
);
|
|
13
|
-
export const IOS_DEPLOYMENT_TARGET = '13.0';
|
|
14
|
-
export const CIO_SDK_VERSION = "'~> 2.0'";
|
|
15
|
-
export const CIO_PODFILE_REGEX = /pod 'CustomerIO\/MessagingPushAPN'/;
|
|
16
|
-
export const CIO_CIO_TARGET_REGEX = /cio_target_names/;
|
|
17
|
-
export const CIO_PODFILE_NOTIFICATION_REGEX = /target 'NotificationService' do/;
|
|
18
|
-
export const CIO_PODFILE_POST_INSTALL_REGEX = /post_install do \|installer\|/;
|
|
19
|
-
export const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;
|
|
20
|
-
export const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;
|
|
21
|
-
export const BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;
|
|
22
|
-
export const CIO_DIDFINISHLAUNCHINGMETHOD_REGEX =
|
|
23
|
-
/(- \(BOOL\)application:\(UIApplication \*\)application didFinishLaunchingWithOptions:\(NSDictionary \*\)launchOptions(\s|\n)*?\{)((.|\n)*)\[super(\s)application:application(\s)didFinishLaunchingWithOptions:launchOptions\];/;
|
|
24
|
-
|
|
25
|
-
export const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX =
|
|
26
|
-
/return \[super application:application didFailToRegisterForRemoteNotificationsWithError:error\];/;
|
|
27
|
-
|
|
28
|
-
export const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX =
|
|
29
|
-
/(- \(void\)application:\(UIApplication \*\)application didFailToRegisterForRemoteNotificationsWithError:\(NSError \*\)error(\s|\n)*?\{)(.|\n){2}.*\n\}/;
|
|
30
|
-
|
|
31
|
-
export const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX =
|
|
32
|
-
/return \[super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken\];/;
|
|
33
|
-
|
|
34
|
-
export const CIO_APPDELEGATEDECLARATION_REGEX =
|
|
35
|
-
/@implementation AppDelegate(.|\n)/;
|
|
36
|
-
|
|
37
|
-
export const CIO_APPDELEGATEHEADER_REGEX =
|
|
38
|
-
/@interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate>/;
|
|
39
|
-
export const DEFAULT_BUNDLE_VERSION = '1';
|
|
40
|
-
export const DEFAULT_BUNDLE_SHORT_VERSION = '1.0';
|
|
41
|
-
export const CIO_TARGET_NAME = 'CustomerIOSDK';
|
|
42
|
-
export const CIO_NOTIFICATION_TARGET_NAME = 'NotificationService';
|
|
43
|
-
export const CIO_APPDELEGATEHEADER_SNIPPET = `
|
|
44
|
-
#import <UserNotifications/UserNotifications.h>
|
|
45
|
-
|
|
46
|
-
@interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate, UNUserNotificationCenterDelegate>
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
|
-
export const CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = `
|
|
50
|
-
CIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler alloc] init];
|
|
51
|
-
`;
|
|
52
|
-
|
|
53
|
-
export const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = `
|
|
54
|
-
[super application:application didFailToRegisterForRemoteNotificationsWithError:error];
|
|
55
|
-
[pnHandlerObj application:application error:error];
|
|
56
|
-
`;
|
|
57
|
-
|
|
58
|
-
export const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = `
|
|
59
|
-
[super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
|
|
60
|
-
return [pnHandlerObj application:application deviceToken:deviceToken];
|
|
61
|
-
`;
|
|
62
|
-
|
|
63
|
-
export const CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = `
|
|
64
|
-
// Register for push notifications
|
|
65
|
-
[pnHandlerObj registerPushNotification:self];
|
|
66
|
-
`;
|
|
67
|
-
|
|
68
|
-
// Enable push handling - notification response
|
|
69
|
-
export const CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET = `
|
|
70
|
-
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {
|
|
71
|
-
[pnHandlerObj userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
|
|
72
|
-
}`;
|
|
73
|
-
|
|
74
|
-
// Foreground push handling
|
|
75
|
-
export const CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET = `
|
|
76
|
-
// show push when the app is in foreground
|
|
77
|
-
- (void)userNotificationCenter:(UNUserNotificationCenter* )center willPresentNotification:(UNNotification* )notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
|
|
78
|
-
completionHandler( UNNotificationPresentationOptionAlert + UNNotificationPresentationOptionSound);
|
|
79
|
-
}`;
|
|
80
|
-
export const CIO_PODFILE_SNIPPET = ` pod 'CustomerIO/MessagingPushAPN', ${CIO_SDK_VERSION}`;
|
|
81
|
-
export const CIO_PODFILE_NOTIFICATION_SNIPPET = `
|
|
82
|
-
target '${CIO_NOTIFICATION_TARGET_NAME}' do
|
|
83
|
-
${CIO_PODFILE_SNIPPET}
|
|
84
|
-
end`;
|
|
85
|
-
export const CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET = `
|
|
86
|
-
target '${CIO_NOTIFICATION_TARGET_NAME}' do
|
|
87
|
-
use_frameworks! :linkage => :static
|
|
88
|
-
${CIO_PODFILE_SNIPPET}
|
|
89
|
-
end`;
|
|
90
|
-
|
|
91
|
-
export const CIO_REGISTER_PUSHNOTIFICATION_SNIPPET = `
|
|
92
|
-
@objc(registerPushNotification:)
|
|
93
|
-
public func registerPushNotification(withNotificationDelegate notificationDelegate: UNUserNotificationCenterDelegate) {
|
|
94
|
-
|
|
95
|
-
let center = UNUserNotificationCenter.current()
|
|
96
|
-
center.delegate = notificationDelegate
|
|
97
|
-
center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
|
|
98
|
-
if error == nil{
|
|
99
|
-
DispatchQueue.main.async {
|
|
100
|
-
UIApplication.shared.registerForRemoteNotifications()
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}`;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import UserNotifications
|
|
3
|
-
import CioTracking
|
|
4
|
-
import CioMessagingPushAPN
|
|
5
|
-
|
|
6
|
-
@objc
|
|
7
|
-
public class NotificationServiceCioManager : NSObject {
|
|
8
|
-
|
|
9
|
-
public override init() {}
|
|
10
|
-
|
|
11
|
-
@objc(didReceive:withContentHandler:)
|
|
12
|
-
public func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
|
13
|
-
CustomerIO
|
|
14
|
-
.initialize(siteId: Env.customerIOSiteId, apiKey: Env.customerIOApiKey, region: Env.customerIORegion) { config in }
|
|
15
|
-
MessagingPush.shared.didReceive(request, withContentHandler: contentHandler)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@objc(serviceExtensionTimeWillExpire)
|
|
19
|
-
public func serviceExtensionTimeWillExpire() {
|
|
20
|
-
MessagingPush.shared.serviceExtensionTimeWillExpire()
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { CustomerIOPluginOptionsIOS } from '../../types/cio-types';
|
|
2
|
-
import {
|
|
3
|
-
CIO_PODFILE_REGEX,
|
|
4
|
-
CIO_PODFILE_SNIPPET,
|
|
5
|
-
CIO_PODFILE_NOTIFICATION_SNIPPET,
|
|
6
|
-
CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET,
|
|
7
|
-
CIO_PODFILE_NOTIFICATION_REGEX,
|
|
8
|
-
CIO_CIO_TARGET_REGEX,
|
|
9
|
-
CIO_PODFILE_POST_INSTALL_REGEX,
|
|
10
|
-
} from '../constants/ios';
|
|
11
|
-
import { FileManagement } from './fileManagement';
|
|
12
|
-
|
|
13
|
-
export async function injectCIOPodfileCode(iosPath: string) {
|
|
14
|
-
const filename = `${iosPath}/Podfile`;
|
|
15
|
-
const podfile = await FileManagement.read(filename);
|
|
16
|
-
const matches = podfile.match(CIO_PODFILE_REGEX);
|
|
17
|
-
const targetMatch = podfile.match(CIO_CIO_TARGET_REGEX);
|
|
18
|
-
|
|
19
|
-
if (!targetMatch) {
|
|
20
|
-
const lines = podfile.split('\n');
|
|
21
|
-
const index = lines.findIndex((line) =>
|
|
22
|
-
CIO_PODFILE_POST_INSTALL_REGEX.test(line)
|
|
23
|
-
);
|
|
24
|
-
let content: string[] = lines;
|
|
25
|
-
if (index > -1) {
|
|
26
|
-
content = [
|
|
27
|
-
...lines.slice(0, index - 1),
|
|
28
|
-
!matches ? CIO_PODFILE_SNIPPET : '',
|
|
29
|
-
...lines.slice(index - 1),
|
|
30
|
-
];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
FileManagement.write(filename, content.join('\n'));
|
|
34
|
-
} else {
|
|
35
|
-
console.log('Customerio Podfile snippets already exists. Skipping...');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export async function injectCIONotificationPodfileCode(
|
|
40
|
-
iosPath: string,
|
|
41
|
-
useFrameworks: CustomerIOPluginOptionsIOS['useFrameworks']
|
|
42
|
-
) {
|
|
43
|
-
const filename = `${iosPath}/Podfile`;
|
|
44
|
-
const podfile = await FileManagement.read(filename);
|
|
45
|
-
const matches = podfile.match(CIO_PODFILE_NOTIFICATION_REGEX);
|
|
46
|
-
|
|
47
|
-
if (!matches) {
|
|
48
|
-
const snippet =
|
|
49
|
-
useFrameworks === 'static'
|
|
50
|
-
? CIO_PODFILE_NOTIFICATION_STATIC_FRAMEWORK_SNIPPET
|
|
51
|
-
: CIO_PODFILE_NOTIFICATION_SNIPPET;
|
|
52
|
-
FileManagement.append(filename, snippet);
|
|
53
|
-
}
|
|
54
|
-
}
|
package/src/postInstallHelper.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
|
|
3
|
-
function runPostInstall() {
|
|
4
|
-
// react native SDK package.json path
|
|
5
|
-
const rnPjsonFile = `${__dirname}/../../customerio-reactnative/package.json`;
|
|
6
|
-
const expoPjsonFile = `${__dirname}/../package.json`;
|
|
7
|
-
try {
|
|
8
|
-
// if react native SDK is installed
|
|
9
|
-
if (fs.existsSync(rnPjsonFile)) {
|
|
10
|
-
const rnPJson = fs.readFileSync(rnPjsonFile, 'utf8');
|
|
11
|
-
expoPjson = require(expoPjsonFile);
|
|
12
|
-
|
|
13
|
-
const rnPackage = JSON.parse(rnPJson);
|
|
14
|
-
rnPackage.expoVersion = expoPjson.version;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
fs.writeFileSync(rnPjsonFile, JSON.stringify(rnPackage, null, 2));
|
|
18
|
-
}
|
|
19
|
-
} catch (error) {}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
exports.runPostInstall = runPostInstall;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|