customerio-expo-plugin 0.0.5 → 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/analytics/injectAnalytics.js +31 -0
- package/lib/commonjs/analytics/injectAnalytics.js.map +1 -0
- package/lib/commonjs/android/withAppGoogleServices.js +22 -0
- package/lib/commonjs/android/withAppGoogleServices.js.map +1 -0
- package/lib/commonjs/android/withCIOAndroid.js +18 -0
- package/lib/commonjs/android/withCIOAndroid.js.map +1 -0
- package/lib/commonjs/android/withGistMavenRepository.js +21 -0
- package/lib/commonjs/android/withGistMavenRepository.js.map +1 -0
- package/lib/commonjs/android/withGoogleServicesJSON.js +34 -0
- package/lib/commonjs/android/withGoogleServicesJSON.js.map +1 -0
- package/lib/commonjs/android/withProjectGoogleServices.js +20 -0
- package/lib/commonjs/android/withProjectGoogleServices.js.map +1 -0
- package/lib/commonjs/helpers/constants/android.js +21 -0
- package/lib/commonjs/helpers/constants/android.js.map +1 -0
- package/lib/commonjs/helpers/constants/globals.d.js +2 -0
- package/lib/commonjs/helpers/constants/globals.d.js.map +1 -0
- package/lib/commonjs/helpers/constants/ios.js +140 -0
- package/lib/commonjs/helpers/constants/ios.js.map +1 -0
- package/{build/helpers/ios/CIONotificationService-Info.plist → lib/commonjs/helpers/native-files/ios/NotificationService-Info.plist} +2 -2
- package/{build/helpers/ios/CIONotificationService.h → lib/commonjs/helpers/native-files/ios/NotificationService.h} +0 -0
- package/{build/helpers/ios/CIONotificationService.m → lib/commonjs/helpers/native-files/ios/NotificationService.m} +2 -6
- package/{build/helpers/ios/CIONotificationService.swift → lib/commonjs/helpers/native-files/ios/NotificationService.swift} +0 -2
- package/{build/helpers → lib/commonjs/helpers/native-files}/ios/PushNotification.swift +1 -10
- package/lib/commonjs/helpers/utils/codeInjection.js +33 -0
- package/lib/commonjs/helpers/utils/codeInjection.js.map +1 -0
- package/lib/commonjs/helpers/utils/fileManagement.js +76 -0
- package/lib/commonjs/helpers/utils/fileManagement.js.map +1 -0
- package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +37 -0
- package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -0
- package/lib/commonjs/index.js +23 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/ios/withAppDelegateModifications.js +85 -0
- package/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -0
- package/lib/commonjs/ios/withAppDelegateXcodeProject.js +79 -0
- package/lib/commonjs/ios/withAppDelegateXcodeProject.js.map +1 -0
- package/lib/commonjs/ios/withCIOIos.js +23 -0
- package/lib/commonjs/ios/withCIOIos.js.map +1 -0
- package/lib/commonjs/ios/withNotificationsXcodeProject.js +158 -0
- package/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -0
- package/lib/commonjs/ios/withXcodeProject.js +28 -0
- package/lib/commonjs/ios/withXcodeProject.js.map +1 -0
- package/lib/commonjs/types/cio-types.js +2 -0
- package/lib/commonjs/types/cio-types.js.map +1 -0
- package/lib/commonjs/version.js +9 -0
- package/lib/commonjs/version.js.map +1 -0
- package/lib/module/analytics/injectAnalytics.js +24 -0
- package/lib/module/analytics/injectAnalytics.js.map +1 -0
- package/lib/module/android/withAppGoogleServices.js +15 -0
- package/lib/module/android/withAppGoogleServices.js.map +1 -0
- package/lib/module/android/withCIOAndroid.js +12 -0
- package/lib/module/android/withCIOAndroid.js.map +1 -0
- package/lib/module/android/withGistMavenRepository.js +14 -0
- package/lib/module/android/withGistMavenRepository.js.map +1 -0
- package/lib/module/android/withGoogleServicesJSON.js +27 -0
- package/lib/module/android/withGoogleServicesJSON.js.map +1 -0
- package/lib/module/android/withProjectGoogleServices.js +13 -0
- package/lib/module/android/withProjectGoogleServices.js.map +1 -0
- package/lib/module/helpers/constants/android.js +8 -0
- package/lib/module/helpers/constants/android.js.map +1 -0
- package/lib/module/helpers/constants/globals.d.js +2 -0
- package/lib/module/helpers/constants/globals.d.js.map +1 -0
- package/lib/module/helpers/constants/ios.js +103 -0
- package/lib/module/helpers/constants/ios.js.map +1 -0
- package/lib/module/helpers/native-files/ios/NotificationService-Info.plist +31 -0
- package/lib/module/helpers/native-files/ios/NotificationService.h +5 -0
- package/lib/module/helpers/native-files/ios/NotificationService.m +26 -0
- package/lib/module/helpers/native-files/ios/NotificationService.swift +19 -0
- package/lib/module/helpers/native-files/ios/PushNotification.swift +47 -0
- package/lib/module/helpers/utils/codeInjection.js +24 -0
- package/lib/module/helpers/utils/codeInjection.js.map +1 -0
- package/lib/module/helpers/utils/fileManagement.js +69 -0
- package/lib/module/helpers/utils/fileManagement.js.map +1 -0
- package/lib/module/helpers/utils/injectCIOPodfileCode.js +30 -0
- package/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -0
- package/lib/module/index.js +16 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/ios/withAppDelegateModifications.js +78 -0
- package/lib/module/ios/withAppDelegateModifications.js.map +1 -0
- package/lib/module/ios/withAppDelegateXcodeProject.js +71 -0
- package/lib/module/ios/withAppDelegateXcodeProject.js.map +1 -0
- package/lib/module/ios/withCIOIos.js +17 -0
- package/lib/module/ios/withCIOIos.js.map +1 -0
- package/lib/module/ios/withNotificationsXcodeProject.js +150 -0
- package/lib/module/ios/withNotificationsXcodeProject.js.map +1 -0
- package/lib/module/ios/withXcodeProject.js +21 -0
- package/lib/module/ios/withXcodeProject.js.map +1 -0
- package/lib/module/types/cio-types.js +2 -0
- package/lib/module/types/cio-types.js.map +1 -0
- package/lib/module/version.js +2 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/analytics/injectAnalytics.d.ts +3 -0
- package/lib/typescript/android/withAppGoogleServices.d.ts +3 -0
- package/lib/typescript/android/withCIOAndroid.d.ts +3 -0
- package/lib/typescript/android/withGistMavenRepository.d.ts +3 -0
- package/lib/typescript/android/withGoogleServicesJSON.d.ts +3 -0
- package/lib/typescript/android/withProjectGoogleServices.d.ts +3 -0
- package/lib/typescript/helpers/constants/android.d.ts +7 -0
- package/lib/typescript/helpers/constants/ios.d.ts +31 -0
- package/lib/typescript/helpers/utils/codeInjection.d.ts +4 -0
- package/lib/typescript/helpers/utils/fileManagement.d.ts +12 -0
- package/lib/typescript/helpers/utils/injectCIOPodfileCode.d.ts +2 -0
- package/lib/typescript/index.d.ts +4 -0
- package/lib/typescript/ios/withAppDelegateModifications.d.ts +2 -0
- package/lib/typescript/ios/withAppDelegateXcodeProject.d.ts +3 -0
- package/lib/typescript/ios/withCIOIos.d.ts +3 -0
- package/lib/typescript/ios/withNotificationsXcodeProject.d.ts +3 -0
- package/lib/typescript/ios/withXcodeProject.d.ts +3 -0
- package/lib/typescript/types/cio-types.d.ts +25 -0
- package/lib/typescript/version.d.ts +1 -0
- package/package.json +88 -13
- package/src/analytics/injectAnalytics.ts +36 -0
- package/src/android/withAppGoogleServices.ts +26 -0
- package/src/android/withCIOAndroid.ts +19 -0
- package/src/android/withGistMavenRepository.ts +26 -0
- package/src/android/withGoogleServicesJSON.ts +36 -0
- package/src/android/withProjectGoogleServices.ts +24 -0
- package/src/helpers/constants/android.ts +14 -0
- package/src/helpers/constants/globals.d.ts +8 -0
- package/src/helpers/constants/ios.ts +116 -0
- package/src/helpers/native-files/ios/NotificationService-Info.plist +31 -0
- package/src/helpers/native-files/ios/NotificationService.h +5 -0
- package/src/helpers/native-files/ios/NotificationService.m +26 -0
- package/src/helpers/native-files/ios/NotificationService.swift +19 -0
- package/src/helpers/native-files/ios/PushNotification.swift +47 -0
- package/src/helpers/utils/codeInjection.ts +46 -0
- package/src/helpers/utils/fileManagement.ts +87 -0
- package/src/helpers/utils/injectCIOPodfileCode.ts +53 -0
- package/src/index.ts +26 -0
- package/src/ios/withAppDelegateModifications.ts +166 -0
- package/src/ios/withAppDelegateXcodeProject.ts +89 -0
- package/src/ios/withCIOIos.ts +25 -0
- package/src/ios/withNotificationsXcodeProject.ts +237 -0
- package/src/ios/withXcodeProject.ts +25 -0
- package/src/types/cio-types.ts +31 -0
- package/src/version.ts +1 -0
- package/build/helpers/.DS_Store +0 -0
- package/build/helpers/ios/.DS_Store +0 -0
- package/build/package.json +0 -36
- package/build/src/android/withAppGoogleServices.js +0 -12
- package/build/src/android/withCIOAndroid.js +0 -15
- package/build/src/android/withGistMavenRepository.js +0 -12
- package/build/src/android/withGoogleServicesJSON.js +0 -24
- package/build/src/android/withProjectGoogleServices.js +0 -12
- package/build/src/helpers/constants/android.js +0 -9
- package/build/src/helpers/constants/ios.js +0 -102
- package/build/src/helpers/utils/codeInjection.js +0 -30
- package/build/src/helpers/utils/fileManagement.js +0 -40
- package/build/src/helpers/utils/injectCIOPodfileCode.js +0 -37
- package/build/src/index.js +0 -11
- package/build/src/ios/withAppDelegateModifications.js +0 -77
- package/build/src/ios/withAppDelegateXcodeProject.js +0 -78
- package/build/src/ios/withCIOIos.js +0 -15
- package/build/src/ios/withNotificationsXcodeProject.js +0 -133
- package/build/src/ios/withXcodeProject.js +0 -22
- package/build/src/types/cio-types.js +0 -8
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { withAppGoogleServices } from './withAppGoogleServices';
|
|
2
|
+
import { withGistMavenRepository } from './withGistMavenRepository';
|
|
3
|
+
import { withGoogleServicesJSON } from './withGoogleServicesJSON';
|
|
4
|
+
import { withProjectGoogleServices } from './withProjectGoogleServices';
|
|
5
|
+
export function withCIOAndroid(config, props) {
|
|
6
|
+
config = withGistMavenRepository(config, props);
|
|
7
|
+
config = withProjectGoogleServices(config, props);
|
|
8
|
+
config = withAppGoogleServices(config, props);
|
|
9
|
+
config = withGoogleServicesJSON(config, props);
|
|
10
|
+
return config;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=withCIOAndroid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withAppGoogleServices","withGistMavenRepository","withGoogleServicesJSON","withProjectGoogleServices","withCIOAndroid","config","props"],"sources":["withCIOAndroid.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';\nimport { withAppGoogleServices } from './withAppGoogleServices';\nimport { withGistMavenRepository } from './withGistMavenRepository';\nimport { withGoogleServicesJSON } from './withGoogleServicesJSON';\nimport { withProjectGoogleServices } from './withProjectGoogleServices';\n\nexport function withCIOAndroid(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsAndroid\n): ExpoConfig {\n config = withGistMavenRepository(config, props);\n config = withProjectGoogleServices(config, props);\n config = withAppGoogleServices(config, props);\n config = withGoogleServicesJSON(config, props);\n\n return config;\n}\n"],"mappings":"AAGA,SAASA,qBAAqB,QAAQ,yBAAyB;AAC/D,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,yBAAyB,QAAQ,6BAA6B;AAEvE,OAAO,SAASC,cAAc,CAC5BC,MAAkB,EAClBC,KAAqC,EACzB;EACZD,MAAM,GAAGJ,uBAAuB,CAACI,MAAM,EAAEC,KAAK,CAAC;EAC/CD,MAAM,GAAGF,yBAAyB,CAACE,MAAM,EAAEC,KAAK,CAAC;EACjDD,MAAM,GAAGL,qBAAqB,CAACK,MAAM,EAAEC,KAAK,CAAC;EAC7CD,MAAM,GAAGH,sBAAsB,CAACG,MAAM,EAAEC,KAAK,CAAC;EAE9C,OAAOD,MAAM;AACf"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { withProjectBuildGradle } from '@expo/config-plugins';
|
|
2
|
+
import { CIO_GIST_MAVEN_REGEX, CIO_PROJECT_ALLPROJECTS_REGEX, CIO_PROJECT_GIST_MAVEN_SNIPPET } from '../helpers/constants/android';
|
|
3
|
+
export const withGistMavenRepository = configOuter => {
|
|
4
|
+
return withProjectBuildGradle(configOuter, props => {
|
|
5
|
+
const targetMatch = props.modResults.contents.match(CIO_GIST_MAVEN_REGEX);
|
|
6
|
+
if (!targetMatch) {
|
|
7
|
+
props.modResults.contents = props.modResults.contents.replace(CIO_PROJECT_ALLPROJECTS_REGEX, `$1\n${CIO_PROJECT_GIST_MAVEN_SNIPPET}`);
|
|
8
|
+
} else {
|
|
9
|
+
console.log('build.gradle snippet alreade exists. Skipping...');
|
|
10
|
+
}
|
|
11
|
+
return props;
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=withGistMavenRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withProjectBuildGradle","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","withGistMavenRepository","configOuter","props","targetMatch","modResults","contents","match","replace","console","log"],"sources":["withGistMavenRepository.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport {\n CIO_GIST_MAVEN_REGEX,\n CIO_PROJECT_ALLPROJECTS_REGEX,\n CIO_PROJECT_GIST_MAVEN_SNIPPET,\n} from '../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGistMavenRepository: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const targetMatch = props.modResults.contents.match(CIO_GIST_MAVEN_REGEX);\n if (!targetMatch) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_ALLPROJECTS_REGEX,\n `$1\\n${CIO_PROJECT_GIST_MAVEN_SNIPPET}`\n );\n } else {\n console.log('build.gradle snippet alreade exists. Skipping...');\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAsB,sBAAsB;AAE3E,SACEC,oBAAoB,EACpBC,6BAA6B,EAC7BC,8BAA8B,QACzB,8BAA8B;AAGrC,OAAO,MAAMC,uBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOL,sBAAsB,CAACK,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACC,KAAK,CAACT,oBAAoB,CAAC;IACzE,IAAI,CAACM,WAAW,EAAE;MAChBD,KAAK,CAACE,UAAU,CAACC,QAAQ,GAAGH,KAAK,CAACE,UAAU,CAACC,QAAQ,CAACE,OAAO,CAC3DT,6BAA6B,EAC5B,OAAMC,8BAA+B,EAAC,CACxC;IACH,CAAC,MAAM;MACLS,OAAO,CAACC,GAAG,CAAC,kDAAkD,CAAC;IACjE;IAEA,OAAOP,KAAK;EACd,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { withProjectBuildGradle } from '@expo/config-plugins';
|
|
2
|
+
import { FileManagement } from './../helpers/utils/fileManagement';
|
|
3
|
+
export const withGoogleServicesJSON = (configOuter, cioProps) => {
|
|
4
|
+
return withProjectBuildGradle(configOuter, props => {
|
|
5
|
+
const options = {
|
|
6
|
+
androidPath: props.modRequest.platformProjectRoot,
|
|
7
|
+
googleServicesFilePath: cioProps === null || cioProps === void 0 ? void 0 : cioProps.googleServicesFilePath
|
|
8
|
+
};
|
|
9
|
+
const {
|
|
10
|
+
androidPath,
|
|
11
|
+
googleServicesFilePath
|
|
12
|
+
} = options;
|
|
13
|
+
if (!FileManagement.exists(`${androidPath}/app/google-services.json`)) {
|
|
14
|
+
if (googleServicesFilePath) {
|
|
15
|
+
try {
|
|
16
|
+
FileManagement.copyFile(`${googleServicesFilePath}google-services.json`, `${androidPath}/app/google-services.json`);
|
|
17
|
+
} catch (e) {
|
|
18
|
+
console.log(`There was an error copying your google-services.json file. You can copy it manually into ${androidPath}/app/`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
console.log(`File already exists: ${androidPath}/app/google-services.json. Skipping...`);
|
|
23
|
+
}
|
|
24
|
+
return props;
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=withGoogleServicesJSON.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withProjectBuildGradle","FileManagement","withGoogleServicesJSON","configOuter","cioProps","props","options","androidPath","modRequest","platformProjectRoot","googleServicesFilePath","exists","copyFile","e","console","log"],"sources":["withGoogleServicesJSON.ts"],"sourcesContent":["import { withProjectBuildGradle, ConfigPlugin } from '@expo/config-plugins';\n\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withGoogleServicesJSON: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter, cioProps) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const options: CustomerIOPluginOptionsAndroid = {\n androidPath: props.modRequest.platformProjectRoot,\n googleServicesFilePath: cioProps?.googleServicesFilePath,\n };\n const { androidPath, googleServicesFilePath } = options;\n if (!FileManagement.exists(`${androidPath}/app/google-services.json`)) {\n if (googleServicesFilePath) {\n try {\n FileManagement.copyFile(\n `${googleServicesFilePath}google-services.json`,\n `${androidPath}/app/google-services.json`\n );\n } catch (e) {\n console.log(\n `There was an error copying your google-services.json file. You can copy it manually into ${androidPath}/app/`\n );\n }\n }\n } else {\n console.log(\n `File already exists: ${androidPath}/app/google-services.json. Skipping...`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAsB,sBAAsB;AAE3E,SAASC,cAAc,QAAQ,mCAAmC;AAGlE,OAAO,MAAMC,sBAEZ,GAAG,CAACC,WAAW,EAAEC,QAAQ,KAAK;EAC7B,OAAOJ,sBAAsB,CAACG,WAAW,EAAGE,KAAK,IAAK;IACpD,MAAMC,OAAuC,GAAG;MAC9CC,WAAW,EAAEF,KAAK,CAACG,UAAU,CAACC,mBAAmB;MACjDC,sBAAsB,EAAEN,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEM;IACpC,CAAC;IACD,MAAM;MAAEH,WAAW;MAAEG;IAAuB,CAAC,GAAGJ,OAAO;IACvD,IAAI,CAACL,cAAc,CAACU,MAAM,CAAE,GAAEJ,WAAY,2BAA0B,CAAC,EAAE;MACrE,IAAIG,sBAAsB,EAAE;QAC1B,IAAI;UACFT,cAAc,CAACW,QAAQ,CACpB,GAAEF,sBAAuB,sBAAqB,EAC9C,GAAEH,WAAY,2BAA0B,CAC1C;QACH,CAAC,CAAC,OAAOM,CAAC,EAAE;UACVC,OAAO,CAACC,GAAG,CACR,4FAA2FR,WAAY,OAAM,CAC/G;QACH;MACF;IACF,CAAC,MAAM;MACLO,OAAO,CAACC,GAAG,CACR,wBAAuBR,WAAY,wCAAuC,CAC5E;IACH;IAEA,OAAOF,KAAK;EACd,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { withProjectBuildGradle } from '@expo/config-plugins';
|
|
2
|
+
import { CIO_PROJECT_BUILDSCRIPTS_REGEX, CIO_PROJECT_GOOGLE_SNIPPET } from './../helpers/constants/android';
|
|
3
|
+
export const withProjectGoogleServices = configOuter => {
|
|
4
|
+
return withProjectBuildGradle(configOuter, props => {
|
|
5
|
+
const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);
|
|
6
|
+
const match = props.modResults.contents.match(regex);
|
|
7
|
+
if (!match) {
|
|
8
|
+
props.modResults.contents = props.modResults.contents.replace(CIO_PROJECT_BUILDSCRIPTS_REGEX, `$1\n${CIO_PROJECT_GOOGLE_SNIPPET}`);
|
|
9
|
+
}
|
|
10
|
+
return props;
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=withProjectGoogleServices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withProjectBuildGradle","CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_PROJECT_GOOGLE_SNIPPET","withProjectGoogleServices","configOuter","props","regex","RegExp","match","modResults","contents","replace"],"sources":["withProjectGoogleServices.ts"],"sourcesContent":["import { ConfigPlugin, withProjectBuildGradle } from '@expo/config-plugins';\n\nimport {\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n CIO_PROJECT_GOOGLE_SNIPPET,\n} from './../helpers/constants/android';\nimport type { CustomerIOPluginOptionsAndroid } from './../types/cio-types';\n\nexport const withProjectGoogleServices: ConfigPlugin<\n CustomerIOPluginOptionsAndroid\n> = (configOuter) => {\n return withProjectBuildGradle(configOuter, (props) => {\n const regex = new RegExp(CIO_PROJECT_GOOGLE_SNIPPET);\n const match = props.modResults.contents.match(regex);\n if (!match) {\n props.modResults.contents = props.modResults.contents.replace(\n CIO_PROJECT_BUILDSCRIPTS_REGEX,\n `$1\\n${CIO_PROJECT_GOOGLE_SNIPPET}`\n );\n }\n\n return props;\n });\n};\n"],"mappings":"AAAA,SAAuBA,sBAAsB,QAAQ,sBAAsB;AAE3E,SACEC,8BAA8B,EAC9BC,0BAA0B,QACrB,gCAAgC;AAGvC,OAAO,MAAMC,yBAEZ,GAAIC,WAAW,IAAK;EACnB,OAAOJ,sBAAsB,CAACI,WAAW,EAAGC,KAAK,IAAK;IACpD,MAAMC,KAAK,GAAG,IAAIC,MAAM,CAACL,0BAA0B,CAAC;IACpD,MAAMM,KAAK,GAAGH,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACF,KAAK,CAACF,KAAK,CAAC;IACpD,IAAI,CAACE,KAAK,EAAE;MACVH,KAAK,CAACI,UAAU,CAACC,QAAQ,GAAGL,KAAK,CAACI,UAAU,CAACC,QAAQ,CAACC,OAAO,CAC3DV,8BAA8B,EAC7B,OAAMC,0BAA2B,EAAC,CACpC;IACH;IAEA,OAAOG,KAAK;EACd,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const CIO_PROJECT_BUILDSCRIPTS_REGEX = /(buildscript\s*\{(.|\n)*dependencies\s*\{)/;
|
|
2
|
+
export const CIO_APP_APPLY_REGEX = /(apply plugin: "com.android.application")/;
|
|
3
|
+
export const CIO_GIST_MAVEN_REGEX = /maven { url "https:\/\/maven.gist.build" }/;
|
|
4
|
+
export const CIO_PROJECT_ALLPROJECTS_REGEX = /(allprojects\s*\{(.|\n)*repositories\s*\{)/;
|
|
5
|
+
export const CIO_PROJECT_GIST_MAVEN_SNIPPET = ' maven { url "https://maven.gist.build" }';
|
|
6
|
+
export const CIO_APP_GOOGLE_SNIPPET = 'apply plugin: "com.google.gms.google-services" // Google Services plugin';
|
|
7
|
+
export const CIO_PROJECT_GOOGLE_SNIPPET = ' classpath "com.google.gms:google-services:4.3.13" // Google Services plugin';
|
|
8
|
+
//# sourceMappingURL=android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CIO_PROJECT_BUILDSCRIPTS_REGEX","CIO_APP_APPLY_REGEX","CIO_GIST_MAVEN_REGEX","CIO_PROJECT_ALLPROJECTS_REGEX","CIO_PROJECT_GIST_MAVEN_SNIPPET","CIO_APP_GOOGLE_SNIPPET","CIO_PROJECT_GOOGLE_SNIPPET"],"sources":["android.ts"],"sourcesContent":["export const CIO_PROJECT_BUILDSCRIPTS_REGEX =\n /(buildscript\\s*\\{(.|\\n)*dependencies\\s*\\{)/;\nexport const CIO_APP_APPLY_REGEX = /(apply plugin: \"com.android.application\")/;\nexport const CIO_GIST_MAVEN_REGEX =\n /maven { url \"https:\\/\\/maven.gist.build\" }/;\nexport const CIO_PROJECT_ALLPROJECTS_REGEX =\n /(allprojects\\s*\\{(.|\\n)*repositories\\s*\\{)/;\n\nexport const CIO_PROJECT_GIST_MAVEN_SNIPPET =\n ' maven { url \"https://maven.gist.build\" }';\nexport const CIO_APP_GOOGLE_SNIPPET =\n 'apply plugin: \"com.google.gms.google-services\" // Google Services plugin';\nexport const CIO_PROJECT_GOOGLE_SNIPPET =\n ' classpath \"com.google.gms:google-services:4.3.13\" // Google Services plugin';\n"],"mappings":"AAAA,OAAO,MAAMA,8BAA8B,GACzC,4CAA4C;AAC9C,OAAO,MAAMC,mBAAmB,GAAG,2CAA2C;AAC9E,OAAO,MAAMC,oBAAoB,GAC/B,4CAA4C;AAC9C,OAAO,MAAMC,6BAA6B,GACxC,4CAA4C;AAE9C,OAAO,MAAMC,8BAA8B,GACzC,kDAAkD;AACpD,OAAO,MAAMC,sBAAsB,GACjC,2EAA2E;AAC7E,OAAO,MAAMC,0BAA0B,GACrC,sFAAsF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["declare module 'xcode' {\n interface xcode {\n project(projPath: string): any;\n }\n\n const xcode: xcode;\n export default xcode;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export const LOCAL_PATH_TO_CIO_NSE_FILES = `node_modules/customerio-expo-plugin/src/helpers/native-files/ios`;
|
|
2
|
+
export const IOS_DEPLOYMENT_TARGET = '13.0';
|
|
3
|
+
export const CIO_PODFILE_REGEX = /pod 'RCT-Folly'/;
|
|
4
|
+
export const CIO_CIO_TARGET_REGEX = /cio_target_names/;
|
|
5
|
+
export const CIO_PODFILE_NOTIFICATION_REGEX = /target 'NotificationService' do/;
|
|
6
|
+
export const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;
|
|
7
|
+
export const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;
|
|
8
|
+
export const BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;
|
|
9
|
+
export const CIO_PODFILE_POST_INSTALL_REGEX = /post_install do \|installer\|/;
|
|
10
|
+
export const CIO_DIDFINISHLAUNCHINGMETHOD_REGEX = /(- \(BOOL\)application:\(UIApplication \*\)application didFinishLaunchingWithOptions:\(NSDictionary \*\)launchOptions(\s|\n)*?\{)((.|\n)*)\[super(\s)application:application(\s)didFinishLaunchingWithOptions:launchOptions\];/;
|
|
11
|
+
export const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX = /return \[super application:application didFailToRegisterForRemoteNotificationsWithError:error\];/;
|
|
12
|
+
export const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX = /(- \(void\)application:\(UIApplication \*\)application didFailToRegisterForRemoteNotificationsWithError:\(NSError \*\)error(\s|\n)*?\{)(.|\n){2}.*\n\}/;
|
|
13
|
+
export const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX = /return \[super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken\];/;
|
|
14
|
+
export const CIO_APPDELEGATEDECLARATION_REGEX = /@implementation AppDelegate(.|\n)/;
|
|
15
|
+
export const CIO_APPDELEGATEHEADER_REGEX = /@interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate>/;
|
|
16
|
+
export const DEFAULT_BUNDLE_VERSION = '1';
|
|
17
|
+
export const DEFAULT_BUNDLE_SHORT_VERSION = '1.0';
|
|
18
|
+
export const CIO_TARGET_NAME = 'CustomerIOSDK';
|
|
19
|
+
export const CIO_NOTIFICATION_TARGET_NAME = 'NotificationService';
|
|
20
|
+
export const CIO_APPDELEGATEHEADER_SNIPPET = `
|
|
21
|
+
#import <UserNotifications/UserNotifications.h>
|
|
22
|
+
|
|
23
|
+
@interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate, UNUserNotificationCenterDelegate>
|
|
24
|
+
`;
|
|
25
|
+
export const CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = `
|
|
26
|
+
CIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler alloc] init];
|
|
27
|
+
`;
|
|
28
|
+
export const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = `
|
|
29
|
+
[pnHandlerObj application:application error:error];
|
|
30
|
+
`;
|
|
31
|
+
export const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = `
|
|
32
|
+
return [pnHandlerObj application:application deviceToken:deviceToken];
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
// Configure Customerio push notifications SDK by adding to application:didFinishLaunchingWithOptions: delegate method
|
|
36
|
+
// From Braze docs: https://www.customer.io/docs/sdk/react-native/push/#obj-c-push
|
|
37
|
+
export const CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = `
|
|
38
|
+
// Register for push notifications
|
|
39
|
+
[pnHandlerObj registerPushNotification:self];
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
// Enable push handling - notification response
|
|
43
|
+
export const CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET = `
|
|
44
|
+
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler {
|
|
45
|
+
[pnHandlerObj userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
|
|
46
|
+
}`;
|
|
47
|
+
|
|
48
|
+
// Foreground push handling
|
|
49
|
+
export const CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET = `
|
|
50
|
+
// show push when the app is in foreground
|
|
51
|
+
- (void)userNotificationCenter:(UNUserNotificationCenter* )center willPresentNotification:(UNNotification* )notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
|
|
52
|
+
completionHandler( UNNotificationPresentationOptionAlert + UNNotificationPresentationOptionSound);
|
|
53
|
+
}`;
|
|
54
|
+
export const CIO_PODFILE_NOTIFICATION_SNIPPET = `
|
|
55
|
+
target '${CIO_NOTIFICATION_TARGET_NAME}' do
|
|
56
|
+
pod 'CustomerIO/MessagingPushAPN', '~> 1.2.0-alpha.3'
|
|
57
|
+
end`;
|
|
58
|
+
export const CIO_PODFILE_SNIPPET = `
|
|
59
|
+
pod 'RCT-Folly', :podspec => '../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec'
|
|
60
|
+
pod 'boost', :podspec => '../node_modules/react-native/third-party-podspecs/boost.podspec'
|
|
61
|
+
pod 'CustomerIO/MessagingPushAPN', '~> 1.2.0-alpha.3'`;
|
|
62
|
+
export const CIO_PODFILE_TARGET_NAMES_SNIPPET = `
|
|
63
|
+
cio_target_names = [
|
|
64
|
+
'CustomerIOTracking',
|
|
65
|
+
'CustomerIOCommon',
|
|
66
|
+
'CustomerIOMessagingPushAPN',
|
|
67
|
+
'CustomerIOMessagingPush'
|
|
68
|
+
]`;
|
|
69
|
+
export const CIO_PODFILE_POST_INSTALL_SNIPPET = `
|
|
70
|
+
installer.pods_project.targets.each do |target|
|
|
71
|
+
if cio_target_names.include? target.name
|
|
72
|
+
puts "Modifying target #{target.name}"
|
|
73
|
+
|
|
74
|
+
target.build_configurations.each do |config|
|
|
75
|
+
puts "Setting build config settings for #{target.name}"
|
|
76
|
+
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] ||= 'NO'
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end`;
|
|
80
|
+
export const CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET = `
|
|
81
|
+
cio_target_names = [
|
|
82
|
+
'CustomerIOTracking',
|
|
83
|
+
'CustomerIOCommon',
|
|
84
|
+
'CustomerIOMessagingPushAPN',
|
|
85
|
+
'CustomerIOMessagingPush'
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
post_install do |installer|
|
|
89
|
+
|
|
90
|
+
installer.pods_project.targets.each do |target|
|
|
91
|
+
if cio_target_names.include? target.name
|
|
92
|
+
puts "Modifying target #{target.name}"
|
|
93
|
+
|
|
94
|
+
target.build_configurations.each do |config|
|
|
95
|
+
puts "Setting build config settings for #{target.name}"
|
|
96
|
+
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] ||= 'NO'
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
react_native_post_install(installer)
|
|
101
|
+
__apply_Xcode_12_5_M1_post_install_workaround(installer)
|
|
102
|
+
end`;
|
|
103
|
+
//# sourceMappingURL=ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LOCAL_PATH_TO_CIO_NSE_FILES","IOS_DEPLOYMENT_TARGET","CIO_PODFILE_REGEX","CIO_CIO_TARGET_REGEX","CIO_PODFILE_NOTIFICATION_REGEX","GROUP_IDENTIFIER_TEMPLATE_REGEX","BUNDLE_SHORT_VERSION_TEMPLATE_REGEX","BUNDLE_VERSION_TEMPLATE_REGEX","CIO_PODFILE_POST_INSTALL_REGEX","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_APPDELEGATEDECLARATION_REGEX","CIO_APPDELEGATEHEADER_REGEX","DEFAULT_BUNDLE_VERSION","DEFAULT_BUNDLE_SHORT_VERSION","CIO_TARGET_NAME","CIO_NOTIFICATION_TARGET_NAME","CIO_APPDELEGATEHEADER_SNIPPET","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET","CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET","CIO_PODFILE_NOTIFICATION_SNIPPET","CIO_PODFILE_SNIPPET","CIO_PODFILE_TARGET_NAMES_SNIPPET","CIO_PODFILE_POST_INSTALL_SNIPPET","CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET"],"sources":["ios.ts"],"sourcesContent":["export const LOCAL_PATH_TO_CIO_NSE_FILES = `node_modules/customerio-expo-plugin/src/helpers/native-files/ios`;\nexport const IOS_DEPLOYMENT_TARGET = '13.0';\nexport const CIO_PODFILE_REGEX = /pod 'RCT-Folly'/;\nexport const CIO_CIO_TARGET_REGEX = /cio_target_names/;\nexport const CIO_PODFILE_NOTIFICATION_REGEX = /target 'NotificationService' do/;\nexport const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;\nexport const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;\nexport const BUNDLE_VERSION_TEMPLATE_REGEX = /{{BUNDLE_VERSION}}/gm;\nexport const CIO_PODFILE_POST_INSTALL_REGEX = /post_install do \\|installer\\|/;\nexport const CIO_DIDFINISHLAUNCHINGMETHOD_REGEX =\n /(- \\(BOOL\\)application:\\(UIApplication \\*\\)application didFinishLaunchingWithOptions:\\(NSDictionary \\*\\)launchOptions(\\s|\\n)*?\\{)((.|\\n)*)\\[super(\\s)application:application(\\s)didFinishLaunchingWithOptions:launchOptions\\];/;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX =\n /return \\[super application:application didFailToRegisterForRemoteNotificationsWithError:error\\];/;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERRORFULL_REGEX =\n /(- \\(void\\)application:\\(UIApplication \\*\\)application didFailToRegisterForRemoteNotificationsWithError:\\(NSError \\*\\)error(\\s|\\n)*?\\{)(.|\\n){2}.*\\n\\}/;\n\nexport const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX =\n /return \\[super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken\\];/;\n\nexport const CIO_APPDELEGATEDECLARATION_REGEX =\n /@implementation AppDelegate(.|\\n)/;\n\nexport const CIO_APPDELEGATEHEADER_REGEX =\n /@interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate>/;\nexport const DEFAULT_BUNDLE_VERSION = '1';\nexport const DEFAULT_BUNDLE_SHORT_VERSION = '1.0';\nexport const CIO_TARGET_NAME = 'CustomerIOSDK';\nexport const CIO_NOTIFICATION_TARGET_NAME = 'NotificationService';\nexport const CIO_APPDELEGATEHEADER_SNIPPET = `\n#import <UserNotifications/UserNotifications.h>\n\n@interface AppDelegate : EXAppDelegateWrapper <RCTBridgeDelegate, UNUserNotificationCenterDelegate>\n`;\n\nexport const CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET = `\nCIOAppPushNotificationsHandler* pnHandlerObj = [[CIOAppPushNotificationsHandler alloc] init];\n`;\n\nexport const CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET = `\n [pnHandlerObj application:application error:error];\n`;\n\nexport const CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET = `\n return [pnHandlerObj application:application deviceToken:deviceToken];\n`;\n\n// Configure Customerio push notifications SDK by adding to application:didFinishLaunchingWithOptions: delegate method\n// From Braze docs: https://www.customer.io/docs/sdk/react-native/push/#obj-c-push\nexport const CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET = `\n // Register for push notifications\n [pnHandlerObj registerPushNotification:self];\n`;\n\n// Enable push handling - notification response\nexport 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}`;\n\n// Foreground push handling\nexport 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}`;\nexport const CIO_PODFILE_NOTIFICATION_SNIPPET = `\ntarget '${CIO_NOTIFICATION_TARGET_NAME}' do\n pod 'CustomerIO/MessagingPushAPN', '~> 1.2.0-alpha.3'\nend`;\nexport const CIO_PODFILE_SNIPPET = `\n pod 'RCT-Folly', :podspec => '../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec'\n pod 'boost', :podspec => '../node_modules/react-native/third-party-podspecs/boost.podspec'\n pod 'CustomerIO/MessagingPushAPN', '~> 1.2.0-alpha.3'`;\nexport const CIO_PODFILE_TARGET_NAMES_SNIPPET = `\n cio_target_names = [\n 'CustomerIOTracking',\n 'CustomerIOCommon',\n 'CustomerIOMessagingPushAPN',\n 'CustomerIOMessagingPush'\n ]`;\nexport const CIO_PODFILE_POST_INSTALL_SNIPPET = `\n installer.pods_project.targets.each do |target|\n if cio_target_names.include? target.name\n puts \"Modifying target #{target.name}\"\n\n target.build_configurations.each do |config|\n puts \"Setting build config settings for #{target.name}\"\n config.build_settings['APPLICATION_EXTENSION_API_ONLY'] ||= 'NO'\n end\n end\n end`;\nexport const CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET = `\ncio_target_names = [\n 'CustomerIOTracking',\n 'CustomerIOCommon',\n 'CustomerIOMessagingPushAPN',\n 'CustomerIOMessagingPush'\n]\n\npost_install do |installer|\n\n installer.pods_project.targets.each do |target|\n if cio_target_names.include? target.name\n puts \"Modifying target #{target.name}\"\n\n target.build_configurations.each do |config|\n puts \"Setting build config settings for #{target.name}\"\n config.build_settings['APPLICATION_EXTENSION_API_ONLY'] ||= 'NO'\n end\n end\n end\n react_native_post_install(installer)\n __apply_Xcode_12_5_M1_post_install_workaround(installer)\nend`;\n"],"mappings":"AAAA,OAAO,MAAMA,2BAA2B,GAAI,kEAAiE;AAC7G,OAAO,MAAMC,qBAAqB,GAAG,MAAM;AAC3C,OAAO,MAAMC,iBAAiB,GAAG,iBAAiB;AAClD,OAAO,MAAMC,oBAAoB,GAAG,kBAAkB;AACtD,OAAO,MAAMC,8BAA8B,GAAG,iCAAiC;AAC/E,OAAO,MAAMC,+BAA+B,GAAG,wBAAwB;AACvE,OAAO,MAAMC,mCAAmC,GAAG,4BAA4B;AAC/E,OAAO,MAAMC,6BAA6B,GAAG,sBAAsB;AACnE,OAAO,MAAMC,8BAA8B,GAAG,+BAA+B;AAC7E,OAAO,MAAMC,kCAAkC,GAC7C,gOAAgO;AAElO,OAAO,MAAMC,0DAA0D,GACrE,kGAAkG;AAEpG,OAAO,MAAMC,8DAA8D,GACzE,wJAAwJ;AAE1J,OAAO,MAAMC,0DAA0D,GACrE,wGAAwG;AAE1G,OAAO,MAAMC,gCAAgC,GAC3C,mCAAmC;AAErC,OAAO,MAAMC,2BAA2B,GACtC,mEAAmE;AACrE,OAAO,MAAMC,sBAAsB,GAAG,GAAG;AACzC,OAAO,MAAMC,4BAA4B,GAAG,KAAK;AACjD,OAAO,MAAMC,eAAe,GAAG,eAAe;AAC9C,OAAO,MAAMC,4BAA4B,GAAG,qBAAqB;AACjE,OAAO,MAAMC,6BAA6B,GAAI;AAC9C;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,8CAA8C,GAAI;AAC/D;AACA,CAAC;AAED,OAAO,MAAMC,4DAA4D,GAAI;AAC7E;AACA,CAAC;AAED,OAAO,MAAMC,4DAA4D,GAAI;AAC7E;AACA,CAAC;;AAED;AACA;AACA,OAAO,MAAMC,2CAA2C,GAAI;AAC5D;AACA;AACA,CAAC;;AAED;AACA,OAAO,MAAMC,iDAAiD,GAAI;AAClE;AACA;AACA,EAAE;;AAEF;AACA,OAAO,MAAMC,0CAA0C,GAAI;AAC3D;AACA;AACA;AACA,EAAE;AACF,OAAO,MAAMC,gCAAgC,GAAI;AACjD,UAAUR,4BAA6B;AACvC;AACA,IAAI;AACJ,OAAO,MAAMS,mBAAmB,GAAI;AACpC;AACA;AACA,wDAAwD;AACxD,OAAO,MAAMC,gCAAgC,GAAI;AACjD;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,OAAO,MAAMC,gCAAgC,GAAI;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR,OAAO,MAAMC,yCAAyC,GAAI;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>CFBundleShortVersionString</key>
|
|
6
|
+
<string>{{BUNDLE_SHORT_VERSION}}</string>
|
|
7
|
+
<key>CFBundleVersion</key>
|
|
8
|
+
<string>{{BUNDLE_VERSION}}</string>
|
|
9
|
+
<key>CFBundleDevelopmentRegion</key>
|
|
10
|
+
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
|
11
|
+
<key>CFBundleDisplayName</key>
|
|
12
|
+
<string>NotificationServiceExtension</string>
|
|
13
|
+
<key>CFBundleExecutable</key>
|
|
14
|
+
<string>$(EXECUTABLE_NAME)</string>
|
|
15
|
+
<key>CFBundleIdentifier</key>
|
|
16
|
+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
17
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
18
|
+
<string>6.0</string>
|
|
19
|
+
<key>CFBundleName</key>
|
|
20
|
+
<string>$(PRODUCT_NAME)</string>
|
|
21
|
+
<key>CFBundlePackageType</key>
|
|
22
|
+
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
|
23
|
+
<key>NSExtension</key>
|
|
24
|
+
<dict>
|
|
25
|
+
<key>NSExtensionPointIdentifier</key>
|
|
26
|
+
<string>com.apple.usernotifications.service</string>
|
|
27
|
+
<key>NSExtensionPrincipalClass</key>
|
|
28
|
+
<string>NotificationService</string>
|
|
29
|
+
</dict>
|
|
30
|
+
</dict>
|
|
31
|
+
</plist>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
#import "NotificationService.h"
|
|
3
|
+
#import "NotificationService-Swift.h"
|
|
4
|
+
|
|
5
|
+
@interface NotificationService ()
|
|
6
|
+
|
|
7
|
+
@property (nonatomic, strong) void (^contentHandler)(UNNotificationContent *contentToDeliver);
|
|
8
|
+
@property (nonatomic, strong) UNMutableNotificationContent *bestAttemptContent;
|
|
9
|
+
|
|
10
|
+
@end
|
|
11
|
+
|
|
12
|
+
@implementation NotificationService
|
|
13
|
+
|
|
14
|
+
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
|
|
15
|
+
NotificationServiceCioManager* cioManagerObj = [[NotificationServiceCioManager alloc] init];
|
|
16
|
+
[cioManagerObj didReceive:request withContentHandler:contentHandler];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
- (void)serviceExtensionTimeWillExpire {
|
|
20
|
+
// Called just before the extension will be terminated by the system.
|
|
21
|
+
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
|
|
22
|
+
NotificationServiceCioManager* cioManagerObj = [[NotificationServiceCioManager alloc] init];
|
|
23
|
+
[cioManagerObj serviceExtensionTimeWillExpire];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import UserNotifications
|
|
3
|
+
import CioMessagingPush
|
|
4
|
+
|
|
5
|
+
@objc
|
|
6
|
+
public class NotificationServiceCioManager : NSObject {
|
|
7
|
+
|
|
8
|
+
public override init() {}
|
|
9
|
+
|
|
10
|
+
@objc(didReceive:withContentHandler:)
|
|
11
|
+
public func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
|
12
|
+
MessagingPush.shared.didReceive(request, withContentHandler: contentHandler)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@objc(serviceExtensionTimeWillExpire)
|
|
16
|
+
public func serviceExtensionTimeWillExpire() {
|
|
17
|
+
MessagingPush.shared.serviceExtensionTimeWillExpire()
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import CioMessagingPushAPN
|
|
3
|
+
import CioTracking
|
|
4
|
+
import UserNotifications
|
|
5
|
+
import UIKit
|
|
6
|
+
|
|
7
|
+
@objc
|
|
8
|
+
public class CIOAppPushNotificationsHandler : NSObject {
|
|
9
|
+
|
|
10
|
+
public override init() {}
|
|
11
|
+
|
|
12
|
+
@objc(registerPushNotification:)
|
|
13
|
+
public func registerPushNotification(withNotificationDelegate notificationDelegate: UNUserNotificationCenterDelegate) {
|
|
14
|
+
|
|
15
|
+
let center = UNUserNotificationCenter.current()
|
|
16
|
+
center.delegate = notificationDelegate
|
|
17
|
+
center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
|
|
18
|
+
if error == nil{
|
|
19
|
+
DispatchQueue.main.async {
|
|
20
|
+
UIApplication.shared.registerForRemoteNotifications()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@objc(application:deviceToken:)
|
|
27
|
+
public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
|
28
|
+
MessagingPush.shared.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@objc(application:error:)
|
|
32
|
+
public func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
|
|
33
|
+
MessagingPush.shared.application(application, didFailToRegisterForRemoteNotificationsWithError: error)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@objc(userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:)
|
|
37
|
+
public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
|
|
38
|
+
let handled = MessagingPush.shared.userNotificationCenter(center, didReceive: response,
|
|
39
|
+
withCompletionHandler: completionHandler)
|
|
40
|
+
|
|
41
|
+
// If the Customer.io SDK does not handle the push, it's up to you to handle it and call the
|
|
42
|
+
// completion handler. If the SDK did handle it, it called the completion handler for you.
|
|
43
|
+
if !handled {
|
|
44
|
+
completionHandler()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function injectCodeByRegex(fileContent, lineRegex, snippet) {
|
|
2
|
+
const lines = fileContent.split('\n');
|
|
3
|
+
const index = lines.findIndex(line => lineRegex.test(line));
|
|
4
|
+
let content = lines;
|
|
5
|
+
if (index > -1) {
|
|
6
|
+
content = [...lines.slice(0, index), snippet, ...lines.slice(index)];
|
|
7
|
+
}
|
|
8
|
+
return content;
|
|
9
|
+
}
|
|
10
|
+
export function injectCodeByMultiLineRegex(fileContent, lineRegex, snippet) {
|
|
11
|
+
return fileContent.replace(lineRegex, `$&\n${snippet}`);
|
|
12
|
+
}
|
|
13
|
+
export function injectCodeByMultiLineRegexAndReplaceLine(fileContent, lineRegex, snippet) {
|
|
14
|
+
return fileContent.replace(lineRegex, `${snippet}`);
|
|
15
|
+
}
|
|
16
|
+
export function injectCodeByLineNumber(fileContent, index, snippet) {
|
|
17
|
+
const lines = fileContent.split('\n');
|
|
18
|
+
let content = lines;
|
|
19
|
+
if (index > -1) {
|
|
20
|
+
content = [...lines.slice(0, index), snippet, ...lines.slice(index)];
|
|
21
|
+
}
|
|
22
|
+
return content;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=codeInjection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["injectCodeByRegex","fileContent","lineRegex","snippet","lines","split","index","findIndex","line","test","content","slice","injectCodeByMultiLineRegex","replace","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 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,iBAAiB,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,0BAA0B,CACxCX,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,OAAMC,OAAQ,EAAC,CAAC;AACzD;AAEA,OAAO,SAASW,wCAAwC,CACtDb,WAAmB,EACnBC,SAAiB,EACjBC,OAAe,EACf;EACA,OAAOF,WAAW,CAACY,OAAO,CAACX,SAAS,EAAG,GAAEC,OAAQ,EAAC,CAAC;AACrD;AAEA,OAAO,SAASY,sBAAsB,CACpCd,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"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { readFile, writeFile, appendFile, existsSync, copyFileSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
|
|
2
|
+
export class FileManagement {
|
|
3
|
+
static async read(path) {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
readFile(path, 'utf8', (err, data) => {
|
|
6
|
+
if (err || !data) {
|
|
7
|
+
reject(err);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
resolve(data);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
static async write(path, contents) {
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
writeFile(path, contents, 'utf8', err => {
|
|
17
|
+
if (err) {
|
|
18
|
+
reject(err);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
resolve();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
static async append(path, contents) {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
appendFile(path, contents, 'utf8', err => {
|
|
28
|
+
if (err) {
|
|
29
|
+
reject(err);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
resolve();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
static exists(path) {
|
|
37
|
+
return existsSync(path);
|
|
38
|
+
}
|
|
39
|
+
static copyFile(src, dest) {
|
|
40
|
+
try {
|
|
41
|
+
copyFileSync(src, dest);
|
|
42
|
+
} catch (err) {
|
|
43
|
+
console.log(`Error copying file from ${src} to ${dest}: `, err);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
static mkdir(path, options) {
|
|
47
|
+
try {
|
|
48
|
+
mkdirSync(path, options);
|
|
49
|
+
} catch (err) {
|
|
50
|
+
console.log(`Error creating directory ${path}: `, err);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
static writeFile(path, data) {
|
|
54
|
+
try {
|
|
55
|
+
writeFileSync(path, data);
|
|
56
|
+
} catch (err) {
|
|
57
|
+
console.log(`Error writing to file ${path}: `, err);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
static readFile(path) {
|
|
61
|
+
try {
|
|
62
|
+
return readFileSync(path, 'utf-8');
|
|
63
|
+
} catch (err) {
|
|
64
|
+
console.log(`Error reading file ${path}: `, err);
|
|
65
|
+
}
|
|
66
|
+
return '';
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=fileManagement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["readFile","writeFile","appendFile","existsSync","copyFileSync","mkdirSync","writeFileSync","readFileSync","FileManagement","read","path","Promise","resolve","reject","err","data","write","contents","append","exists","copyFile","src","dest","console","log","mkdir","options"],"sources":["fileManagement.ts"],"sourcesContent":["import {\n readFile,\n writeFile,\n appendFile,\n existsSync,\n copyFileSync,\n mkdirSync,\n writeFileSync,\n readFileSync,\n MakeDirectoryOptions,\n} from 'fs';\n\nexport class FileManagement {\n static async read(path: string): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n readFile(path, 'utf8', (err, data) => {\n if (err || !data) {\n reject(err);\n return;\n }\n resolve(data);\n });\n });\n }\n\n static async write(path: string, contents: string): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n writeFile(path, contents, 'utf8', (err) => {\n if (err) {\n reject(err);\n return;\n }\n resolve();\n });\n });\n }\n\n static async append(path: string, contents: string): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n appendFile(path, contents, 'utf8', (err) => {\n if (err) {\n reject(err);\n return;\n }\n resolve();\n });\n });\n }\n\n static exists(path: string) {\n return existsSync(path);\n }\n\n static copyFile(src: string, dest: string) {\n try {\n copyFileSync(src, dest);\n } catch (err) {\n console.log(`Error copying file from ${src} to ${dest}: `, err);\n }\n }\n\n static mkdir(path: string, options: MakeDirectoryOptions) {\n try {\n mkdirSync(path, options);\n } catch (err) {\n console.log(`Error creating directory ${path}: `, err);\n }\n }\n\n static writeFile(path: string, data: string) {\n try {\n writeFileSync(path, data);\n } catch (err) {\n console.log(`Error writing to file ${path}: `, err);\n }\n }\n\n static readFile(path: string) {\n try {\n return readFileSync(path, 'utf-8');\n } catch (err) {\n console.log(`Error reading file ${path}: `, err);\n }\n\n return '';\n }\n}\n"],"mappings":"AAAA,SACEA,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,YAAY,EACZC,SAAS,EACTC,aAAa,EACbC,YAAY,QAEP,IAAI;AAEX,OAAO,MAAMC,cAAc,CAAC;EAC1B,aAAaC,IAAI,CAACC,IAAY,EAAmB;IAC/C,OAAO,IAAIC,OAAO,CAAS,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC9Cb,QAAQ,CAACU,IAAI,EAAE,MAAM,EAAE,CAACI,GAAG,EAAEC,IAAI,KAAK;QACpC,IAAID,GAAG,IAAI,CAACC,IAAI,EAAE;UAChBF,MAAM,CAACC,GAAG,CAAC;UACX;QACF;QACAF,OAAO,CAACG,IAAI,CAAC;MACf,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,aAAaC,KAAK,CAACN,IAAY,EAAEO,QAAgB,EAAiB;IAChE,OAAO,IAAIN,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC5CZ,SAAS,CAACS,IAAI,EAAEO,QAAQ,EAAE,MAAM,EAAGH,GAAG,IAAK;QACzC,IAAIA,GAAG,EAAE;UACPD,MAAM,CAACC,GAAG,CAAC;UACX;QACF;QACAF,OAAO,EAAE;MACX,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,aAAaM,MAAM,CAACR,IAAY,EAAEO,QAAgB,EAAiB;IACjE,OAAO,IAAIN,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;MAC5CX,UAAU,CAACQ,IAAI,EAAEO,QAAQ,EAAE,MAAM,EAAGH,GAAG,IAAK;QAC1C,IAAIA,GAAG,EAAE;UACPD,MAAM,CAACC,GAAG,CAAC;UACX;QACF;QACAF,OAAO,EAAE;MACX,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAEA,OAAOO,MAAM,CAACT,IAAY,EAAE;IAC1B,OAAOP,UAAU,CAACO,IAAI,CAAC;EACzB;EAEA,OAAOU,QAAQ,CAACC,GAAW,EAAEC,IAAY,EAAE;IACzC,IAAI;MACFlB,YAAY,CAACiB,GAAG,EAAEC,IAAI,CAAC;IACzB,CAAC,CAAC,OAAOR,GAAG,EAAE;MACZS,OAAO,CAACC,GAAG,CAAE,2BAA0BH,GAAI,OAAMC,IAAK,IAAG,EAAER,GAAG,CAAC;IACjE;EACF;EAEA,OAAOW,KAAK,CAACf,IAAY,EAAEgB,OAA6B,EAAE;IACxD,IAAI;MACFrB,SAAS,CAACK,IAAI,EAAEgB,OAAO,CAAC;IAC1B,CAAC,CAAC,OAAOZ,GAAG,EAAE;MACZS,OAAO,CAACC,GAAG,CAAE,4BAA2Bd,IAAK,IAAG,EAAEI,GAAG,CAAC;IACxD;EACF;EAEA,OAAOb,SAAS,CAACS,IAAY,EAAEK,IAAY,EAAE;IAC3C,IAAI;MACFT,aAAa,CAACI,IAAI,EAAEK,IAAI,CAAC;IAC3B,CAAC,CAAC,OAAOD,GAAG,EAAE;MACZS,OAAO,CAACC,GAAG,CAAE,yBAAwBd,IAAK,IAAG,EAAEI,GAAG,CAAC;IACrD;EACF;EAEA,OAAOd,QAAQ,CAACU,IAAY,EAAE;IAC5B,IAAI;MACF,OAAOH,YAAY,CAACG,IAAI,EAAE,OAAO,CAAC;IACpC,CAAC,CAAC,OAAOI,GAAG,EAAE;MACZS,OAAO,CAACC,GAAG,CAAE,sBAAqBd,IAAK,IAAG,EAAEI,GAAG,CAAC;IAClD;IAEA,OAAO,EAAE;EACX;AACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CIO_PODFILE_REGEX, CIO_PODFILE_SNIPPET, CIO_PODFILE_POST_INSTALL_REGEX, CIO_PODFILE_TARGET_NAMES_SNIPPET, CIO_PODFILE_POST_INSTALL_SNIPPET, CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET, CIO_PODFILE_NOTIFICATION_SNIPPET, CIO_PODFILE_NOTIFICATION_REGEX, CIO_CIO_TARGET_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 : '', CIO_PODFILE_TARGET_NAMES_SNIPPET, ...lines.slice(index - 1, index + 1), CIO_PODFILE_POST_INSTALL_SNIPPET, ...lines.slice(index + 1)];
|
|
14
|
+
} else {
|
|
15
|
+
content.push(CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET);
|
|
16
|
+
}
|
|
17
|
+
FileManagement.write(filename, content.join('\n'));
|
|
18
|
+
} else {
|
|
19
|
+
console.log('Customerio Podfile snippets already exists. Skipping...');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export async function injectCIONotificationPodfileCode(iosPath) {
|
|
23
|
+
const filename = `${iosPath}/Podfile`;
|
|
24
|
+
const podfile = await FileManagement.read(filename);
|
|
25
|
+
const matches = podfile.match(CIO_PODFILE_NOTIFICATION_REGEX);
|
|
26
|
+
if (!matches) {
|
|
27
|
+
FileManagement.append(filename, CIO_PODFILE_NOTIFICATION_SNIPPET);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=injectCIOPodfileCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CIO_PODFILE_REGEX","CIO_PODFILE_SNIPPET","CIO_PODFILE_POST_INSTALL_REGEX","CIO_PODFILE_TARGET_NAMES_SNIPPET","CIO_PODFILE_POST_INSTALL_SNIPPET","CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET","CIO_PODFILE_NOTIFICATION_SNIPPET","CIO_PODFILE_NOTIFICATION_REGEX","CIO_CIO_TARGET_REGEX","FileManagement","injectCIOPodfileCode","iosPath","filename","podfile","read","matches","match","targetMatch","lines","split","index","findIndex","line","test","content","slice","push","write","join","console","log","injectCIONotificationPodfileCode","append"],"sources":["injectCIOPodfileCode.ts"],"sourcesContent":["import {\n CIO_PODFILE_REGEX,\n CIO_PODFILE_SNIPPET,\n CIO_PODFILE_POST_INSTALL_REGEX,\n CIO_PODFILE_TARGET_NAMES_SNIPPET,\n CIO_PODFILE_POST_INSTALL_SNIPPET,\n CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET,\n CIO_PODFILE_NOTIFICATION_SNIPPET,\n CIO_PODFILE_NOTIFICATION_REGEX,\n CIO_CIO_TARGET_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 CIO_PODFILE_TARGET_NAMES_SNIPPET,\n ...lines.slice(index - 1, index + 1),\n CIO_PODFILE_POST_INSTALL_SNIPPET,\n ...lines.slice(index + 1),\n ];\n } else {\n content.push(CIO_PODFILE_POST_INSTALL_FALLBACK_SNIPPET);\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(iosPath: string) {\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 FileManagement.append(filename, CIO_PODFILE_NOTIFICATION_SNIPPET);\n }\n}\n"],"mappings":"AAAA,SACEA,iBAAiB,EACjBC,mBAAmB,EACnBC,8BAA8B,EAC9BC,gCAAgC,EAChCC,gCAAgC,EAChCC,yCAAyC,EACzCC,gCAAgC,EAChCC,8BAA8B,EAC9BC,oBAAoB,QACf,kBAAkB;AACzB,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,OAAO,eAAeC,oBAAoB,CAACC,OAAe,EAAE;EAC1D,MAAMC,QAAQ,GAAI,GAAED,OAAQ,UAAS;EACrC,MAAME,OAAO,GAAG,MAAMJ,cAAc,CAACK,IAAI,CAACF,QAAQ,CAAC;EACnD,MAAMG,OAAO,GAAGF,OAAO,CAACG,KAAK,CAAChB,iBAAiB,CAAC;EAChD,MAAMiB,WAAW,GAAGJ,OAAO,CAACG,KAAK,CAACR,oBAAoB,CAAC;EAEvD,IAAI,CAACS,WAAW,EAAE;IAChB,MAAMC,KAAK,GAAGL,OAAO,CAACM,KAAK,CAAC,IAAI,CAAC;IACjC,MAAMC,KAAK,GAAGF,KAAK,CAACG,SAAS,CAAEC,IAAI,IACjCpB,8BAA8B,CAACqB,IAAI,CAACD,IAAI,CAAC,CAC1C;IACD,IAAIE,OAAiB,GAAGN,KAAK;IAC7B,IAAIE,KAAK,GAAG,CAAC,CAAC,EAAE;MACdI,OAAO,GAAG,CACR,GAAGN,KAAK,CAACO,KAAK,CAAC,CAAC,EAAEL,KAAK,GAAG,CAAC,CAAC,EAC5B,CAACL,OAAO,GAAGd,mBAAmB,GAAG,EAAE,EACnCE,gCAAgC,EAChC,GAAGe,KAAK,CAACO,KAAK,CAACL,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAG,CAAC,CAAC,EACpChB,gCAAgC,EAChC,GAAGc,KAAK,CAACO,KAAK,CAACL,KAAK,GAAG,CAAC,CAAC,CAC1B;IACH,CAAC,MAAM;MACLI,OAAO,CAACE,IAAI,CAACrB,yCAAyC,CAAC;IACzD;IAEAI,cAAc,CAACkB,KAAK,CAACf,QAAQ,EAAEY,OAAO,CAACI,IAAI,CAAC,IAAI,CAAC,CAAC;EACpD,CAAC,MAAM;IACLC,OAAO,CAACC,GAAG,CAAC,yDAAyD,CAAC;EACxE;AACF;AAEA,OAAO,eAAeC,gCAAgC,CAACpB,OAAe,EAAE;EACtE,MAAMC,QAAQ,GAAI,GAAED,OAAQ,UAAS;EACrC,MAAME,OAAO,GAAG,MAAMJ,cAAc,CAACK,IAAI,CAACF,QAAQ,CAAC;EACnD,MAAMG,OAAO,GAAGF,OAAO,CAACG,KAAK,CAACT,8BAA8B,CAAC;EAE7D,IAAI,CAACQ,OAAO,EAAE;IACZN,cAAc,CAACuB,MAAM,CAACpB,QAAQ,EAAEN,gCAAgC,CAAC;EACnE;AACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { withAnalytics } from './analytics/injectAnalytics';
|
|
2
|
+
import { withCIOAndroid } from './android/withCIOAndroid';
|
|
3
|
+
import { withCIOIos } from './ios/withCIOIos';
|
|
4
|
+
// Entry point for config plugin
|
|
5
|
+
function withCustomerIOPlugin(config, props) {
|
|
6
|
+
if (props.ios) {
|
|
7
|
+
config = withCIOIos(config, props.ios);
|
|
8
|
+
}
|
|
9
|
+
if (props.android) {
|
|
10
|
+
config = withCIOAndroid(config, props.android);
|
|
11
|
+
}
|
|
12
|
+
config = withAnalytics(config, props);
|
|
13
|
+
return config;
|
|
14
|
+
}
|
|
15
|
+
export default withCustomerIOPlugin;
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withAnalytics","withCIOAndroid","withCIOIos","withCustomerIOPlugin","config","props","ios","android"],"sources":["index.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport { withAnalytics } from './analytics/injectAnalytics';\nimport { withCIOAndroid } from './android/withCIOAndroid';\nimport { withCIOIos } from './ios/withCIOIos';\nimport type { CustomerIOPluginOptions } from './types/cio-types';\n\n// Entry point for config plugin\nfunction withCustomerIOPlugin(\n config: ExpoConfig,\n props: CustomerIOPluginOptions\n) {\n if (props.ios) {\n config = withCIOIos(config, props.ios);\n }\n\n if (props.android) {\n config = withCIOAndroid(config, props.android);\n }\n\n config = withAnalytics(config, props);\n\n return config;\n}\n\nexport default withCustomerIOPlugin;\n"],"mappings":"AAEA,SAASA,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,UAAU,QAAQ,kBAAkB;AAG7C;AACA,SAASC,oBAAoB,CAC3BC,MAAkB,EAClBC,KAA8B,EAC9B;EACA,IAAIA,KAAK,CAACC,GAAG,EAAE;IACbF,MAAM,GAAGF,UAAU,CAACE,MAAM,EAAEC,KAAK,CAACC,GAAG,CAAC;EACxC;EAEA,IAAID,KAAK,CAACE,OAAO,EAAE;IACjBH,MAAM,GAAGH,cAAc,CAACG,MAAM,EAAEC,KAAK,CAACE,OAAO,CAAC;EAChD;EAEAH,MAAM,GAAGJ,aAAa,CAACI,MAAM,EAAEC,KAAK,CAAC;EAErC,OAAOD,MAAM;AACf;AAEA,eAAeD,oBAAoB"}
|