customerio-expo-plugin 1.0.0-beta.2 → 1.0.0-beta.4
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 +19 -1
- package/lib/commonjs/android/withAndroidManifestUpdates.js +37 -0
- package/lib/commonjs/android/withAndroidManifestUpdates.js.map +1 -0
- package/lib/commonjs/android/withAppGoogleServices.js.map +1 -1
- package/lib/commonjs/android/withCIOAndroid.js +4 -0
- package/lib/commonjs/android/withCIOAndroid.js.map +1 -1
- package/lib/commonjs/android/withGistMavenRepository.js.map +1 -1
- package/lib/commonjs/android/withGoogleServicesJSON.js.map +1 -1
- package/lib/commonjs/android/withProjectGoogleServices.js.map +1 -1
- package/lib/commonjs/helpers/constants/android.js.map +1 -1
- package/lib/commonjs/helpers/constants/ios.js +17 -2
- package/lib/commonjs/helpers/constants/ios.js.map +1 -1
- package/lib/commonjs/helpers/native-files/ios/PushService.swift +1 -13
- package/lib/commonjs/helpers/utils/codeInjection.js.map +1 -1
- package/lib/commonjs/helpers/utils/fileManagement.js.map +1 -1
- package/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ios/withAppDelegateModifications.js +4 -2
- package/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -1
- package/lib/commonjs/ios/withCIOIos.js.map +1 -1
- package/lib/commonjs/ios/withNotificationsXcodeProject.js +37 -9
- package/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -1
- package/lib/commonjs/ios/withXcodeProject.js.map +1 -1
- package/lib/commonjs/postInstallHelper.js.map +1 -1
- package/lib/commonjs/types/cio-types.js.map +1 -1
- package/lib/module/android/withAndroidManifestUpdates.js +30 -0
- package/lib/module/android/withAndroidManifestUpdates.js.map +1 -0
- package/lib/module/android/withCIOAndroid.js +4 -0
- package/lib/module/android/withCIOAndroid.js.map +1 -1
- package/lib/module/android/withGoogleServicesJSON.js.map +1 -1
- package/lib/module/helpers/constants/ios.js +15 -1
- package/lib/module/helpers/constants/ios.js.map +1 -1
- package/lib/module/helpers/native-files/ios/PushService.swift +1 -13
- package/lib/module/helpers/utils/codeInjection.js.map +1 -1
- package/lib/module/helpers/utils/fileManagement.js.map +1 -1
- package/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/ios/withAppDelegateModifications.js +4 -2
- package/lib/module/ios/withAppDelegateModifications.js.map +1 -1
- package/lib/module/ios/withCIOIos.js.map +1 -1
- package/lib/module/ios/withNotificationsXcodeProject.js +38 -10
- package/lib/module/ios/withNotificationsXcodeProject.js.map +1 -1
- package/lib/module/ios/withXcodeProject.js.map +1 -1
- package/lib/module/postInstallHelper.js.map +1 -1
- package/lib/module/types/cio-types.js.map +1 -1
- package/lib/typescript/android/withAndroidManifestUpdates.d.ts +3 -0
- package/lib/typescript/helpers/constants/ios.d.ts +2 -1
- package/lib/typescript/ios/withAppDelegateModifications.d.ts +2 -1
- package/lib/typescript/types/cio-types.d.ts +2 -0
- package/package.json +1 -1
- package/src/android/withAndroidManifestUpdates.ts +49 -0
- package/src/android/withCIOAndroid.ts +4 -0
- package/src/helpers/constants/ios.ts +16 -1
- package/src/helpers/native-files/ios/PushService.swift +1 -13
- package/src/ios/withAppDelegateModifications.ts +7 -4
- package/src/ios/withNotificationsXcodeProject.ts +52 -8
- package/src/types/cio-types.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withXcodeProject","xcode","CIO_NOTIFICATION_TARGET_NAME","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","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","nsePath","mkdir","recursive","files","getTargetFile","filename","forEach","targetFile","copyFile","infoPlistTargetFile","updateNseInfoPlist","updateNseEnv","extGroup","addPbxGroup","groups","hash","objects","Object","keys","key","name","addToPbxGroup","uuid","projObjects","pbxTargetByName","console","warn","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","SITE_ID_RE","API_KEY_RE","REGION_RE","envFileContent","env","siteId","apiKey","region","file","appPath","exists","log","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins';\nimport xcode from 'xcode';\n\nimport {\n CIO_NOTIFICATION_TARGET_NAME,\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 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 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) {\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 let region = '';\n if (options.pushNotification?.env?.region === 'us') {\n region = 'Region.US';\n } else if (options.pushNotification?.env?.region === 'eu') {\n region = 'Region.EU';\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGION_RE, region);\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\n if (!FileManagement.exists(getTargetFile(file))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n const targetFile = getTargetFile(file);\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 }\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"],"mappings":"AAAA,SAAuBA,gBAAgB,QAAQ,sBAAsB;AACrE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SACEC,4BAA4B,EAC5BC,sBAAsB,EACtBC,2BAA2B,QACtB,0BAA0B;AACjC,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,gCAAgC,QAAQ,uCAAuC;AAExF,SAASC,cAAc,QAAQ,mCAAmC;AAElE,MAAMC,cAAc,GAAI,GAAEN,4BAA6B,aAAY;AACnE,MAAMO,YAAY,GAAG,WAAW;AAEhC,MAAMC,sBAAsB,GAAI,OAAM;AAEtC,MAAMC,+BAA+B,GAAG,MACtCC,OAAmC,IAChC;EACH;EACA;EACA,MAAM;IAAEC,OAAO;IAAEC;EAAQ,CAAC,GAAGF,OAAO;EAEpC,MAAMG,QAAQ,GAAI,GAAEF,OAAQ,IAAGC,OAAQ,4BAA2B;EAElE,MAAME,YAAY,GAAGf,KAAK,CAACgB,OAAO,CAACF,QAAQ,CAAC;EAE5CC,YAAY,CAACE,KAAK,CAAC,gBAAgBC,GAAU,EAAE;IAAA;IAC7C,IAAIA,GAAG,EAAE;MACP,MAAM,IAAIC,KAAK,CAAE,8BAA6BC,IAAI,CAACC,SAAS,CAACH,GAAG,CAAE,EAAC,CAAC;IACtE;IAEA,IAAIP,OAAO,CAACW,gBAAgB,EAAE;MAC5B,MAAMC,uBAAuB,CAACZ,OAAO,EAAEI,YAAY,CAAC;IACtD;IAEA,6BAAIJ,OAAO,CAACW,gBAAgB,kDAAxB,sBAA0BE,WAAW,EAAE;MACzC,MAAMC,oBAAoB,CAACd,OAAO,EAAEI,YAAY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,OAAmC,EACnCI,YAAiB,EACjB;EACA,MAAM;IAAEH,OAAO;IAAEC;EAAQ,CAAC,GAAGF,OAAO;EACpC,MAAMwF,IAAI,GAAG,mBAAmB;EAChC,MAAMC,OAAO,GAAI,GAAExF,OAAQ,IAAGC,OAAQ,EAAC;EACvC,MAAMoC,aAAa,GAAIC,QAAgB,IAAM,GAAEkD,OAAQ,IAAGlD,QAAS,EAAC;EAEpE,IAAI,CAAC5C,cAAc,CAAC+F,MAAM,CAACpD,aAAa,CAACkD,IAAI,CAAC,CAAC,EAAE;IAC/C7F,cAAc,CAACwC,KAAK,CAACsD,OAAO,EAAE;MAC5BrD,SAAS,EAAE;IACb,CAAC,CAAC;IAEF,MAAMK,UAAU,GAAGH,aAAa,CAACkD,IAAI,CAAC;IACtC7F,cAAc,CAAC+C,QAAQ,CACpB,GAAElD,2BAA4B,IAAGgG,IAAK,EAAC,EACxC/C,UAAU,CACX;EACH,CAAC,MAAM;IACLkB,OAAO,CAACgC,GAAG,CAAE,GAAErD,aAAa,CAACkD,IAAI,CAAE,8BAA6B,CAAC;EACnE;EAEA,MAAMI,KAAK,GAAGxF,YAAY,CAACyF,cAAc,CAAC,yBAAyB,CAAC;EACpE,MAAMC,UAAU,GAAG1F,YAAY,CAAC2F,eAAe,CAAC;IAAEzC,IAAI,EAAG,GAAEpD,OAAQ;EAAE,CAAC,CAAC;EACvEE,YAAY,CAACmD,aAAa,CAACqC,KAAK,EAAEE,UAAU,CAAC;EAE7C1F,YAAY,CAAC4F,aAAa,CAAE,GAAE9F,OAAQ,IAAGsF,IAAK,EAAC,EAAE,IAAI,EAAEI,KAAK,CAAC;AAC/D"}
|
|
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 (!options.disableNotificationRegistration) {\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;AAExF,SAASC,cAAc,QAAQ,mCAAmC;AAElE,MAAMC,cAAc,GAAI,GAAEP,4BAA6B,aAAY;AACnE,MAAMQ,YAAY,GAAG,WAAW;AAEhC,MAAMC,sBAAsB,GAAI,OAAM;AAEtC,MAAMC,+BAA+B,GAAG,MACtCC,OAAmC,IAChC;EACH;EACA;EACA,MAAM;IAAEC,OAAO;IAAEC;EAAQ,CAAC,GAAGF,OAAO;EAEpC,MAAMG,QAAQ,GAAI,GAAEF,OAAQ,IAAGC,OAAQ,4BAA2B;EAElE,MAAME,YAAY,GAAGhB,KAAK,CAACiB,OAAO,CAACF,QAAQ,CAAC;EAE5CC,YAAY,CAACE,KAAK,CAAC,gBAAgBC,GAAU,EAAE;IAAA,IAAAC,qBAAA;IAC7C,IAAID,GAAG,EAAE;MACP,MAAM,IAAIE,KAAK,CAAE,8BAA6BC,IAAI,CAACC,SAAS,CAACJ,GAAG,CAAE,EAAC,CAAC;IACtE;IAEA,IAAIP,OAAO,CAACY,gBAAgB,EAAE;MAC5B,MAAMC,uBAAuB,CAACb,OAAO,EAAEI,YAAY,CAAC;IACtD;IAEA,KAAAI,qBAAA,GAAIR,OAAO,CAACY,gBAAgB,cAAAJ,qBAAA,eAAxBA,qBAAA,CAA0BM,WAAW,EAAE;MACzC,MAAMC,oBAA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0H,+BAA+B,EAAE;IAC5CD,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 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withXcodeProject","injectCIOPodfileCode","withCioXcodeProject","config","cioProps","props","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,
|
|
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 +1 @@
|
|
|
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,
|
|
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 +1 @@
|
|
|
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 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};\n\nexport type CustomerIOPluginOptions = {\n android: CustomerIOPluginOptionsAndroid;\n ios: CustomerIOPluginOptionsIOS;\n};\n"],"mappings":""}
|
|
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,4 +1,4 @@
|
|
|
1
|
-
export declare const LOCAL_PATH_TO_CIO_NSE_FILES = "node_modules/customerio-expo-plugin/src/helpers/native-files/ios";
|
|
1
|
+
export declare const LOCAL_PATH_TO_CIO_NSE_FILES = "./node_modules/customerio-expo-plugin/src/helpers/native-files/ios";
|
|
2
2
|
export declare const IOS_DEPLOYMENT_TARGET = "13.0";
|
|
3
3
|
export declare const CIO_SDK_VERSION = "~> 2.0.0";
|
|
4
4
|
export declare const CIO_PODFILE_REGEX: RegExp;
|
|
@@ -28,3 +28,4 @@ export declare const CIO_WILLPRESENTNOTIFICATIONHANDLER_SNIPPET = "\n// show pus
|
|
|
28
28
|
export declare const CIO_PODFILE_SNIPPET: string;
|
|
29
29
|
export declare const CIO_PODFILE_NOTIFICATION_SNIPPET: string;
|
|
30
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,2 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
-
|
|
2
|
+
import type { CustomerIOPluginOptionsIOS } from '../types/cio-types';
|
|
3
|
+
export declare const withAppDelegateModifications: ConfigPlugin<CustomerIOPluginOptionsIOS>;
|
|
@@ -11,6 +11,7 @@ export type CustomerIOPluginOptionsIOS = {
|
|
|
11
11
|
iosDeploymentTarget?: string;
|
|
12
12
|
appleTeamId?: string;
|
|
13
13
|
appName?: string;
|
|
14
|
+
disableNotificationRegistration?: boolean;
|
|
14
15
|
useFrameworks?: 'static' | 'dynamic';
|
|
15
16
|
pushNotification?: {
|
|
16
17
|
useRichPush: boolean;
|
|
@@ -24,6 +25,7 @@ export type CustomerIOPluginOptionsIOS = {
|
|
|
24
25
|
export type CustomerIOPluginOptionsAndroid = {
|
|
25
26
|
androidPath: string;
|
|
26
27
|
googleServicesFile?: string;
|
|
28
|
+
setHighPriorityPushHandler?: boolean;
|
|
27
29
|
};
|
|
28
30
|
export type CustomerIOPluginOptions = {
|
|
29
31
|
android: CustomerIOPluginOptionsAndroid;
|
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ConfigPlugin, withAndroidManifest } from '@expo/config-plugins';
|
|
2
|
+
import type { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';
|
|
3
|
+
|
|
4
|
+
import type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';
|
|
5
|
+
|
|
6
|
+
export const withAndroidManifestUpdates: ConfigPlugin<
|
|
7
|
+
CustomerIOPluginOptionsAndroid
|
|
8
|
+
> = (configOuter) => {
|
|
9
|
+
return withAndroidManifest(configOuter, (props) => {
|
|
10
|
+
const application = props.modResults.manifest
|
|
11
|
+
.application as ManifestApplication[];
|
|
12
|
+
const customerIOMessagingpush =
|
|
13
|
+
'io.customer.messagingpush.CustomerIOFirebaseMessagingService';
|
|
14
|
+
|
|
15
|
+
if (!application[0]['service']) {
|
|
16
|
+
application[0]['service'] = [];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const hasService = application[0]['service'].some(
|
|
20
|
+
(service) => service['$']['android:name'] === customerIOMessagingpush
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
if (!hasService) {
|
|
24
|
+
application[0]['service'].push({
|
|
25
|
+
'$': {
|
|
26
|
+
'android:name': customerIOMessagingpush,
|
|
27
|
+
'android:exported': 'false',
|
|
28
|
+
},
|
|
29
|
+
'intent-filter': [
|
|
30
|
+
{
|
|
31
|
+
action: [
|
|
32
|
+
{
|
|
33
|
+
$: {
|
|
34
|
+
'android:name': 'com.google.firebase.MESSAGING_EVENT',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
console.log(
|
|
42
|
+
'Successfully set CustomerIO push handler as priority in AndroidManifest.xml'
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
props.modResults.manifest.application = application;
|
|
47
|
+
return props;
|
|
48
|
+
});
|
|
49
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ExpoConfig } from '@expo/config-types';
|
|
2
2
|
|
|
3
3
|
import type { CustomerIOPluginOptionsAndroid } from '../types/cio-types';
|
|
4
|
+
import { withAndroidManifestUpdates } from './withAndroidManifestUpdates';
|
|
4
5
|
import { withAppGoogleServices } from './withAppGoogleServices';
|
|
5
6
|
import { withGistMavenRepository } from './withGistMavenRepository';
|
|
6
7
|
import { withGoogleServicesJSON } from './withGoogleServicesJSON';
|
|
@@ -14,6 +15,9 @@ export function withCIOAndroid(
|
|
|
14
15
|
config = withProjectGoogleServices(config, props);
|
|
15
16
|
config = withAppGoogleServices(config, props);
|
|
16
17
|
config = withGoogleServicesJSON(config, props);
|
|
18
|
+
if (props.setHighPriorityPushHandler) {
|
|
19
|
+
config = withAndroidManifestUpdates(config, props);
|
|
20
|
+
}
|
|
17
21
|
|
|
18
22
|
return config;
|
|
19
23
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const LOCAL_PATH_TO_CIO_NSE_FILES =
|
|
1
|
+
export const LOCAL_PATH_TO_CIO_NSE_FILES = `./node_modules/customerio-expo-plugin/src/helpers/native-files/ios`;
|
|
2
2
|
export const IOS_DEPLOYMENT_TARGET = '13.0';
|
|
3
3
|
export const CIO_SDK_VERSION = '~> 2.0.0';
|
|
4
4
|
export const CIO_PODFILE_REGEX = /pod 'CustomerIO\/MessagingPushAPN'/;
|
|
@@ -74,3 +74,18 @@ target '${CIO_NOTIFICATION_TARGET_NAME}' do
|
|
|
74
74
|
use_frameworks! :linkage => :static
|
|
75
75
|
${CIO_PODFILE_SNIPPET}
|
|
76
76
|
end`;
|
|
77
|
+
|
|
78
|
+
export const CIO_REGISTER_PUSHNOTIFICATION_SNIPPET = `
|
|
79
|
+
@objc(registerPushNotification:)
|
|
80
|
+
public func registerPushNotification(withNotificationDelegate notificationDelegate: UNUserNotificationCenterDelegate) {
|
|
81
|
+
|
|
82
|
+
let center = UNUserNotificationCenter.current()
|
|
83
|
+
center.delegate = notificationDelegate
|
|
84
|
+
center.requestAuthorization(options: [.sound, .alert, .badge]) { (granted, error) in
|
|
85
|
+
if error == nil{
|
|
86
|
+
DispatchQueue.main.async {
|
|
87
|
+
UIApplication.shared.registerForRemoteNotifications()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}`;
|
|
@@ -9,19 +9,7 @@ public class CIOAppPushNotificationsHandler : NSObject {
|
|
|
9
9
|
|
|
10
10
|
public override init() {}
|
|
11
11
|
|
|
12
|
-
|
|
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
|
-
}
|
|
12
|
+
{{REGISTER_SNIPPET}}
|
|
25
13
|
|
|
26
14
|
@objc(application:deviceToken:)
|
|
27
15
|
public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
injectCodeByMultiLineRegexAndReplaceLine,
|
|
23
23
|
} from '../helpers/utils/codeInjection';
|
|
24
24
|
import { FileManagement } from '../helpers/utils/fileManagement';
|
|
25
|
+
import type { CustomerIOPluginOptionsIOS } from '../types/cio-types';
|
|
25
26
|
|
|
26
27
|
const pushCodeSnippets = [
|
|
27
28
|
CIO_DIDRECEIVENOTIFICATIONRESPONSEHANDLER_SNIPPET,
|
|
@@ -119,9 +120,9 @@ const addAppdelegateHeaderModification = (stringContents: string) => {
|
|
|
119
120
|
return stringContents;
|
|
120
121
|
};
|
|
121
122
|
|
|
122
|
-
export const withAppDelegateModifications: ConfigPlugin<
|
|
123
|
-
|
|
124
|
-
) => {
|
|
123
|
+
export const withAppDelegateModifications: ConfigPlugin<
|
|
124
|
+
CustomerIOPluginOptionsIOS
|
|
125
|
+
> = (configOuter, props) => {
|
|
125
126
|
return withAppDelegate(configOuter, async (config) => {
|
|
126
127
|
let stringContents = config.modResults.contents;
|
|
127
128
|
const regex = new RegExp(
|
|
@@ -142,7 +143,9 @@ export const withAppDelegateModifications: ConfigPlugin<any> = (
|
|
|
142
143
|
config.modRequest.projectName as string
|
|
143
144
|
);
|
|
144
145
|
stringContents = addNotificationHandlerDeclaration(stringContents);
|
|
145
|
-
|
|
146
|
+
if (!props.disableNotificationRegistration) {
|
|
147
|
+
stringContents = addNotificationConfiguration(stringContents);
|
|
148
|
+
}
|
|
146
149
|
stringContents = addAdditionalMethodsForPushNotifications(stringContents);
|
|
147
150
|
stringContents =
|
|
148
151
|
addDidFailToRegisterForRemoteNotificationsWithError(stringContents);
|
|
@@ -3,6 +3,7 @@ import xcode from 'xcode';
|
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
CIO_NOTIFICATION_TARGET_NAME,
|
|
6
|
+
CIO_REGISTER_PUSHNOTIFICATION_SNIPPET,
|
|
6
7
|
DEFAULT_BUNDLE_VERSION,
|
|
7
8
|
LOCAL_PATH_TO_CIO_NSE_FILES,
|
|
8
9
|
} from '../helpers/constants/ios';
|
|
@@ -84,6 +85,7 @@ export const withCioNotificationsXcodeProject: ConfigPlugin<
|
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
const options = {
|
|
88
|
+
...props,
|
|
87
89
|
appleTeamId,
|
|
88
90
|
bundleIdentifier,
|
|
89
91
|
bundleShortVersion,
|
|
@@ -117,6 +119,15 @@ const addRichPushXcodeProj = async (
|
|
|
117
119
|
|
|
118
120
|
await injectCIONotificationPodfileCode(iosPath, useFrameworks);
|
|
119
121
|
|
|
122
|
+
// Check if `CIO_NOTIFICATION_TARGET_NAME` group already exist in the project
|
|
123
|
+
// If true then skip creating a new group to avoid duplicate folders
|
|
124
|
+
if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {
|
|
125
|
+
console.warn(
|
|
126
|
+
`${CIO_NOTIFICATION_TARGET_NAME} already exists in project. Skipping...`
|
|
127
|
+
);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
120
131
|
const nsePath = `${iosPath}/${CIO_NOTIFICATION_TARGET_NAME}`;
|
|
121
132
|
FileManagement.mkdir(nsePath, {
|
|
122
133
|
recursive: true,
|
|
@@ -160,7 +171,7 @@ const addRichPushXcodeProj = async (
|
|
|
160
171
|
// files / folder appear in the file explorer in Xcode.
|
|
161
172
|
const groups = xcodeProject.hash.project.objects['PBXGroup'];
|
|
162
173
|
Object.keys(groups).forEach((key) => {
|
|
163
|
-
if (groups[key].name === undefined) {
|
|
174
|
+
if (groups[key].name === undefined && groups[key].path === undefined) {
|
|
164
175
|
xcodeProject.addToPbxGroup(extGroup.uuid, key);
|
|
165
176
|
}
|
|
166
177
|
});
|
|
@@ -290,13 +301,23 @@ const updateNseEnv = (
|
|
|
290
301
|
}
|
|
291
302
|
|
|
292
303
|
if (options.pushNotification?.env?.region) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
304
|
+
const regionMap = {
|
|
305
|
+
us: 'Region.US',
|
|
306
|
+
eu: 'Region.EU',
|
|
307
|
+
};
|
|
308
|
+
const region = options.pushNotification?.env?.region?.toLowerCase();
|
|
309
|
+
const mappedRegion = (regionMap as any)[region] || '';
|
|
310
|
+
if (!mappedRegion) {
|
|
311
|
+
console.warn(
|
|
312
|
+
`${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`
|
|
313
|
+
);
|
|
314
|
+
} else {
|
|
315
|
+
envFileContent = replaceCodeByRegex(
|
|
316
|
+
envFileContent,
|
|
317
|
+
REGION_RE,
|
|
318
|
+
mappedRegion
|
|
319
|
+
);
|
|
298
320
|
}
|
|
299
|
-
envFileContent = replaceCodeByRegex(envFileContent, REGION_RE, region);
|
|
300
321
|
}
|
|
301
322
|
|
|
302
323
|
FileManagement.writeFile(envFileName, envFileContent);
|
|
@@ -310,24 +331,47 @@ async function addPushNotificationFile(
|
|
|
310
331
|
const file = 'PushService.swift';
|
|
311
332
|
const appPath = `${iosPath}/${appName}`;
|
|
312
333
|
const getTargetFile = (filename: string) => `${appPath}/${filename}`;
|
|
334
|
+
const targetFile = getTargetFile(file);
|
|
313
335
|
|
|
336
|
+
// Check whether {file} exists in the project. If false, then add the file
|
|
337
|
+
// If {file} exists then skip and return
|
|
314
338
|
if (!FileManagement.exists(getTargetFile(file))) {
|
|
315
339
|
FileManagement.mkdir(appPath, {
|
|
316
340
|
recursive: true,
|
|
317
341
|
});
|
|
318
342
|
|
|
319
|
-
const targetFile = getTargetFile(file);
|
|
320
343
|
FileManagement.copyFile(
|
|
321
344
|
`${LOCAL_PATH_TO_CIO_NSE_FILES}/${file}`,
|
|
322
345
|
targetFile
|
|
323
346
|
);
|
|
324
347
|
} else {
|
|
325
348
|
console.log(`${getTargetFile(file)} already exists. Skipping...`);
|
|
349
|
+
return;
|
|
326
350
|
}
|
|
327
351
|
|
|
352
|
+
updatePushFile(options, targetFile);
|
|
353
|
+
|
|
328
354
|
const group = xcodeProject.pbxCreateGroup('CustomerIONotifications');
|
|
329
355
|
const classesKey = xcodeProject.findPBXGroupKey({ name: `${appName}` });
|
|
330
356
|
xcodeProject.addToPbxGroup(group, classesKey);
|
|
331
357
|
|
|
332
358
|
xcodeProject.addSourceFile(`${appName}/${file}`, null, group);
|
|
333
359
|
}
|
|
360
|
+
|
|
361
|
+
const updatePushFile = (
|
|
362
|
+
options: CustomerIOPluginOptionsIOS,
|
|
363
|
+
envFileName: string
|
|
364
|
+
) => {
|
|
365
|
+
const REGISTER_RE = /\{\{REGISTER_SNIPPET\}\}/;
|
|
366
|
+
|
|
367
|
+
let envFileContent = FileManagement.readFile(envFileName);
|
|
368
|
+
|
|
369
|
+
let snippet = '';
|
|
370
|
+
if (!options.disableNotificationRegistration) {
|
|
371
|
+
snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);
|
|
375
|
+
|
|
376
|
+
FileManagement.writeFile(envFileName, envFileContent);
|
|
377
|
+
};
|
package/src/types/cio-types.ts
CHANGED
|
@@ -15,6 +15,7 @@ export type CustomerIOPluginOptionsIOS = {
|
|
|
15
15
|
iosDeploymentTarget?: string;
|
|
16
16
|
appleTeamId?: string;
|
|
17
17
|
appName?: string;
|
|
18
|
+
disableNotificationRegistration?: boolean;
|
|
18
19
|
useFrameworks?: 'static' | 'dynamic';
|
|
19
20
|
pushNotification?: {
|
|
20
21
|
useRichPush: boolean;
|
|
@@ -29,6 +30,7 @@ export type CustomerIOPluginOptionsIOS = {
|
|
|
29
30
|
export type CustomerIOPluginOptionsAndroid = {
|
|
30
31
|
androidPath: string;
|
|
31
32
|
googleServicesFile?: string;
|
|
33
|
+
setHighPriorityPushHandler?: boolean;
|
|
32
34
|
};
|
|
33
35
|
|
|
34
36
|
export type CustomerIOPluginOptions = {
|