customerio-expo-plugin 2.0.0-beta.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -5
- package/plugin/{src/helpers/native-files/ios → lib/commonjs/helpers/native-files/ios/apn}/PushService.swift +1 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/fcm/NotificationService.swift +25 -0
- package/plugin/lib/commonjs/helpers/native-files/ios/fcm/PushService.swift +59 -0
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js +4 -4
- package/plugin/lib/commonjs/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/commonjs/ios/utils.js +17 -0
- package/plugin/lib/commonjs/ios/utils.js.map +1 -0
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js +8 -0
- package/plugin/lib/commonjs/ios/withAppDelegateModifications.js.map +1 -1
- package/plugin/lib/commonjs/ios/withCIOIos.js +2 -0
- package/plugin/lib/commonjs/ios/withCIOIos.js.map +1 -1
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js +68 -0
- package/plugin/lib/commonjs/ios/withGoogleServicesJsonFile.js.map +1 -0
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js +29 -11
- package/plugin/lib/commonjs/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/commonjs/ios/withXcodeProject.js +2 -1
- package/plugin/lib/commonjs/ios/withXcodeProject.js.map +1 -1
- package/plugin/lib/commonjs/types/cio-types.js.map +1 -1
- package/plugin/lib/{commonjs/helpers/native-files/ios → module/helpers/native-files/ios/apn}/PushService.swift +1 -0
- package/plugin/lib/module/helpers/native-files/ios/fcm/NotificationService.swift +25 -0
- package/plugin/lib/module/helpers/native-files/ios/fcm/PushService.swift +59 -0
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js +4 -4
- package/plugin/lib/module/helpers/utils/injectCIOPodfileCode.js.map +1 -1
- package/plugin/lib/module/ios/utils.js +10 -0
- package/plugin/lib/module/ios/utils.js.map +1 -0
- package/plugin/lib/module/ios/withAppDelegateModifications.js +8 -0
- package/plugin/lib/module/ios/withAppDelegateModifications.js.map +1 -1
- package/plugin/lib/module/ios/withCIOIos.js +2 -0
- package/plugin/lib/module/ios/withCIOIos.js.map +1 -1
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js +61 -0
- package/plugin/lib/module/ios/withGoogleServicesJsonFile.js.map +1 -0
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js +29 -11
- package/plugin/lib/module/ios/withNotificationsXcodeProject.js.map +1 -1
- package/plugin/lib/module/ios/withXcodeProject.js +2 -1
- package/plugin/lib/module/ios/withXcodeProject.js.map +1 -1
- package/plugin/lib/module/types/cio-types.js.map +1 -1
- package/plugin/lib/typescript/helpers/utils/injectCIOPodfileCode.d.ts +2 -2
- package/plugin/lib/typescript/ios/utils.d.ts +7 -0
- package/plugin/lib/typescript/ios/withGoogleServicesJsonFile.d.ts +3 -0
- package/plugin/lib/typescript/types/cio-types.d.ts +3 -0
- package/plugin/{lib/module/helpers/native-files/ios → src/helpers/native-files/ios/apn}/PushService.swift +1 -0
- package/plugin/src/helpers/native-files/ios/fcm/NotificationService.swift +25 -0
- package/plugin/src/helpers/native-files/ios/fcm/PushService.swift +59 -0
- package/plugin/src/helpers/utils/injectCIOPodfileCode.ts +5 -4
- package/plugin/src/ios/utils.ts +10 -0
- package/plugin/src/ios/withAppDelegateModifications.ts +15 -0
- package/plugin/src/ios/withCIOIos.ts +2 -0
- package/plugin/src/ios/withGoogleServicesJsonFile.ts +97 -0
- package/plugin/src/ios/withNotificationsXcodeProject.ts +40 -12
- package/plugin/src/ios/withXcodeProject.ts +2 -1
- package/plugin/src/types/cio-types.ts +3 -0
- /package/plugin/lib/commonjs/helpers/native-files/ios/{NotificationService.swift → apn/NotificationService.swift} +0 -0
- /package/plugin/lib/commonjs/helpers/native-files/ios/{Env.swift → common/Env.swift} +0 -0
- /package/plugin/lib/commonjs/helpers/native-files/ios/{NotificationService-Info.plist → common/NotificationService-Info.plist} +0 -0
- /package/plugin/lib/commonjs/helpers/native-files/ios/{NotificationService.h → common/NotificationService.h} +0 -0
- /package/plugin/lib/commonjs/helpers/native-files/ios/{NotificationService.m → common/NotificationService.m} +0 -0
- /package/plugin/lib/module/helpers/native-files/ios/{NotificationService.swift → apn/NotificationService.swift} +0 -0
- /package/plugin/lib/module/helpers/native-files/ios/{Env.swift → common/Env.swift} +0 -0
- /package/plugin/lib/module/helpers/native-files/ios/{NotificationService-Info.plist → common/NotificationService-Info.plist} +0 -0
- /package/plugin/lib/module/helpers/native-files/ios/{NotificationService.h → common/NotificationService.h} +0 -0
- /package/plugin/lib/module/helpers/native-files/ios/{NotificationService.m → common/NotificationService.m} +0 -0
- /package/plugin/src/helpers/native-files/ios/{NotificationService.swift → apn/NotificationService.swift} +0 -0
- /package/plugin/src/helpers/native-files/ios/{Env.swift → common/Env.swift} +0 -0
- /package/plugin/src/helpers/native-files/ios/{NotificationService-Info.plist → common/NotificationService-Info.plist} +0 -0
- /package/plugin/src/helpers/native-files/ios/{NotificationService.h → common/NotificationService.h} +0 -0
- /package/plugin/src/helpers/native-files/ios/{NotificationService.m → common/NotificationService.m} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_configPlugins","require","_ios","_codeInjection","_injectCIOPodfileCode","_fileManagement","PLIST_FILENAME","CIO_NOTIFICATION_TARGET_NAME","ENV_FILENAME","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","console","withCioNotificationsXcodeProject","configOuter","props","withXcodeProject","config","modRequest","ios","version","bundleShortVersion","appleTeamId","iosDeploymentTarget","useFrameworks","undefined","Error","projectName","platformProjectRoot","bundleIdentifier","buildNumber","bundleVersion","DEFAULT_BUNDLE_VERSION","iosPath","appName","modifiedProjectFile","modResults","exports","injectCIONotificationPodfileCode","pbxTargetByName","warn","nsePath","FileManagement","mkdir","recursive","files","getTargetFile","filename","forEach","targetFile","copyFile","LOCAL_PATH_TO_CIO_NSE_FILES","infoPlistTargetFile","updateNseInfoPlist","updateNseEnv","extGroup","addPbxGroup","groups","hash","project","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","replaceCodeByRegex","writeFile","envFileName","_options$pushNotifica2","_options$pushNotifica4","CDP_API_KEY_RE","REGION_RE","envFileContent","env","cdpApiKey","_options$pushNotifica3","region","_options$pushNotifica5","regionMap","us","eu","toLowerCase","mappedRegion","_options$pushNotifica6","file","appPath","exists","log","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","REGISTER_RE","snippet","disableNotificationRegistration","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","toUpperCase","autoTrackPushEvents","toString","showPushAppInForeground"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import {\n ConfigPlugin,\n XcodeProject,\n withXcodeProject,\n} from '@expo/config-plugins';\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 xcodeProject: XcodeProject\n) => {\n try {\n if (options.pushNotification) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush) {\n await addRichPushXcodeProj(options, xcodeProject);\n }\n return xcodeProject;\n } catch (error: any) {\n console.error(error);\n return null;\n }\n};\n\nexport const withCioNotificationsXcodeProject: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withXcodeProject(configOuter, async (config) => {\n const { modRequest, ios, version: bundleShortVersion } = config;\n const {\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 const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults\n );\n\n if (modifiedProjectFile) {\n config.modResults = modifiedProjectFile;\n }\n\n return config;\n });\n};\n\nconst addRichPushXcodeProj = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: 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 || '15.1';\n buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;\n buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';\n buildSettingsObj.SWIFT_VERSION = 4.2;\n }\n }\n\n // Add development team to the target & the main\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId, nseTarget);\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId);\n};\n\nconst updateNseInfoPlist = (payload: {\n bundleVersion?: string;\n bundleShortVersion?: string;\n infoPlistTargetFile: string;\n}) => {\n const BUNDLE_SHORT_VERSION_RE = /\\{\\{BUNDLE_SHORT_VERSION\\}\\}/;\n const BUNDLE_VERSION_RE = /\\{\\{BUNDLE_VERSION\\}\\}/;\n\n let plistFileString = FileManagement.readFile(payload.infoPlistTargetFile);\n\n if (payload.bundleVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_VERSION_RE,\n payload.bundleVersion\n );\n }\n\n if (payload.bundleShortVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_SHORT_VERSION_RE,\n payload.bundleShortVersion\n );\n }\n\n FileManagement.writeFile(payload.infoPlistTargetFile, plistFileString);\n};\n\nconst updateNseEnv = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const CDP_API_KEY_RE = /\\{\\{CDP_API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n if (options.pushNotification?.env?.cdpApiKey) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n CDP_API_KEY_RE,\n options.pushNotification?.env?.cdpApiKey\n );\n }\n\n if (options.pushNotification?.env?.region) {\n const regionMap = {\n us: 'Region.US',\n eu: 'Region.EU',\n };\n const region = options.pushNotification?.env?.region?.toLowerCase();\n const mappedRegion = (regionMap as any)[region] || '';\n if (!mappedRegion) {\n console.warn(\n `${options.pushNotification?.env?.region} is an invalid region. Please use the values from the docs: https://customer.io/docs/sdk/expo/getting-started/#configure-the-plugin`\n );\n } else {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n REGION_RE,\n mappedRegion\n );\n }\n }\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n\nasync function addPushNotificationFile(\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: any\n) {\n const { iosPath, appName } = options;\n const file = 'PushService.swift';\n const appPath = `${iosPath}/${appName}`;\n const getTargetFile = (filename: string) => `${appPath}/${filename}`;\n const targetFile = getTargetFile(file);\n\n // Check whether {file} exists in the project. If false, then add the file\n // If {file} exists then skip and return\n if (!FileManagement.exists(getTargetFile(file))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${file}`,\n targetFile\n );\n } else {\n console.log(`${getTargetFile(file)} already exists. Skipping...`);\n return;\n }\n\n updatePushFile(options, targetFile);\n\n const group = xcodeProject.pbxCreateGroup('CustomerIONotifications');\n const classesKey = xcodeProject.findPBXGroupKey({ name: `${appName}` });\n xcodeProject.addToPbxGroup(group, classesKey);\n\n xcodeProject.addSourceFile(`${appName}/${file}`, null, group);\n}\n\nconst updatePushFile = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const REGISTER_RE = /\\{\\{REGISTER_SNIPPET\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n let snippet = '';\n if (\n options.disableNotificationRegistration !== undefined &&\n options.disableNotificationRegistration === false\n ) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n if (options.pushNotification) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{CDP_API_KEY\\}\\}/,\n options.pushNotification.env.cdpApiKey\n );\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n options.pushNotification.env.region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.autoTrackPushEvents === undefined ||\n options.autoTrackPushEvents === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const showPushAppInForeground =\n options.showPushAppInForeground === undefined ||\n options.showPushAppInForeground === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAMA,IAAAC,IAAA,GAAAD,OAAA;AAMA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,eAAA,GAAAJ,OAAA;AAEA,MAAMK,cAAc,GAAG,GAAGC,iCAA4B,aAAa;AACnE,MAAMC,YAAY,GAAG,WAAW;AAEhC,MAAMC,sBAAsB,GAAG,OAAO;AAEtC,MAAMC,+BAA+B,GAAG,MAAAA,CACtCC,OAAmC,EACnCC,YAA0B,KACvB;EACH,IAAI;IAAA,IAAAC,qBAAA;IACF,IAAIF,OAAO,CAACG,gBAAgB,EAAE;MAC5B,MAAMC,uBAAuB,CAACJ,OAAO,EAAEC,YAAY,CAAC;IACtD;IAEA,KAAAC,qBAAA,GAAIF,OAAO,CAACG,gBAAgB,cAAAD,qBAAA,eAAxBA,qBAAA,CAA0BG,WAAW,EAAE;MACzC,MAAMC,oBAAoB,CAACN,OAAO,EAAEC,YAAY,CAAC;IACnD;IACA,OAAOA,YAAY;EACrB,CAAC,CAAC,OAAOM,KAAU,EAAE;IACnBC,OAAO,CAACD,KAAK,CAACA,KAAK,CAAC;IACpB,OAAO,IAAI;EACb;AACF,CAAC;AAEM,MAAME,gCAEZ,GAAGA,CAACC,WAAW,EAAEC,KAAK,KAAK;EAC1B,OAAO,IAAAC,+BAAgB,EAACF,WAAW,EAAE,MAAOG,MAAM,IAAK;IACrD,MAAM;MAAEC,UAAU;MAAEC,GAAG;MAAEC,OAAO,EAAEC;IAAmB,CAAC,GAAGJ,MAAM;IAC/D,MAAM;MACJK,WAAW;MACXC,mBAAmB;MACnBhB,gB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BAAuB,KAAK,IAAI;EAC1C7B,cAAc,GAAG,IAAAP,iCAAkB,EACjCO,cAAc,EACd,qCAAqC,EACrC6B,uBAAuB,CAACD,QAAQ,CAAC,CACnC,CAAC;EAEDhF,8BAAc,CAAC8C,SAAS,CAACC,WAAW,EAAEK,cAAc,CAAC;AACvD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_ios","_codeInjection","_injectCIOPodfileCode","_fileManagement","_utils","PLIST_FILENAME","CIO_NOTIFICATION_TARGET_NAME","ENV_FILENAME","TARGETED_DEVICE_FAMILY","addNotificationServiceExtension","options","xcodeProject","_options$pushNotifica","pushNotification","addPushNotificationFile","useRichPush","addRichPushXcodeProj","error","console","withCioNotificationsXcodeProject","configOuter","props","withXcodeProject","config","modRequest","ios","version","bundleShortVersion","appleTeamId","iosDeploymentTarget","useFrameworks","undefined","Error","projectName","platformProjectRoot","bundleIdentifier","buildNumber","bundleVersion","DEFAULT_BUNDLE_VERSION","iosPath","appName","modifiedProjectFile","modResults","exports","isFcmProvider","isFcmPushProvider","injectCIONotificationPodfileCode","pbxTargetByName","warn","nsePath","FileManagement","mkdir","recursive","platformSpecificFiles","commonFiles","getTargetFile","filename","forEach","targetFile","copyFile","LOCAL_PATH_TO_CIO_NSE_FILES","infoPlistTargetFile","updateNseInfoPlist","updateNseEnv","extGroup","addPbxGroup","groups","hash","project","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","replaceCodeByRegex","writeFile","envFileName","_options$pushNotifica2","_options$pushNotifica4","CDP_API_KEY_RE","REGION_RE","envFileContent","env","cdpApiKey","_options$pushNotifica3","region","_options$pushNotifica5","regionMap","us","eu","toLowerCase","mappedRegion","_options$pushNotifica6","sourceFile","targetFileName","appPath","exists","log","updatePushFile","group","pbxCreateGroup","classesKey","findPBXGroupKey","addSourceFile","REGISTER_RE","snippet","disableNotificationRegistration","CIO_REGISTER_PUSHNOTIFICATION_SNIPPET","toUpperCase","autoTrackPushEvents","toString","autoFetchDeviceToken","showPushAppInForeground"],"sources":["withNotificationsXcodeProject.ts"],"sourcesContent":["import {\n ConfigPlugin,\n XcodeProject,\n withXcodeProject,\n} from '@expo/config-plugins';\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';\nimport { isFcmPushProvider } from './utils';\n\nconst PLIST_FILENAME = `${CIO_NOTIFICATION_TARGET_NAME}-Info.plist`;\nconst ENV_FILENAME = 'Env.swift';\n\nconst TARGETED_DEVICE_FAMILY = `\"1,2\"`;\n\nconst addNotificationServiceExtension = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: XcodeProject\n) => {\n try {\n if (options.pushNotification) {\n await addPushNotificationFile(options, xcodeProject);\n }\n\n if (options.pushNotification?.useRichPush) {\n await addRichPushXcodeProj(options, xcodeProject);\n }\n return xcodeProject;\n } catch (error: any) {\n console.error(error);\n return null;\n }\n};\n\nexport const withCioNotificationsXcodeProject: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withXcodeProject(configOuter, async (config) => {\n const { modRequest, ios, version: bundleShortVersion } = config;\n const {\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 const modifiedProjectFile = await addNotificationServiceExtension(\n options,\n config.modResults\n );\n\n if (modifiedProjectFile) {\n config.modResults = modifiedProjectFile;\n }\n\n return config;\n });\n};\n\nconst addRichPushXcodeProj = async (\n options: CustomerIOPluginOptionsIOS,\n xcodeProject: any\n) => {\n const {\n appleTeamId,\n bundleIdentifier,\n bundleShortVersion,\n bundleVersion,\n iosPath,\n iosDeploymentTarget,\n useFrameworks,\n } = options;\n\n const isFcmProvider = isFcmPushProvider(options);\n\n await injectCIONotificationPodfileCode(iosPath, useFrameworks, isFcmProvider);\n\n // Check if `CIO_NOTIFICATION_TARGET_NAME` group already exist in the project\n // If true then skip creating a new group to avoid duplicate folders\n if (xcodeProject.pbxTargetByName(CIO_NOTIFICATION_TARGET_NAME)) {\n 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 platformSpecificFiles = [\n 'NotificationService.swift',\n ];\n\n const commonFiles = [\n PLIST_FILENAME,\n 'NotificationService.h',\n 'NotificationService.m',\n ENV_FILENAME,\n ];\n\n const getTargetFile = (filename: string) => `${nsePath}/${filename}`;\n // Copy platform-specific files\n platformSpecificFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${isFcmProvider ? \"fcm\" : \"apn\"}/${filename}`,\n targetFile\n );\n });\n\n // Copy common files\n commonFiles.forEach((filename) => {\n const targetFile = getTargetFile(filename);\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/common/${filename}`,\n targetFile\n );\n });\n\n /* MODIFY COPIED EXTENSION FILES */\n const infoPlistTargetFile = getTargetFile(PLIST_FILENAME);\n updateNseInfoPlist({\n bundleVersion,\n bundleShortVersion,\n infoPlistTargetFile,\n });\n updateNseEnv(options, getTargetFile(ENV_FILENAME));\n\n // Create new PBXGroup for the extension\n const extGroup = xcodeProject.addPbxGroup(\n [...platformSpecificFiles, ...commonFiles], // Combine platform-specific and common files,\n CIO_NOTIFICATION_TARGET_NAME,\n CIO_NOTIFICATION_TARGET_NAME\n );\n\n // Add the new PBXGroup to the top level group. This makes the\n // files / folder appear in the file explorer in Xcode.\n const groups = xcodeProject.hash.project.objects['PBXGroup'];\n Object.keys(groups).forEach((key) => {\n if (groups[key].name === undefined && groups[key].path === undefined) {\n xcodeProject.addToPbxGroup(extGroup.uuid, key);\n }\n });\n\n // WORK AROUND for codeProject.addTarget BUG\n // Xcode projects don't contain these if there is only one target\n // An upstream fix should be made to the code referenced in this link:\n // - https://github.com/apache/cordova-node-xcode/blob/8b98cabc5978359db88dc9ff2d4c015cba40f150/lib/pbxProject.js#L860\n const projObjects = xcodeProject.hash.project.objects;\n projObjects['PBXTargetDependency'] = projObjects['PBXTargetDependency'] || {};\n projObjects['PBXContainerItemProxy'] =\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 || '15.1';\n buildSettingsObj.TARGETED_DEVICE_FAMILY = TARGETED_DEVICE_FAMILY;\n buildSettingsObj.CODE_SIGN_STYLE = 'Automatic';\n buildSettingsObj.SWIFT_VERSION = 4.2;\n }\n }\n\n // Add development team to the target & the main\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId, nseTarget);\n xcodeProject.addTargetAttribute('DevelopmentTeam', appleTeamId);\n};\n\nconst updateNseInfoPlist = (payload: {\n bundleVersion?: string;\n bundleShortVersion?: string;\n infoPlistTargetFile: string;\n}) => {\n const BUNDLE_SHORT_VERSION_RE = /\\{\\{BUNDLE_SHORT_VERSION\\}\\}/;\n const BUNDLE_VERSION_RE = /\\{\\{BUNDLE_VERSION\\}\\}/;\n\n let plistFileString = FileManagement.readFile(payload.infoPlistTargetFile);\n\n if (payload.bundleVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_VERSION_RE,\n payload.bundleVersion\n );\n }\n\n if (payload.bundleShortVersion) {\n plistFileString = replaceCodeByRegex(\n plistFileString,\n BUNDLE_SHORT_VERSION_RE,\n payload.bundleShortVersion\n );\n }\n\n FileManagement.writeFile(payload.infoPlistTargetFile, plistFileString);\n};\n\nconst updateNseEnv = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const CDP_API_KEY_RE = /\\{\\{CDP_API_KEY\\}\\}/;\n const REGION_RE = /\\{\\{REGION\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n if (options.pushNotification?.env?.cdpApiKey) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n CDP_API_KEY_RE,\n options.pushNotification?.env?.cdpApiKey\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 // Maybe copy a different file with FCM config based on config\n const { iosPath, appName } = options;\n const isFcmProvider = isFcmPushProvider(options);\n // PushService.swift is platform-specific and always lives in the platform folder\n const sourceFile = `${isFcmProvider ? \"fcm\" : \"apn\"}/PushService.swift`;\n const targetFileName = 'PushService.swift';\n const appPath = `${iosPath}/${appName}`;\n const getTargetFile = (filename: string) => `${appPath}/${filename}`;\n const targetFile = getTargetFile(targetFileName);\n\n // Check whether {file} exists in the project. If false, then add the file\n // If {file} exists then skip and return\n if (!FileManagement.exists(getTargetFile(targetFileName))) {\n FileManagement.mkdir(appPath, {\n recursive: true,\n });\n\n FileManagement.copyFile(\n `${LOCAL_PATH_TO_CIO_NSE_FILES}/${sourceFile}`,\n targetFile\n );\n } else {\n console.log(`${getTargetFile(targetFileName)} already exists. Skipping...`);\n return;\n }\n\n updatePushFile(options, targetFile);\n\n const group = xcodeProject.pbxCreateGroup('CustomerIONotifications');\n const classesKey = xcodeProject.findPBXGroupKey({ name: `${appName}` });\n xcodeProject.addToPbxGroup(group, classesKey);\n\n xcodeProject.addSourceFile(`${appName}/${targetFileName}`, null, group);\n}\n\nconst updatePushFile = (\n options: CustomerIOPluginOptionsIOS,\n envFileName: string\n) => {\n const REGISTER_RE = /\\{\\{REGISTER_SNIPPET\\}\\}/;\n\n let envFileContent = FileManagement.readFile(envFileName);\n\n let snippet = '';\n if (\n options.disableNotificationRegistration !== undefined &&\n options.disableNotificationRegistration === false\n ) {\n snippet = CIO_REGISTER_PUSHNOTIFICATION_SNIPPET;\n }\n envFileContent = replaceCodeByRegex(envFileContent, REGISTER_RE, snippet);\n\n if (options.pushNotification) {\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{CDP_API_KEY\\}\\}/,\n options.pushNotification.env.cdpApiKey\n );\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{REGION\\}\\}/,\n options.pushNotification.env.region.toUpperCase()\n );\n }\n\n const autoTrackPushEvents =\n options.autoTrackPushEvents === undefined ||\n options.autoTrackPushEvents === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_TRACK_PUSH_EVENTS\\}\\}/,\n autoTrackPushEvents.toString()\n );\n\n const autoFetchDeviceToken = \n options.autoFetchDeviceToken === undefined ||\n options.autoFetchDeviceToken === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{AUTO_FETCH_DEVICE_TOKEN\\}\\}/,\n autoFetchDeviceToken.toString()\n );\n \n const showPushAppInForeground =\n options.showPushAppInForeground === undefined ||\n options.showPushAppInForeground === true;\n envFileContent = replaceCodeByRegex(\n envFileContent,\n /\\{\\{SHOW_PUSH_APP_IN_FOREGROUND\\}\\}/,\n showPushAppInForeground.toString()\n );\n\n FileManagement.writeFile(envFileName, envFileContent);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAMA,IAAAC,IAAA,GAAAD,OAAA;AAMA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAEA,MAAMM,cAAc,GAAG,GAAGC,iCAA4B,aAAa;AACnE,MAAMC,YAAY,GAAG,WAAW;AAEhC,MAAMC,sBAAsB,GAAG,OAAO;AAEtC,MAAMC,+BAA+B,GAAG,MAAAA,CACtCC,OAAmC,EACnCC,YAA0B,KACvB;EACH,IAAI;IAAA,IAAAC,qBAAA;IACF,IAAIF,OAAO,CAACG,gBAAgB,EAAE;MAC5B,MAAMC,uBAAuB,CAACJ,OAAO,EAAEC,YAAY,CAAC;IACtD;IAEA,KAAAC,qBAAA,GAAIF,OAAO,CAACG,gBAAgB,cAAAD,qBAAA,eAAxBA,qBAAA,CAA0BG,WAAW,EAAE;MACzC,MAAMC,oBAAoB,CAACN,OAAO,EAAEC,YAAY,CAAC;IACnD;IACA,OAAOA,YAAY;EACrB,CAAC,CAAC,OAAOM,KAAU,EAAE;IACnBC,OAAO,CAACD,KAAK,CAACA,KAAK,CAAC;IACpB,OAAO,IAAI;EACb;AACF,CAAC;AAEM,MAAME,gCAEZ,GAAGA,CAACC,WAAW,EAAEC,KAAK,KAAK;EAC1B,OAAO,IAAAC,+BAAg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withCioXcodeProject = void 0;
|
|
7
7
|
var _configPlugins = require("@expo/config-plugins");
|
|
8
8
|
var _injectCIOPodfileCode = require("../helpers/utils/injectCIOPodfileCode");
|
|
9
|
+
var _utils = require("./utils");
|
|
9
10
|
const withCioXcodeProject = (config, cioProps) => {
|
|
10
11
|
return (0, _configPlugins.withXcodeProject)(config, async props => {
|
|
11
12
|
var _props$ios, _props$ios2;
|
|
@@ -20,7 +21,7 @@ const withCioXcodeProject = (config, cioProps) => {
|
|
|
20
21
|
const {
|
|
21
22
|
iosPath
|
|
22
23
|
} = options;
|
|
23
|
-
await (0, _injectCIOPodfileCode.injectCIOPodfileCode)(iosPath);
|
|
24
|
+
await (0, _injectCIOPodfileCode.injectCIOPodfileCode)(iosPath, (0, _utils.isFcmPushProvider)(cioProps));
|
|
24
25
|
return props;
|
|
25
26
|
});
|
|
26
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_configPlugins","require","_injectCIOPodfileCode","withCioXcodeProject","config","cioProps","withXcodeProject","props","_props$ios","_props$ios2","options","iosPath","modRequest","platformProjectRoot","bundleIdentifier","ios","devTeam","bundleVersion","buildNumber","bundleShortVersion","version","iosDeploymentTarget","injectCIOPodfileCode","exports"],"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,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,qBAAA,GAAAD,OAAA;
|
|
1
|
+
{"version":3,"names":["_configPlugins","require","_injectCIOPodfileCode","_utils","withCioXcodeProject","config","cioProps","withXcodeProject","props","_props$ios","_props$ios2","options","iosPath","modRequest","platformProjectRoot","bundleIdentifier","ios","devTeam","bundleVersion","buildNumber","bundleShortVersion","version","iosDeploymentTarget","injectCIOPodfileCode","isFcmPushProvider","exports"],"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';\nimport { isFcmPushProvider } from './utils';\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, isFcmPushProvider(cioProps));\n\n return props;\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,qBAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAEO,MAAMG,mBAA6D,GAAGA,CAC3EC,MAAM,EACNC,QAAQ,KACL;EACH,OAAO,IAAAC,+BAAgB,EAACF,MAAM,EAAE,MAAOG,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,EAAEX,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEW,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,EAAEhB,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEgB;IACjC,CAAC;IACD,MAAM;MAAEV;IAAQ,CAAC,GAAGD,OAAO;IAE3B,MAAM,IAAAY,0CAAoB,EAACX,OAAO,EAAE,IAAAY,wBAAiB,EAAClB,QAAQ,CAAC,CAAC;IAEhE,OAAOE,KAAK;EACd,CAAC,CAAC;AACJ,CAAC;AAACiB,OAAA,CAAArB,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -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 disableNotificationRegistration?: boolean;\n /**\n * @deprecated No longer has any effect. Use autoTrackPushEvents to control if push metrics should be automatically tracked by SDK.\n */\n handleNotificationClick?: boolean;\n showPushAppInForeground?: boolean;\n autoTrackPushEvents?: boolean;\n handleDeeplinkInKilledState?: boolean;\n useFrameworks?: 'static' | 'dynamic';\n pushNotification?: {\n useRichPush: boolean;\n env: {\n cdpApiKey: 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":"","ignoreList":[]}
|
|
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 /**\n * @deprecated No longer has any effect. Use autoTrackPushEvents to control if push metrics should be automatically tracked by SDK.\n */\n handleNotificationClick?: boolean;\n showPushAppInForeground?: boolean;\n autoTrackPushEvents?: boolean;\n autoFetchDeviceToken?: boolean;\n handleDeeplinkInKilledState?: boolean;\n useFrameworks?: 'static' | 'dynamic';\n pushNotification?: {\n provider?: 'apn' | 'fcm';\n googleServicesFile?: string;\n useRichPush: boolean;\n env: {\n cdpApiKey: 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":"","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@ public class CIOAppPushNotificationsHandler : NSObject {
|
|
|
14
14
|
public func initializeCioSdk() {
|
|
15
15
|
MessagingPushAPN.initialize(
|
|
16
16
|
withConfig: MessagingPushConfigBuilder()
|
|
17
|
+
.autoFetchDeviceToken({{AUTO_FETCH_DEVICE_TOKEN}})
|
|
17
18
|
.showPushAppInForeground({{SHOW_PUSH_APP_IN_FOREGROUND}})
|
|
18
19
|
.autoTrackPushEvents({{AUTO_TRACK_PUSH_EVENTS}})
|
|
19
20
|
.build()
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import UserNotifications
|
|
3
|
+
import CioMessagingPushFCM
|
|
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
|
+
MessagingPushFCM.initializeForExtension(
|
|
13
|
+
withConfig: MessagingPushConfigBuilder(cdpApiKey: Env.customerIOCdpApiKey)
|
|
14
|
+
.region(Env.customerIORegion)
|
|
15
|
+
.build()
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
MessagingPush.shared.didReceive(request, withContentHandler: contentHandler)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@objc(serviceExtensionTimeWillExpire)
|
|
22
|
+
public func serviceExtensionTimeWillExpire() {
|
|
23
|
+
MessagingPush.shared.serviceExtensionTimeWillExpire()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import CioMessagingPushFCM
|
|
3
|
+
import FirebaseCore
|
|
4
|
+
import FirebaseMessaging
|
|
5
|
+
import UserNotifications
|
|
6
|
+
import UIKit
|
|
7
|
+
|
|
8
|
+
@objc
|
|
9
|
+
public class CIOAppPushNotificationsHandler : NSObject {
|
|
10
|
+
|
|
11
|
+
public override init() {}
|
|
12
|
+
|
|
13
|
+
{{REGISTER_SNIPPET}}
|
|
14
|
+
|
|
15
|
+
@objc(initializeCioSdk)
|
|
16
|
+
public func initializeCioSdk() {
|
|
17
|
+
if (FirebaseApp.app() == nil) {
|
|
18
|
+
FirebaseApp.configure()
|
|
19
|
+
}
|
|
20
|
+
Messaging.messaging().delegate = self
|
|
21
|
+
UIApplication.shared.registerForRemoteNotifications()
|
|
22
|
+
|
|
23
|
+
MessagingPushFCM.initialize(
|
|
24
|
+
withConfig: MessagingPushConfigBuilder()
|
|
25
|
+
.autoFetchDeviceToken({{AUTO_FETCH_DEVICE_TOKEN}})
|
|
26
|
+
.showPushAppInForeground({{SHOW_PUSH_APP_IN_FOREGROUND}})
|
|
27
|
+
.autoTrackPushEvents({{AUTO_TRACK_PUSH_EVENTS}})
|
|
28
|
+
.build()
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@objc(application:deviceToken:)
|
|
33
|
+
public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
|
34
|
+
// Do nothing for FCM version
|
|
35
|
+
// This is not needed for FCM but keeping it to prevent modification or breaking compatibility with older versions
|
|
36
|
+
// of Expo plugin
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@objc(application:error:)
|
|
40
|
+
public func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
|
|
41
|
+
// Do nothing for FCM version
|
|
42
|
+
// This is not needed for FCM but keeping it to prevent modification or breaking compatibility with older versions
|
|
43
|
+
// of Expo plugin
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
extension CIOAppPushNotificationsHandler: MessagingDelegate {
|
|
48
|
+
public func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
|
|
49
|
+
MessagingPush.shared.messaging(messaging, didReceiveRegistrationToken: fcmToken)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
func userNotificationCenter(
|
|
53
|
+
_ center: UNUserNotificationCenter,
|
|
54
|
+
willPresent notification: UNNotification,
|
|
55
|
+
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
|
|
56
|
+
) {
|
|
57
|
+
completionHandler([.list, .banner, .badge, .sound])
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getRelativePathToRNSDK } from '../constants/ios';
|
|
2
2
|
import { injectCodeByRegex } from './codeInjection';
|
|
3
3
|
import { FileManagement } from './fileManagement';
|
|
4
|
-
export async function injectCIOPodfileCode(iosPath) {
|
|
4
|
+
export async function injectCIOPodfileCode(iosPath, isFcmPushProvider) {
|
|
5
5
|
const blockStart = '# --- CustomerIO Host App START ---';
|
|
6
6
|
const blockEnd = '# --- CustomerIO Host App END ---';
|
|
7
7
|
const filename = `${iosPath}/Podfile`;
|
|
@@ -14,7 +14,7 @@ export async function injectCIOPodfileCode(iosPath) {
|
|
|
14
14
|
const lineInPodfileToInjectSnippetBefore = /post_install do \|installer\|/;
|
|
15
15
|
const snippetToInjectInPodfile = `
|
|
16
16
|
${blockStart}
|
|
17
|
-
pod 'customerio-reactnative
|
|
17
|
+
pod 'customerio-reactnative/${isFcmPushProvider ? "fcm" : "apn"}', :path => '${getRelativePathToRNSDK(iosPath)}'
|
|
18
18
|
${blockEnd}
|
|
19
19
|
`.trim();
|
|
20
20
|
FileManagement.write(filename, injectCodeByRegex(podfile, lineInPodfileToInjectSnippetBefore, snippetToInjectInPodfile).join('\n'));
|
|
@@ -22,7 +22,7 @@ ${blockEnd}
|
|
|
22
22
|
console.log('CustomerIO Podfile snippets already exists. Skipping...');
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
export async function injectCIONotificationPodfileCode(iosPath, useFrameworks) {
|
|
25
|
+
export async function injectCIONotificationPodfileCode(iosPath, useFrameworks, isFcmPushProvider) {
|
|
26
26
|
const filename = `${iosPath}/Podfile`;
|
|
27
27
|
const podfile = await FileManagement.read(filename);
|
|
28
28
|
const blockStart = '# --- CustomerIO Notification START ---';
|
|
@@ -33,7 +33,7 @@ export async function injectCIONotificationPodfileCode(iosPath, useFrameworks) {
|
|
|
33
33
|
${blockStart}
|
|
34
34
|
target 'NotificationService' do
|
|
35
35
|
${useFrameworks === 'static' ? 'use_frameworks! :linkage => :static' : ''}
|
|
36
|
-
pod 'customerio-reactnative-richpush
|
|
36
|
+
pod 'customerio-reactnative-richpush/${isFcmPushProvider ? "fcm" : "apn"}', :path => '${getRelativePathToRNSDK(iosPath)}'
|
|
37
37
|
end
|
|
38
38
|
${blockEnd}
|
|
39
39
|
`.trim();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getRelativePathToRNSDK","injectCodeByRegex","FileManagement","injectCIOPodfileCode","iosPath","blockStart","blockEnd","filename","podfile","read","matches","match","RegExp","lineInPodfileToInjectSnippetBefore","snippetToInjectInPodfile","trim","write","join","console","log","injectCIONotificationPodfileCode","useFrameworks","append"],"sources":["injectCIOPodfileCode.ts"],"sourcesContent":["import type { CustomerIOPluginOptionsIOS } from '../../types/cio-types';\nimport { getRelativePathToRNSDK } from '../constants/ios';\nimport { injectCodeByRegex } from './codeInjection';\nimport { FileManagement } from './fileManagement';\n\nexport async function injectCIOPodfileCode(iosPath: string) {\n const blockStart = '# --- CustomerIO Host App START ---';\n const blockEnd = '# --- CustomerIO Host App END ---';\n\n const filename = `${iosPath}/Podfile`;\n const podfile = await FileManagement.read(filename);\n const matches = podfile.match(new RegExp(blockStart));\n\n if (!matches) {\n // We need to decide what line of code in the Podfile to insert our native code.\n // The \"post_install\" line is always present in an Expo project Podfile so it's reliable.\n // Find that line in the Podfile and then we will insert our code above that line.\n const lineInPodfileToInjectSnippetBefore = /post_install do \\|installer\\|/;\n\n const snippetToInjectInPodfile = `\n${blockStart}\n pod 'customerio-reactnative
|
|
1
|
+
{"version":3,"names":["getRelativePathToRNSDK","injectCodeByRegex","FileManagement","injectCIOPodfileCode","iosPath","isFcmPushProvider","blockStart","blockEnd","filename","podfile","read","matches","match","RegExp","lineInPodfileToInjectSnippetBefore","snippetToInjectInPodfile","trim","write","join","console","log","injectCIONotificationPodfileCode","useFrameworks","append"],"sources":["injectCIOPodfileCode.ts"],"sourcesContent":["import type { CustomerIOPluginOptionsIOS } from '../../types/cio-types';\nimport { getRelativePathToRNSDK } from '../constants/ios';\nimport { injectCodeByRegex } from './codeInjection';\nimport { FileManagement } from './fileManagement';\n\nexport async function injectCIOPodfileCode(iosPath: string, isFcmPushProvider: boolean) {\n const blockStart = '# --- CustomerIO Host App START ---';\n const blockEnd = '# --- CustomerIO Host App END ---';\n\n const filename = `${iosPath}/Podfile`;\n const podfile = await FileManagement.read(filename);\n const matches = podfile.match(new RegExp(blockStart));\n\n if (!matches) {\n // We need to decide what line of code in the Podfile to insert our native code.\n // The \"post_install\" line is always present in an Expo project Podfile so it's reliable.\n // Find that line in the Podfile and then we will insert our code above that line.\n const lineInPodfileToInjectSnippetBefore = /post_install do \\|installer\\|/;\n\n const snippetToInjectInPodfile = `\n${blockStart}\n pod 'customerio-reactnative/${isFcmPushProvider ? \"fcm\" : \"apn\"}', :path => '${getRelativePathToRNSDK(\n iosPath\n )}'\n${blockEnd}\n`.trim();\n\n FileManagement.write(\n filename,\n injectCodeByRegex(\n podfile,\n lineInPodfileToInjectSnippetBefore,\n snippetToInjectInPodfile\n ).join('\\n')\n );\n } else {\n console.log('CustomerIO Podfile snippets already exists. Skipping...');\n }\n}\n\nexport async function injectCIONotificationPodfileCode(\n iosPath: string,\n useFrameworks: CustomerIOPluginOptionsIOS['useFrameworks'],\n isFcmPushProvider: boolean\n) {\n const filename = `${iosPath}/Podfile`;\n const podfile = await FileManagement.read(filename);\n\n const blockStart = '# --- CustomerIO Notification START ---';\n const blockEnd = '# --- CustomerIO Notification END ---';\n\n const matches = podfile.match(new RegExp(blockStart));\n\n if (!matches) {\n const snippetToInjectInPodfile = `\n${blockStart}\ntarget 'NotificationService' do\n ${useFrameworks === 'static' ? 'use_frameworks! :linkage => :static' : ''}\n pod 'customerio-reactnative-richpush/${isFcmPushProvider ? \"fcm\" : \"apn\"}', :path => '${getRelativePathToRNSDK(\n iosPath\n )}'\nend\n${blockEnd}\n`.trim();\n\n FileManagement.append(filename, snippetToInjectInPodfile);\n }\n}\n"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,OAAO,eAAeC,oBAAoBA,CAACC,OAAe,EAAEC,iBAA0B,EAAE;EACtF,MAAMC,UAAU,GAAG,qCAAqC;EACxD,MAAMC,QAAQ,GAAG,mCAAmC;EAEpD,MAAMC,QAAQ,GAAG,GAAGJ,OAAO,UAAU;EACrC,MAAMK,OAAO,GAAG,MAAMP,cAAc,CAACQ,IAAI,CAACF,QAAQ,CAAC;EACnD,MAAMG,OAAO,GAAGF,OAAO,CAACG,KAAK,CAAC,IAAIC,MAAM,CAACP,UAAU,CAAC,CAAC;EAErD,IAAI,CAACK,OAAO,EAAE;IACZ;IACA;IACA;IACA,MAAMG,kCAAkC,GAAG,+BAA+B;IAE1E,MAAMC,wBAAwB,GAAG;AACrC,EAAET,UAAU;AACZ,gCAAgCD,iBAAiB,GAAG,KAAK,GAAG,KAAK,gBAAgBL,sBAAsB,CACnGI,OACF,CAAC;AACH,EAAEG,QAAQ;AACV,CAAC,CAACS,IAAI,CAAC,CAAC;IAEJd,cAAc,CAACe,KAAK,CAClBT,QAAQ,EACRP,iBAAiB,CACfQ,OAAO,EACPK,kCAAkC,EAClCC,wBACF,CAAC,CAACG,IAAI,CAAC,IAAI,CACb,CAAC;EACH,CAAC,MAAM;IACLC,OAAO,CAACC,GAAG,CAAC,yDAAyD,CAAC;EACxE;AACF;AAEA,OAAO,eAAeC,gCAAgCA,CACpDjB,OAAe,EACfkB,aAA0D,EAC1DjB,iBAA0B,EAC1B;EACA,MAAMG,QAAQ,GAAG,GAAGJ,OAAO,UAAU;EACrC,MAAMK,OAAO,GAAG,MAAMP,cAAc,CAACQ,IAAI,CAACF,QAAQ,CAAC;EAEnD,MAAMF,UAAU,GAAG,yCAAyC;EAC5D,MAAMC,QAAQ,GAAG,uCAAuC;EAExD,MAAMI,OAAO,GAAGF,OAAO,CAACG,KAAK,CAAC,IAAIC,MAAM,CAACP,UAAU,CAAC,CAAC;EAErD,IAAI,CAACK,OAAO,EAAE;IACZ,MAAMI,wBAAwB,GAAG;AACrC,EAAET,UAAU;AACZ;AACA,IAAIgB,aAAa,KAAK,QAAQ,GAAG,qCAAqC,GAAG,EAAE;AAC3E,yCAAyCjB,iBAAiB,GAAG,KAAK,GAAG,KAAK,gBAAgBL,sBAAsB,CAC5GI,OACF,CAAC;AACH;AACA,EAAEG,QAAQ;AACV,CAAC,CAACS,IAAI,CAAC,CAAC;IAEJd,cAAc,CAACqB,MAAM,CAACf,QAAQ,EAAEO,wBAAwB,CAAC;EAC3D;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns t
|
|
3
|
+
* @param iosOptions The plugin iOS configuration options
|
|
4
|
+
* @returns true if FCM is configured to be used as push provider
|
|
5
|
+
*/
|
|
6
|
+
export const isFcmPushProvider = iosOptions => {
|
|
7
|
+
var _iosOptions$pushNotif;
|
|
8
|
+
return (iosOptions === null || iosOptions === void 0 || (_iosOptions$pushNotif = iosOptions.pushNotification) === null || _iosOptions$pushNotif === void 0 ? void 0 : _iosOptions$pushNotif.provider) === "fcm";
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isFcmPushProvider","iosOptions","_iosOptions$pushNotif","pushNotification","provider"],"sources":["utils.ts"],"sourcesContent":["import type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\n\n/**\n * Returns t\n * @param iosOptions The plugin iOS configuration options\n * @returns true if FCM is configured to be used as push provider\n */\nexport const isFcmPushProvider = (iosOptions?: CustomerIOPluginOptionsIOS): boolean => {\n return iosOptions?.pushNotification?.provider === \"fcm\";\n};"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,iBAAiB,GAAIC,UAAuC,IAAc;EAAA,IAAAC,qBAAA;EACnF,OAAO,CAAAD,UAAU,aAAVA,UAAU,gBAAAC,qBAAA,GAAVD,UAAU,CAAEE,gBAAgB,cAAAD,qBAAA,uBAA5BA,qBAAA,CAA8BE,QAAQ,MAAK,KAAK;AAC3D,CAAC","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@ import { getAppDelegateHeaderFilePath } from '@expo/config-plugins/build/ios/Pat
|
|
|
3
3
|
import { CIO_APPDELEGATEDECLARATION_REGEX, CIO_APPDELEGATEHEADER_IMPORT_SNIPPET, CIO_APPDELEGATEHEADER_REGEX, CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET, CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET, CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET, CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX, CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX, CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET, CIO_DIDFINISHLAUNCHINGMETHOD_REGEX, CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX, CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET, CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX, CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET, CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET, CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET, CIO_DEEPLINK_COMMENT_REGEX, CIO_INITIALIZECIOSDK_SNIPPET } from '../helpers/constants/ios';
|
|
4
4
|
import { injectCodeBeforeMultiLineRegex, injectCodeByLineNumber, injectCodeByMultiLineRegex, injectCodeByMultiLineRegexAndReplaceLine, replaceCodeByRegex, matchRegexExists } from '../helpers/utils/codeInjection';
|
|
5
5
|
import { FileManagement } from '../helpers/utils/fileManagement';
|
|
6
|
+
import { isFcmPushProvider } from './utils';
|
|
6
7
|
const addImport = (stringContents, appName) => {
|
|
7
8
|
const importRegex = /^(#import .*)\n/gm;
|
|
8
9
|
const addedImport = getImportSnippet(appName);
|
|
@@ -53,6 +54,10 @@ const addExpoNotificationsHeaderModification = stringContents => {
|
|
|
53
54
|
`);
|
|
54
55
|
return stringContents;
|
|
55
56
|
};
|
|
57
|
+
const addFirebaseDelegateForwardDeclarationIfNeeded = stringContents => {
|
|
58
|
+
stringContents = injectCodeByLineNumber(stringContents, 0, '@protocol FIRMessagingDelegate;');
|
|
59
|
+
return stringContents;
|
|
60
|
+
};
|
|
56
61
|
const addAppdelegateHeaderModification = stringContents => {
|
|
57
62
|
// Add UNUserNotificationCenterDelegate if needed
|
|
58
63
|
stringContents = stringContents.replace(CIO_APPDELEGATEHEADER_REGEX, (match, interfaceDeclaration, _groupedDelegates, existingDelegates) => {
|
|
@@ -118,6 +123,9 @@ export const withAppDelegateModifications = (configOuter, props) => {
|
|
|
118
123
|
}
|
|
119
124
|
stringContents = addDidFailToRegisterForRemoteNotificationsWithError(stringContents);
|
|
120
125
|
stringContents = addDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);
|
|
126
|
+
if (isFcmPushProvider(props)) {
|
|
127
|
+
stringContents = addFirebaseDelegateForwardDeclarationIfNeeded(stringContents);
|
|
128
|
+
}
|
|
121
129
|
stringContents = addExpoNotificationsHeaderModification(stringContents);
|
|
122
130
|
config.modResults.contents = stringContents;
|
|
123
131
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withAppDelegate","getAppDelegateHeaderFilePath","CIO_APPDELEGATEDECLARATION_REGEX","CIO_APPDELEGATEHEADER_IMPORT_SNIPPET","CIO_APPDELEGATEHEADER_REGEX","CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET","CIO_DEEPLINK_COMMENT_REGEX","CIO_INITIALIZECIOSDK_SNIPPET","injectCodeBeforeMultiLineRegex","injectCodeByLineNumber","injectCodeByMultiLineRegex","injectCodeByMultiLineRegexAndReplaceLine","replaceCodeByRegex","matchRegexExists","FileManagement","addImport","stringContents","appName","importRegex","addedImport","getImportSnippet","match","endOfMatchIndex","index","undefined","length","addNotificationHandlerDeclaration","addNotificationConfiguration","addInitializeNativeCioSdk","addHandleDeeplinkInKilledStateConfiguration","regex","addDidFailToRegisterForRemoteNotificationsWithError","addDidRegisterForRemoteNotificationsWithDeviceToken","addExpoNotificationsHeaderModification","addAppdelegateHeaderModification","replace","interfaceDeclaration","_groupedDelegates","existingDelegates","includes","trim","addHandleDeeplinkInKilledState","snippet","withAppDelegateModifications","configOuter","props","config","modResults","contents","RegExp","modRequest","projectName","headerPath","projectRoot","headerContent","read","write","disableNotificationRegistration","handleDeeplinkInKilledState","console","log"],"sources":["withAppDelegateModifications.ts"],"sourcesContent":["import { ConfigPlugin, withAppDelegate } from '@expo/config-plugins';\nimport { getAppDelegateHeaderFilePath } from '@expo/config-plugins/build/ios/Paths';\n\nimport {\n CIO_APPDELEGATEDECLARATION_REGEX,\n CIO_APPDELEGATEHEADER_IMPORT_SNIPPET,\n CIO_APPDELEGATEHEADER_REGEX,\n CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET,\n CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET,\n CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET,\n CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET,\n CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET,\n CIO_DEEPLINK_COMMENT_REGEX,\n CIO_INITIALIZECIOSDK_SNIPPET,\n} from '../helpers/constants/ios';\nimport {\n injectCodeBeforeMultiLineRegex,\n injectCodeByLineNumber,\n injectCodeByMultiLineRegex,\n injectCodeByMultiLineRegexAndReplaceLine,\n replaceCodeByRegex,\n matchRegexExists,\n} from '../helpers/utils/codeInjection';\nimport { FileManagement } from '../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\n\nconst addImport = (stringContents: string, appName: string) => {\n const importRegex = /^(#import .*)\\n/gm;\n const addedImport = getImportSnippet(appName);\n\n const match = stringContents.match(importRegex);\n let endOfMatchIndex: number;\n if (!match || match.index === undefined) {\n // No imports found, just add to start of file:\n endOfMatchIndex = 0;\n } else {\n // Add after first import:\n endOfMatchIndex = match.index + match[0].length;\n }\n\n stringContents = injectCodeByLineNumber(\n stringContents,\n endOfMatchIndex,\n addedImport\n );\n\n return stringContents;\n};\n\nconst addNotificationHandlerDeclaration = (stringContents: string) => {\n stringContents = injectCodeByMultiLineRegex(\n stringContents,\n CIO_APPDELEGATEDECLARATION_REGEX,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addNotificationConfiguration = (stringContents: string) => {\n stringContents = injectCodeBeforeMultiLineRegex(\n stringContents,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addInitializeNativeCioSdk = (stringContents: string) => {\n stringContents = injectCodeBeforeMultiLineRegex(\n stringContents,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_INITIALIZECIOSDK_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addHandleDeeplinkInKilledStateConfiguration = (\n stringContents: string,\n regex: RegExp\n) => {\n stringContents = injectCodeBeforeMultiLineRegex(\n stringContents,\n regex,\n CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addDidFailToRegisterForRemoteNotificationsWithError = (\n stringContents: string\n) => {\n stringContents = injectCodeByMultiLineRegexAndReplaceLine(\n stringContents,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addDidRegisterForRemoteNotificationsWithDeviceToken = (\n stringContents: string\n) => {\n stringContents = injectCodeByMultiLineRegexAndReplaceLine(\n stringContents,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET\n );\n\n return stringContents;\n};\n\n// Adds required import for Expo Notifications package in AppDelegate.\n// Required to call functions from the package.\nconst addExpoNotificationsHeaderModification = (stringContents: string) => {\n stringContents = injectCodeByLineNumber(\n stringContents,\n 0,\n `\n#if __has_include(<EXNotifications/EXNotificationCenterDelegate.h>)\n#import <EXNotifications/EXNotificationCenterDelegate.h>\n#endif\n`\n );\n\n return stringContents;\n};\n\nconst addAppdelegateHeaderModification = (stringContents: string) => {\n // Add UNUserNotificationCenterDelegate if needed\n stringContents = stringContents.replace(\n CIO_APPDELEGATEHEADER_REGEX,\n (match, interfaceDeclaration, _groupedDelegates, existingDelegates) => {\n if (\n existingDelegates &&\n existingDelegates.includes(\n CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET\n )\n ) {\n // The AppDelegate declaration already includes UNUserNotificationCenterDelegate, so we don't need to modify it\n return match;\n } else if (existingDelegates) {\n // Other delegates exist, append ours\n return `${CIO_APPDELEGATEHEADER_IMPORT_SNIPPET}\n${interfaceDeclaration}<${existingDelegates}, ${CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET}>\n`;\n } else {\n // No delegates exist, add ours\n return `${CIO_APPDELEGATEHEADER_IMPORT_SNIPPET}\n${interfaceDeclaration.trim()} <${CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET}>\n`;\n }\n }\n );\n\n return stringContents;\n};\n\nconst addHandleDeeplinkInKilledState = (stringContents: string) => {\n // Find if the deep link code snippet is already present\n if (matchRegexExists(stringContents, CIO_DEEPLINK_COMMENT_REGEX)) {\n return stringContents;\n }\n\n // Check if the app delegate is using RCTBridge or LaunchOptions\n let snippet = undefined;\n let regex = CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX;\n if (\n matchRegexExists(\n stringContents,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX\n )\n ) {\n snippet = CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET;\n regex = CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX;\n } else if (\n matchRegexExists(\n stringContents,\n CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX\n )\n ) {\n snippet = CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET;\n }\n // Add code only if the app delegate is using RCTBridge or LaunchOptions\n if (snippet !== undefined) {\n stringContents = addHandleDeeplinkInKilledStateConfiguration(\n stringContents,\n regex\n );\n stringContents = replaceCodeByRegex(stringContents, regex, snippet);\n }\n return stringContents;\n};\n\nexport const withAppDelegateModifications: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withAppDelegate(configOuter, async (config) => {\n let stringContents = config.modResults.contents;\n const regex = new RegExp(\n `#import <${config.modRequest.projectName}-Swift.h>`\n );\n const match = stringContents.match(regex);\n\n if (!match) {\n const headerPath = getAppDelegateHeaderFilePath(\n config.modRequest.projectRoot\n );\n let headerContent = await FileManagement.read(headerPath);\n headerContent = addAppdelegateHeaderModification(headerContent);\n FileManagement.write(headerPath, headerContent);\n\n stringContents = addImport(\n stringContents,\n config.modRequest.projectName as string\n );\n stringContents = addNotificationHandlerDeclaration(stringContents);\n\n // any other value would be treated as true, it has to be explicitly false to disable\n if (\n props.disableNotificationRegistration !== undefined &&\n props.disableNotificationRegistration === false\n ) {\n stringContents = addNotificationConfiguration(stringContents);\n }\n\n stringContents = addInitializeNativeCioSdk(stringContents);\n\n if (\n props.handleDeeplinkInKilledState !== undefined &&\n props.handleDeeplinkInKilledState === true\n ) {\n stringContents = addHandleDeeplinkInKilledState(stringContents);\n }\n\n stringContents =\n addDidFailToRegisterForRemoteNotificationsWithError(stringContents);\n stringContents =\n addDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);\n\n stringContents = addExpoNotificationsHeaderModification(stringContents);\n\n config.modResults.contents = stringContents;\n } else {\n console.log('Customerio AppDelegate changes already exist. Skipping...');\n }\n\n return config;\n });\n};\nfunction getImportSnippet(appName: string) {\n return `\n// Add swift bridge imports\n#import <ExpoModulesCore-Swift.h>\n#import <${appName}-Swift.h>\n `;\n}\n"],"mappings":"AAAA,SAAuBA,eAAe,QAAQ,sBAAsB;AACpE,SAASC,4BAA4B,QAAQ,sCAAsC;AAEnF,SACEC,gCAAgC,EAChCC,oCAAoC,EACpCC,2BAA2B,EAC3BC,sDAAsD,EACtDC,2CAA2C,EAC3CC,yCAAyC,EACzCC,4CAA4C,EAC5CC,0DAA0D,EAC1DC,4DAA4D,EAC5DC,kCAAkC,EAClCC,0DAA0D,EAC1DC,4DAA4D,EAC5DC,gDAAgD,EAChDC,8CAA8C,EAC9CC,yCAAyC,EACzCC,8CAA8C,EAC9CC,0BAA0B,EAC1BC,4BAA4B,QACvB,0BAA0B;AACjC,SACEC,8BAA8B,EAC9BC,sBAAsB,EACtBC,0BAA0B,EAC1BC,wCAAwC,EACxCC,kBAAkB,EAClBC,gBAAgB,QACX,gCAAgC;AACvC,SAASC,cAAc,QAAQ,iCAAiC;AAGhE,MAAMC,SAAS,GAAGA,CAACC,cAAsB,EAAEC,OAAe,KAAK;EAC7D,MAAMC,WAAW,GAAG,mBAAmB;EACvC,MAAMC,WAAW,GAAGC,gBAAgB,CAACH,OAAO,CAAC;EAE7C,MAAMI,KAAK,GAAGL,cAAc,CAACK,KAAK,CAACH,WAAW,CAAC;EAC/C,IAAII,eAAuB;EAC3B,IAAI,CAACD,KAAK,IAAIA,KAAK,CAACE,KAAK,KAAKC,SAAS,EAAE;IACvC;IACAF,eAAe,GAAG,CAAC;EACrB,CAAC,MAAM;IACL;IACAA,eAAe,GAAGD,KAAK,CAACE,KAAK,GAAGF,KAAK,CAAC,CAAC,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A,cAAc,GAAGiB,sCAAsC,CAACjB,cAAc,CAAC;MAEvE8B,MAAM,CAACC,UAAU,CAACC,QAAQ,GAAGhC,cAAc;IAC7C,CAAC,MAAM;MACL2C,OAAO,CAACC,GAAG,CAAC,2DAA2D,CAAC;IAC1E;IAEA,OAAOd,MAAM;EACf,CAAC,CAAC;AACJ,CAAC;AACD,SAAS1B,gBAAgBA,CAACH,OAAe,EAAE;EACzC,OAAO;AACT;AACA;AACA,WAAWA,OAAO;AAClB,GAAG;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["withAppDelegate","getAppDelegateHeaderFilePath","CIO_APPDELEGATEDECLARATION_REGEX","CIO_APPDELEGATEHEADER_IMPORT_SNIPPET","CIO_APPDELEGATEHEADER_REGEX","CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET","CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET","CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX","CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET","CIO_DIDFINISHLAUNCHINGMETHOD_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX","CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET","CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX","CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET","CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET","CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET","CIO_DEEPLINK_COMMENT_REGEX","CIO_INITIALIZECIOSDK_SNIPPET","injectCodeBeforeMultiLineRegex","injectCodeByLineNumber","injectCodeByMultiLineRegex","injectCodeByMultiLineRegexAndReplaceLine","replaceCodeByRegex","matchRegexExists","FileManagement","isFcmPushProvider","addImport","stringContents","appName","importRegex","addedImport","getImportSnippet","match","endOfMatchIndex","index","undefined","length","addNotificationHandlerDeclaration","addNotificationConfiguration","addInitializeNativeCioSdk","addHandleDeeplinkInKilledStateConfiguration","regex","addDidFailToRegisterForRemoteNotificationsWithError","addDidRegisterForRemoteNotificationsWithDeviceToken","addExpoNotificationsHeaderModification","addFirebaseDelegateForwardDeclarationIfNeeded","addAppdelegateHeaderModification","replace","interfaceDeclaration","_groupedDelegates","existingDelegates","includes","trim","addHandleDeeplinkInKilledState","snippet","withAppDelegateModifications","configOuter","props","config","modResults","contents","RegExp","modRequest","projectName","headerPath","projectRoot","headerContent","read","write","disableNotificationRegistration","handleDeeplinkInKilledState","console","log"],"sources":["withAppDelegateModifications.ts"],"sourcesContent":["import { ConfigPlugin, withAppDelegate } from '@expo/config-plugins';\nimport { getAppDelegateHeaderFilePath } from '@expo/config-plugins/build/ios/Paths';\n\nimport {\n CIO_APPDELEGATEDECLARATION_REGEX,\n CIO_APPDELEGATEHEADER_IMPORT_SNIPPET,\n CIO_APPDELEGATEHEADER_REGEX,\n CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET,\n CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET,\n CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET,\n CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET,\n CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET,\n CIO_DEEPLINK_COMMENT_REGEX,\n CIO_INITIALIZECIOSDK_SNIPPET,\n} from '../helpers/constants/ios';\nimport {\n injectCodeBeforeMultiLineRegex,\n injectCodeByLineNumber,\n injectCodeByMultiLineRegex,\n injectCodeByMultiLineRegexAndReplaceLine,\n replaceCodeByRegex,\n matchRegexExists,\n} from '../helpers/utils/codeInjection';\nimport { FileManagement } from '../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { isFcmPushProvider } from './utils';\n\nconst addImport = (stringContents: string, appName: string) => {\n const importRegex = /^(#import .*)\\n/gm;\n const addedImport = getImportSnippet(appName);\n\n const match = stringContents.match(importRegex);\n let endOfMatchIndex: number;\n if (!match || match.index === undefined) {\n // No imports found, just add to start of file:\n endOfMatchIndex = 0;\n } else {\n // Add after first import:\n endOfMatchIndex = match.index + match[0].length;\n }\n\n stringContents = injectCodeByLineNumber(\n stringContents,\n endOfMatchIndex,\n addedImport\n );\n\n return stringContents;\n};\n\nconst addNotificationHandlerDeclaration = (stringContents: string) => {\n stringContents = injectCodeByMultiLineRegex(\n stringContents,\n CIO_APPDELEGATEDECLARATION_REGEX,\n CIO_PUSHNOTIFICATIONHANDLERDECLARATION_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addNotificationConfiguration = (stringContents: string) => {\n stringContents = injectCodeBeforeMultiLineRegex(\n stringContents,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_CONFIGURECIOSDKPUSHNOTIFICATION_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addInitializeNativeCioSdk = (stringContents: string) => {\n stringContents = injectCodeBeforeMultiLineRegex(\n stringContents,\n CIO_DIDFINISHLAUNCHINGMETHOD_REGEX,\n CIO_INITIALIZECIOSDK_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addHandleDeeplinkInKilledStateConfiguration = (\n stringContents: string,\n regex: RegExp\n) => {\n stringContents = injectCodeBeforeMultiLineRegex(\n stringContents,\n regex,\n CIO_CONFIGUREDEEPLINK_KILLEDSTATE_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addDidFailToRegisterForRemoteNotificationsWithError = (\n stringContents: string\n) => {\n stringContents = injectCodeByMultiLineRegexAndReplaceLine(\n stringContents,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_REGEX,\n CIO_DIDFAILTOREGISTERFORREMOTENOTIFICATIONSWITHERROR_SNIPPET\n );\n\n return stringContents;\n};\n\nconst addDidRegisterForRemoteNotificationsWithDeviceToken = (\n stringContents: string\n) => {\n stringContents = injectCodeByMultiLineRegexAndReplaceLine(\n stringContents,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_REGEX,\n CIO_DIDREGISTERFORREMOTENOTIFICATIONSWITHDEVICETOKEN_SNIPPET\n );\n\n return stringContents;\n};\n\n// Adds required import for Expo Notifications package in AppDelegate.\n// Required to call functions from the package.\nconst addExpoNotificationsHeaderModification = (stringContents: string) => {\n stringContents = injectCodeByLineNumber(\n stringContents,\n 0,\n `\n#if __has_include(<EXNotifications/EXNotificationCenterDelegate.h>)\n#import <EXNotifications/EXNotificationCenterDelegate.h>\n#endif\n`\n );\n\n return stringContents;\n};\n\nconst addFirebaseDelegateForwardDeclarationIfNeeded = (stringContents: string) => {\n stringContents = injectCodeByLineNumber(\n stringContents,\n 0,\n '@protocol FIRMessagingDelegate;'\n );\n\n return stringContents;\n};\n\nconst addAppdelegateHeaderModification = (stringContents: string) => {\n // Add UNUserNotificationCenterDelegate if needed\n stringContents = stringContents.replace(\n CIO_APPDELEGATEHEADER_REGEX,\n (match, interfaceDeclaration, _groupedDelegates, existingDelegates) => {\n if (\n existingDelegates &&\n existingDelegates.includes(\n CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET\n )\n ) {\n // The AppDelegate declaration already includes UNUserNotificationCenterDelegate, so we don't need to modify it\n return match;\n } else if (existingDelegates) {\n // Other delegates exist, append ours\n return `${CIO_APPDELEGATEHEADER_IMPORT_SNIPPET}\n${interfaceDeclaration}<${existingDelegates}, ${CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET}>\n`;\n } else {\n // No delegates exist, add ours\n return `${CIO_APPDELEGATEHEADER_IMPORT_SNIPPET}\n${interfaceDeclaration.trim()} <${CIO_APPDELEGATEHEADER_USER_NOTIFICATION_CENTER_SNIPPET}>\n`;\n }\n }\n );\n\n return stringContents;\n};\n\nconst addHandleDeeplinkInKilledState = (stringContents: string) => {\n // Find if the deep link code snippet is already present\n if (matchRegexExists(stringContents, CIO_DEEPLINK_COMMENT_REGEX)) {\n return stringContents;\n }\n\n // Check if the app delegate is using RCTBridge or LaunchOptions\n let snippet = undefined;\n let regex = CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX;\n if (\n matchRegexExists(\n stringContents,\n CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX\n )\n ) {\n snippet = CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_SNIPPET;\n regex = CIO_RCTBRIDGE_DEEPLINK_MODIFIEDOPTIONS_REGEX;\n } else if (\n matchRegexExists(\n stringContents,\n CIO_LAUNCHOPTIONS_DEEPLINK_MODIFIEDOPTIONS_REGEX\n )\n ) {\n snippet = CIO_LAUNCHOPTIONS_MODIFIEDOPTIONS_SNIPPET;\n }\n // Add code only if the app delegate is using RCTBridge or LaunchOptions\n if (snippet !== undefined) {\n stringContents = addHandleDeeplinkInKilledStateConfiguration(\n stringContents,\n regex\n );\n stringContents = replaceCodeByRegex(stringContents, regex, snippet);\n }\n return stringContents;\n};\n\nexport const withAppDelegateModifications: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (configOuter, props) => {\n return withAppDelegate(configOuter, async (config) => {\n let stringContents = config.modResults.contents;\n const regex = new RegExp(\n `#import <${config.modRequest.projectName}-Swift.h>`\n );\n const match = stringContents.match(regex);\n\n if (!match) {\n const headerPath = getAppDelegateHeaderFilePath(\n config.modRequest.projectRoot\n );\n let headerContent = await FileManagement.read(headerPath);\n headerContent = addAppdelegateHeaderModification(headerContent);\n FileManagement.write(headerPath, headerContent);\n\n stringContents = addImport(\n stringContents,\n config.modRequest.projectName as string\n );\n stringContents = addNotificationHandlerDeclaration(stringContents);\n\n // any other value would be treated as true, it has to be explicitly false to disable\n if (\n props.disableNotificationRegistration !== undefined &&\n props.disableNotificationRegistration === false\n ) {\n stringContents = addNotificationConfiguration(stringContents);\n }\n\n stringContents = addInitializeNativeCioSdk(stringContents);\n\n if (\n props.handleDeeplinkInKilledState !== undefined &&\n props.handleDeeplinkInKilledState === true\n ) {\n stringContents = addHandleDeeplinkInKilledState(stringContents);\n }\n\n stringContents =\n addDidFailToRegisterForRemoteNotificationsWithError(stringContents);\n stringContents =\n addDidRegisterForRemoteNotificationsWithDeviceToken(stringContents);\n\n if (isFcmPushProvider(props)) {\n stringContents = addFirebaseDelegateForwardDeclarationIfNeeded(stringContents);\n } \n\n stringContents = addExpoNotificationsHeaderModification(stringContents);\n\n config.modResults.contents = stringContents;\n } else {\n console.log('Customerio AppDelegate changes already exist. Skipping...');\n }\n\n return config;\n });\n};\nfunction getImportSnippet(appName: string) {\n return `\n// Add swift bridge imports\n#import <ExpoModulesCore-Swift.h>\n#import <${appName}-Swift.h>\n `;\n}\n"],"mappings":"AAAA,SAAuBA,eAAe,QAAQ,sBAAsB;AACpE,SAASC,4BAA4B,QAAQ,sCAAsC;AAEnF,SACEC,gCAAgC,EAChCC,oCAAoC,EACpCC,2BAA2B,EAC3BC,sDAAsD,EACtDC,2CAA2C,EAC3CC,yCAAyC,EACzCC,4CAA4C,EAC5CC,0DAA0D,EAC1DC,4DAA4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,CAAC;AACD,SAAS3B,gBAAgBA,CAACH,OAAe,EAAE;EACzC,OAAO;AACT;AACA;AACA,WAAWA,OAAO;AAClB,GAAG;AACH","ignoreList":[]}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { withAppDelegateModifications } from './withAppDelegateModifications';
|
|
2
2
|
import { withCioNotificationsXcodeProject } from './withNotificationsXcodeProject';
|
|
3
3
|
import { withCioXcodeProject } from './withXcodeProject';
|
|
4
|
+
import { withGoogleServicesJsonFile } from './withGoogleServicesJsonFile';
|
|
4
5
|
export function withCIOIos(config, props) {
|
|
5
6
|
if (props.pushNotification) {
|
|
6
7
|
config = withAppDelegateModifications(config, props);
|
|
7
8
|
config = withCioNotificationsXcodeProject(config, props);
|
|
8
9
|
config = withCioXcodeProject(config, props);
|
|
10
|
+
config = withGoogleServicesJsonFile(config, props);
|
|
9
11
|
}
|
|
10
12
|
return config;
|
|
11
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withAppDelegateModifications","withCioNotificationsXcodeProject","withCioXcodeProject","withCIOIos","config","props","pushNotification"],"sources":["withCIOIos.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { withAppDelegateModifications } from './withAppDelegateModifications';\nimport { withCioNotificationsXcodeProject } from './withNotificationsXcodeProject';\nimport { withCioXcodeProject } from './withXcodeProject';\n\nexport function withCIOIos(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsIOS\n) {\n if (props.pushNotification) {\n config = withAppDelegateModifications(config, props);\n config = withCioNotificationsXcodeProject(config, props);\n config = withCioXcodeProject(config, props);\n }\n\n return config;\n}\n"],"mappings":"AAGA,SAASA,4BAA4B,QAAQ,gCAAgC;AAC7E,SAASC,gCAAgC,QAAQ,iCAAiC;AAClF,SAASC,mBAAmB,QAAQ,oBAAoB;
|
|
1
|
+
{"version":3,"names":["withAppDelegateModifications","withCioNotificationsXcodeProject","withCioXcodeProject","withGoogleServicesJsonFile","withCIOIos","config","props","pushNotification"],"sources":["withCIOIos.ts"],"sourcesContent":["import type { ExpoConfig } from '@expo/config-types';\n\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { withAppDelegateModifications } from './withAppDelegateModifications';\nimport { withCioNotificationsXcodeProject } from './withNotificationsXcodeProject';\nimport { withCioXcodeProject } from './withXcodeProject';\nimport { withGoogleServicesJsonFile } from './withGoogleServicesJsonFile';\n\nexport function withCIOIos(\n config: ExpoConfig,\n props: CustomerIOPluginOptionsIOS\n) {\n if (props.pushNotification) {\n config = withAppDelegateModifications(config, props);\n config = withCioNotificationsXcodeProject(config, props);\n config = withCioXcodeProject(config, props);\n config = withGoogleServicesJsonFile(config, props);\n }\n\n return config;\n}\n"],"mappings":"AAGA,SAASA,4BAA4B,QAAQ,gCAAgC;AAC7E,SAASC,gCAAgC,QAAQ,iCAAiC;AAClF,SAASC,mBAAmB,QAAQ,oBAAoB;AACxD,SAASC,0BAA0B,QAAQ,8BAA8B;AAEzE,OAAO,SAASC,UAAUA,CACxBC,MAAkB,EAClBC,KAAiC,EACjC;EACA,IAAIA,KAAK,CAACC,gBAAgB,EAAE;IAC1BF,MAAM,GAAGL,4BAA4B,CAACK,MAAM,EAAEC,KAAK,CAAC;IACpDD,MAAM,GAAGJ,gCAAgC,CAACI,MAAM,EAAEC,KAAK,CAAC;IACxDD,MAAM,GAAGH,mBAAmB,CAACG,MAAM,EAAEC,KAAK,CAAC;IAC3CD,MAAM,GAAGF,0BAA0B,CAACE,MAAM,EAAEC,KAAK,CAAC;EACpD;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { withXcodeProject, IOSConfig } from '@expo/config-plugins';
|
|
2
|
+
import { FileManagement } from './../helpers/utils/fileManagement';
|
|
3
|
+
import { isFcmPushProvider } from './utils';
|
|
4
|
+
export const withGoogleServicesJsonFile = (config, cioProps) => {
|
|
5
|
+
return withXcodeProject(config, async props => {
|
|
6
|
+
var _cioProps$pushNotific;
|
|
7
|
+
const useFcm = isFcmPushProvider(cioProps);
|
|
8
|
+
if (!useFcm) {
|
|
9
|
+
// Nothing to do, for providers other than FCM, the Google services JSON file isn't needed
|
|
10
|
+
return props;
|
|
11
|
+
}
|
|
12
|
+
console.log('Only specify Customer.io ios.pushNotification.googleServicesFile config if you are not already including' + ' GoogleService-Info.plist as part of Firebase integration');
|
|
13
|
+
|
|
14
|
+
// googleServicesFile
|
|
15
|
+
const iosPath = props.modRequest.platformProjectRoot;
|
|
16
|
+
const googleServicesFile = (_cioProps$pushNotific = cioProps.pushNotification) === null || _cioProps$pushNotific === void 0 ? void 0 : _cioProps$pushNotific.googleServicesFile;
|
|
17
|
+
const appName = props.modRequest.projectName;
|
|
18
|
+
if (FileManagement.exists(`${iosPath}/GoogleService-Info.plist`)) {
|
|
19
|
+
console.log(`File already exists: ${iosPath}/GoogleService-Info.plist. Skipping...`);
|
|
20
|
+
return props;
|
|
21
|
+
}
|
|
22
|
+
if (FileManagement.exists(`${iosPath}/${appName}/GoogleService-Info.plist`)) {
|
|
23
|
+
// This is where RN Firebase potentially copies GoogleService-Info.plist
|
|
24
|
+
// Do not copy if it's already done by Firebase to avoid conflict in Resources
|
|
25
|
+
console.log(`File already exists: ${iosPath}/${appName}/GoogleService-Info.plist. Skipping...`);
|
|
26
|
+
return props;
|
|
27
|
+
}
|
|
28
|
+
if (googleServicesFile && FileManagement.exists(googleServicesFile)) {
|
|
29
|
+
var _config$ios;
|
|
30
|
+
if ((_config$ios = config.ios) !== null && _config$ios !== void 0 && _config$ios.googleServicesFile) {
|
|
31
|
+
console.warn('Specifying both Expo ios.googleServicesFile and Customer.io ios.pushNotification.googleServicesFile can cause a conflict' + ' duplicating GoogleService-Info.plist in the iOS project resources. Please remove Customer.io ios.pushNotification.googleServicesFile');
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
FileManagement.copyFile(googleServicesFile, `${iosPath}/GoogleService-Info.plist`);
|
|
35
|
+
addFileToXcodeProject(props.modResults, 'GoogleService-Info.plist');
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.error(`There was an error copying your GoogleService-Info.plist file. You can copy it manually into ${iosPath}/GoogleService-Info.plist`);
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
console.error(`The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${iosPath}/GoogleService-Info.plist`);
|
|
41
|
+
}
|
|
42
|
+
return props;
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
function addFileToXcodeProject(project, fileName) {
|
|
46
|
+
const groupName = 'Resources';
|
|
47
|
+
const filepath = fileName;
|
|
48
|
+
if (!IOSConfig.XcodeUtils.ensureGroupRecursively(project, groupName)) {
|
|
49
|
+
console.error(`Error copying GoogleService-Info.plist. Failed to find or create '${groupName}' group in Xcode.`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Add GoogleService-Info.plist to the Xcode project
|
|
54
|
+
IOSConfig.XcodeUtils.addResourceFileToGroup({
|
|
55
|
+
project,
|
|
56
|
+
filepath,
|
|
57
|
+
groupName,
|
|
58
|
+
isBuildFile: true
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=withGoogleServicesJsonFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withXcodeProject","IOSConfig","FileManagement","isFcmPushProvider","withGoogleServicesJsonFile","config","cioProps","props","_cioProps$pushNotific","useFcm","console","log","iosPath","modRequest","platformProjectRoot","googleServicesFile","pushNotification","appName","projectName","exists","_config$ios","ios","warn","copyFile","addFileToXcodeProject","modResults","e","error","project","fileName","groupName","filepath","XcodeUtils","ensureGroupRecursively","addResourceFileToGroup","isBuildFile"],"sources":["withGoogleServicesJsonFile.ts"],"sourcesContent":["import {\n withXcodeProject,\n IOSConfig,\n ConfigPlugin,\n} from '@expo/config-plugins';\n\nimport { FileManagement } from './../helpers/utils/fileManagement';\nimport type { CustomerIOPluginOptionsIOS } from '../types/cio-types';\nimport { isFcmPushProvider } from './utils';\n\nexport const withGoogleServicesJsonFile: ConfigPlugin<\n CustomerIOPluginOptionsIOS\n> = (config, cioProps) => {\n return withXcodeProject(config, async (props) => {\n const useFcm = isFcmPushProvider(cioProps);\n if (!useFcm) {\n // Nothing to do, for providers other than FCM, the Google services JSON file isn't needed\n return props;\n }\n\n console.log(\n 'Only specify Customer.io ios.pushNotification.googleServicesFile config if you are not already including' +\n ' GoogleService-Info.plist as part of Firebase integration'\n );\n\n // googleServicesFile\n const iosPath = props.modRequest.platformProjectRoot;\n const googleServicesFile = cioProps.pushNotification?.googleServicesFile;\n const appName = props.modRequest.projectName;\n\n if (FileManagement.exists(`${iosPath}/GoogleService-Info.plist`)) {\n console.log(\n `File already exists: ${iosPath}/GoogleService-Info.plist. Skipping...`\n );\n return props;\n }\n\n if (\n FileManagement.exists(`${iosPath}/${appName}/GoogleService-Info.plist`)\n ) {\n // This is where RN Firebase potentially copies GoogleService-Info.plist\n // Do not copy if it's already done by Firebase to avoid conflict in Resources\n console.log(\n `File already exists: ${iosPath}/${appName}/GoogleService-Info.plist. Skipping...`\n );\n return props;\n }\n\n if (googleServicesFile && FileManagement.exists(googleServicesFile)) {\n if (config.ios?.googleServicesFile) {\n console.warn(\n 'Specifying both Expo ios.googleServicesFile and Customer.io ios.pushNotification.googleServicesFile can cause a conflict' +\n ' duplicating GoogleService-Info.plist in the iOS project resources. Please remove Customer.io ios.pushNotification.googleServicesFile'\n );\n }\n\n try {\n FileManagement.copyFile(\n googleServicesFile,\n `${iosPath}/GoogleService-Info.plist`\n );\n\n addFileToXcodeProject(props.modResults, 'GoogleService-Info.plist');\n } catch (e) {\n console.error(\n `There was an error copying your GoogleService-Info.plist file. You can copy it manually into ${iosPath}/GoogleService-Info.plist`\n );\n }\n } else {\n console.error(\n `The Google Services file provided in ${googleServicesFile} doesn't seem to exist. You can copy it manually into ${iosPath}/GoogleService-Info.plist`\n );\n }\n\n return props;\n });\n};\n\nfunction addFileToXcodeProject(project: any, fileName: string) {\n const groupName = 'Resources';\n const filepath = fileName;\n\n if (!IOSConfig.XcodeUtils.ensureGroupRecursively(project, groupName)) {\n console.error(\n `Error copying GoogleService-Info.plist. Failed to find or create '${groupName}' group in Xcode.`\n );\n return;\n }\n\n // Add GoogleService-Info.plist to the Xcode project\n IOSConfig.XcodeUtils.addResourceFileToGroup({\n project,\n filepath,\n groupName,\n isBuildFile: true,\n });\n}\n"],"mappings":"AAAA,SACEA,gBAAgB,EAChBC,SAAS,QAEJ,sBAAsB;AAE7B,SAASC,cAAc,QAAQ,mCAAmC;AAElE,SAASC,iBAAiB,QAAQ,SAAS;AAE3C,OAAO,MAAMC,0BAEZ,GAAGA,CAACC,MAAM,EAAEC,QAAQ,KAAK;EACxB,OAAON,gBAAgB,CAACK,MAAM,EAAE,MAAOE,KAAK,IAAK;IAAA,IAAAC,qBAAA;IAC/C,MAAMC,MAAM,GAAGN,iBAAiB,CAACG,QAAQ,CAAC;IAC1C,IAAI,CAACG,MAAM,EAAE;MACX;MACA,OAAOF,KAAK;IACd;IAEAG,OAAO,CAACC,GAAG,CACT,0GAA0G,GACxG,2DACJ,CAAC;;IAED;IACA,MAAMC,OAAO,GAAGL,KAAK,CAACM,UAAU,CAACC,mBAAmB;IACpD,MAAMC,kBAAkB,IAAAP,qBAAA,GAAGF,QAAQ,CAACU,gBAAgB,cAAAR,qBAAA,uBAAzBA,qBAAA,CAA2BO,kBAAkB;IACxE,MAAME,OAAO,GAAGV,KAAK,CAACM,UAAU,CAACK,WAAW;IAE5C,IAAIhB,cAAc,CAACiB,MAAM,CAAC,GAAGP,OAAO,2BAA2B,CAAC,EAAE;MAChEF,OAAO,CAACC,GAAG,CACT,wBAAwBC,OAAO,wCACjC,CAAC;MACD,OAAOL,KAAK;IACd;IAEA,IACEL,cAAc,CAACiB,MAAM,CAAC,GAAGP,OAAO,IAAIK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