From e8c0c48d15a153c3aed95974c1c2fcb8b472cb85 Mon Sep 17 00:00:00 2001 From: Ulrich GIBERNE Date: Fri, 20 Dec 2024 11:31:17 -0400 Subject: [PATCH 1/2] add support for Airship Extender --- plugin/src/withAirship.ts | 6 +- plugin/src/withAirshipAndroid.ts | 75 +++++++++- plugin/src/withAirshipIOS.ts | 84 ++++++++++++ yarn.lock | 227 ++++++++++++++++++++++++++++--- 4 files changed, 371 insertions(+), 21 deletions(-) diff --git a/plugin/src/withAirship.ts b/plugin/src/withAirship.ts index a062b86..fd6edee 100644 --- a/plugin/src/withAirship.ts +++ b/plugin/src/withAirship.ts @@ -15,6 +15,8 @@ export type AirshipAndroidPluginProps = { * Optional. The local path to a Custom Notification Channels resource file. */ customNotificationChannels?: string; + + airshipExtender?: string; }; export type AirshipIOSPluginProps = { @@ -23,7 +25,7 @@ export type AirshipIOSPluginProps = { */ mode: 'development' | 'production'; /** - * Optional. The local path to a custom Notification Service Extension. + * Optional. The local path to a custom Notification Service Extension or "DEFAULT_AIRSHIP_SERVICE_EXTENSION" for Airship's default one. */ notificationService?: 'DEFAULT_AIRSHIP_SERVICE_EXTENSION' | string; /** @@ -39,6 +41,8 @@ export type AirshipIOSPluginProps = { * Optional. The Apple Development Team ID used to configure the Notification Service Extension target. */ developmentTeamID?: string; + + airshipExtender?: string; } export type AirshipPluginProps = { diff --git a/plugin/src/withAirshipAndroid.ts b/plugin/src/withAirshipAndroid.ts index c78d160..784652b 100644 --- a/plugin/src/withAirshipAndroid.ts +++ b/plugin/src/withAirshipAndroid.ts @@ -1,13 +1,17 @@ import { ConfigPlugin, + AndroidConfig, withDangerousMod, - withProjectBuildGradle + withProjectBuildGradle, + withAndroidManifest } from '@expo/config-plugins'; import { generateImageAsync, ImageOptions } from '@expo/image-utils'; import { readFile, writeFileSync, existsSync, mkdirSync } from 'fs'; import { resolve, basename, join } from 'path'; +import assert from 'assert'; + import { AirshipAndroidPluginProps } from './withAirship'; const iconSizeMap: Record = { @@ -20,6 +24,10 @@ const iconSizeMap: Record = { const NOTIFICATIONS_CHANNELS_FILE_NAME = "ua_custom_notification_channels.xml"; +const AIRSHP_PLUGIN_EXTENDER_CLASS_NAME = "AirshipExtender"; + +const { addMetaDataItemToMainApplication, getMainApplicationOrThrow } = AndroidConfig.Manifest; + async function writeNotificationIconImageFilesAsync(props: AirshipAndroidPluginProps, projectRoot: string) { const fileName = basename(props.icon) await Promise.all( @@ -84,7 +92,6 @@ const withCustomNotificationChannels: ConfigPlugin = ]); } -// TODO copy the file from assets to xml res async function writeNotificationChannelsFileAsync(props: AirshipAndroidPluginProps, projectRoot: string) { if (!props.customNotificationChannels) { return; @@ -107,9 +114,73 @@ async function writeNotificationChannelsFileAsync(props: AirshipAndroidPluginPro }); }; +const withAirshipExtender: ConfigPlugin = (config, props) => { + return withDangerousMod(config, [ + 'android', + async config => { + assert(config.android?.package, "Missing 'android.package' in app config.") + await writeAirshipExtenderFileAsync(props, config.modRequest.projectRoot, config.android.package); + return config; + }, + ]); +} + +async function writeAirshipExtenderFileAsync(props: AirshipAndroidPluginProps, projectRoot: string, packageName: string) { + if (!props.airshipExtender) { + return; + } + + const fileName = basename(props.airshipExtender) + const extenderDestinationPath = join(projectRoot, "android/app/src/main/java", packageName.split('.').join('/')); + + if (!existsSync(extenderDestinationPath)) { + mkdirSync(extenderDestinationPath, { recursive: true }); + } + + // Copy the Airship Extender file into the Android expo project. + readFile(props.airshipExtender, 'utf8', (err, data) => { + if (err || !data) { + console.error("Airship couldn't read file " + (props.airshipExtender)); + console.error(err); + return; + } + writeFileSync(join(extenderDestinationPath, fileName), data); + }); +}; + +const withAirshipExtenderInManifest: ConfigPlugin = (config, props) => { + return withAndroidManifest(config, async config => { + assert(config.android?.package, "Missing 'android.package' in app config.") + config.modResults = await setCustomConfigAsync(config.android.package, config.modResults); + return config; + }); +}; + +async function setCustomConfigAsync( + packageName: string, + androidManifest: AndroidConfig.Manifest.AndroidManifest +): Promise { + // Get the tag and assert if it doesn't exist. + const mainApplication = getMainApplicationOrThrow(androidManifest); + + addMetaDataItemToMainApplication( + mainApplication, + // value for `android:name` + 'com.urbanairship.plugin.extender', + // value for `android:value` + `${packageName}.${AIRSHP_PLUGIN_EXTENDER_CLASS_NAME}` + ); + + return androidManifest; +} + export const withAirshipAndroid: ConfigPlugin = (config, props) => { config = withCompileSDKVersionFix(config, props); config = withNotificationIcons(config, props); config = withCustomNotificationChannels(config, props); + if (props.airshipExtender) { + config = withAirshipExtender(config, props); + config = withAirshipExtenderInManifest(config, props); + } return config; }; \ No newline at end of file diff --git a/plugin/src/withAirshipIOS.ts b/plugin/src/withAirshipIOS.ts index dbefe10..e9ee161 100644 --- a/plugin/src/withAirshipIOS.ts +++ b/plugin/src/withAirshipIOS.ts @@ -20,6 +20,8 @@ const DEFAULT_NOTIFICATION_SERVICE_EXTENSION_TARGET_NAME = "NotificationServiceE const NOTIFICATION_SERVICE_FILE_NAME = "AirshipNotificationService.swift"; const NOTIFICATION_SERVICE_INFO_PLIST_FILE_NAME = "NotificationServiceExtension-Info.plist"; +const AIRSHP_PLUGIN_EXTENDER_DIR_NAME = "AirshipPluginExtender"; + const withCapabilities: ConfigPlugin = (config, props) => { return withInfoPlist(config, (plist) => { if (!Array.isArray(plist.modResults.UIBackgroundModes)) { @@ -250,6 +252,84 @@ function getEasManagedCredentialsConfigExtra(config: ExpoConfig, props: AirshipI } } +const withAirshipExtender: ConfigPlugin = (config, props) => { + return withDangerousMod(config, [ + 'ios', + async config => { + await writeAirshipExtenderFileAsync(props, config.modRequest.projectRoot); + return config; + }, + ]); +}; + +async function writeAirshipExtenderFileAsync(props: AirshipIOSPluginProps, projectRoot: string) { + if (!props.airshipExtender) { + return; + } + + const fileName = basename(props.airshipExtender) + const extenderDestinationPath = join(projectRoot, "ios", AIRSHP_PLUGIN_EXTENDER_DIR_NAME); + + if (!existsSync(extenderDestinationPath)) { + mkdirSync(extenderDestinationPath, { recursive: true }); + } + + // Copy the Airship Extender file into the iOS expo project. + readFile(props.airshipExtender, 'utf8', (err, data) => { + if (err || !data) { + console.error("Airship couldn't read file " + (props.airshipExtender)); + console.error(err); + return; + } + writeFileSync(join(extenderDestinationPath, fileName), data); + }); +}; + +const withAirshipExtenderInMainTarget: ConfigPlugin = (config, props) => { + return withXcodeProject(config, newConfig => { + const xcodeProject = newConfig.modResults; + + if (!props.airshipExtender) { + return newConfig; + } + + if (!!xcodeProject.pbxGroupByName(AIRSHP_PLUGIN_EXTENDER_DIR_NAME)) { + console.log(AIRSHP_PLUGIN_EXTENDER_DIR_NAME + " already exists in project. Skipping..."); + return newConfig; + } + + const extenderFileName = basename(props.airshipExtender); + const mainAppTarget = xcodeProject.getFirstTarget(); + + // Create new PBXGroup for the Airship Extender + const extGroup = xcodeProject.addPbxGroup( + [], + AIRSHP_PLUGIN_EXTENDER_DIR_NAME, + AIRSHP_PLUGIN_EXTENDER_DIR_NAME + ); + + // Add the new PBXGroup to the top level group. This makes the + // files / folder appear in the file explorer in Xcode. + const groups = xcodeProject.hash.project.objects["PBXGroup"]; + Object.keys(groups).forEach(function(key) { + if (typeof groups[key] === "object" && groups[key].name === undefined && groups[key].path === undefined) { + xcodeProject.addToPbxGroup(extGroup.uuid, key); + } + }); + + // Add the AirshipExtender source file to the Main Target Build Phases + xcodeProject.addSourceFile( + extenderFileName, + { + target: mainAppTarget.uuid + }, + extGroup.uuid + ); + + return newConfig; + }); +}; + export const withAirshipIOS: ConfigPlugin = (config, props) => { config = withCapabilities(config, props); config = withAPNSEnvironment(config, props); @@ -259,5 +339,9 @@ export const withAirshipIOS: ConfigPlugin = (config, prop config = withAirshipServiceExtensionPod(config, props); config = withEasManagedCredentials(config, props); } + if (props.airshipExtender) { + config = withAirshipExtender(config, props); + config = withAirshipExtenderInMainTarget(config, props); + } return config; }; \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 928e374..9e28e8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1226,20 +1226,19 @@ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== -"@expo/config-plugins@^8.0.4": - version "8.0.11" - resolved "https://registry.yarnpkg.com/@expo/config-plugins/-/config-plugins-8.0.11.tgz#b814395a910f4c8b7cc95d9719dccb6ca53ea4c5" - integrity sha512-oALE1HwnLFthrobAcC9ocnR9KXLzfWEjgIe4CPe+rDsfC6GDs8dGYCXfRFoCEzoLN4TGYs9RdZ8r0KoCcNrm2A== - dependencies: - "@expo/config-types" "^51.0.3" - "@expo/json-file" "~8.3.0" - "@expo/plist" "^0.1.0" +"@expo/config-plugins@^9.0.12": + version "9.0.12" + resolved "https://registry.yarnpkg.com/@expo/config-plugins/-/config-plugins-9.0.12.tgz#f122b2dca22e135eadf6e73442da3ced0ce8aa0a" + integrity sha512-/Ko/NM+GzvJyRkq8PITm8ms0KY5v0wmN1OQFYRMkcJqOi3PjlhndW+G6bHpJI9mkQXBaUnHwAiGLqIC3+MQ5Wg== + dependencies: + "@expo/config-types" "^52.0.0" + "@expo/json-file" "~9.0.0" + "@expo/plist" "^0.2.0" "@expo/sdk-runtime-versions" "^1.0.0" chalk "^4.1.2" - debug "^4.3.1" - find-up "~5.0.0" + debug "^4.3.5" getenv "^1.0.0" - glob "7.1.6" + glob "^10.4.2" resolve-from "^5.0.0" semver "^7.5.4" slash "^3.0.0" @@ -1275,10 +1274,10 @@ resolved "https://registry.yarnpkg.com/@expo/config-types/-/config-types-50.0.0.tgz#b534d3ec997ec60f8af24f6ad56244c8afc71a0b" integrity sha512-0kkhIwXRT6EdFDwn+zTg9R2MZIAEYGn1MVkyRohAd+C9cXOb5RA8WLQi7vuxKF9m1SMtNAUrf0pO+ENK0+/KSw== -"@expo/config-types@^51.0.3": - version "51.0.3" - resolved "https://registry.yarnpkg.com/@expo/config-types/-/config-types-51.0.3.tgz#520bdce5fd75f9d234fd81bd0347443086419450" - integrity sha512-hMfuq++b8VySb+m9uNNrlpbvGxYc8OcFCUX9yTmi9tlx6A4k8SDabWFBgmnr4ao3wEArvWrtUQIfQCVtPRdpKA== +"@expo/config-types@^52.0.0": + version "52.0.1" + resolved "https://registry.yarnpkg.com/@expo/config-types/-/config-types-52.0.1.tgz#327af1b72a3a9d4556f41e083e0e284dd8198b96" + integrity sha512-vD8ZetyKV7U29lR6+NJohYeoLYTH+eNYXJeNiSOrWCz0witJYY11meMmEnpEaVbN89EfC6uauSUOa6wihtbyPQ== "@expo/config@~8.5.0": version "8.5.4" @@ -1335,6 +1334,15 @@ json5 "^2.2.2" write-file-atomic "^2.3.0" +"@expo/json-file@~9.0.0": + version "9.0.0" + resolved "https://registry.yarnpkg.com/@expo/json-file/-/json-file-9.0.0.tgz#e3688c9b108cfd7e819f1354a9458ba6e93fc943" + integrity sha512-M+55xFVrFzDcgMDf+52lPDLjKB5xwRfStWlv/b/Vu2OLgxGZLWpxoPYjlRoHqxjPbCQIi2ZCbobK+0KuNhsELg== + dependencies: + "@babel/code-frame" "~7.10.4" + json5 "^2.2.3" + write-file-atomic "^2.3.0" + "@expo/npm-proofread@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@expo/npm-proofread/-/npm-proofread-1.0.1.tgz#8450f71cea47dd9864d61a1a105931dc7ea2209a" @@ -1351,6 +1359,15 @@ base64-js "^1.2.3" xmlbuilder "^14.0.0" +"@expo/plist@^0.2.0": + version "0.2.0" + resolved "https://registry.yarnpkg.com/@expo/plist/-/plist-0.2.0.tgz#beb014c0bfd56a993086c0972ec1ca3ef3f9d36c" + integrity sha512-F/IZJQaf8OIVnVA6XWUeMPC3OH6MV00Wxf0WC0JhTQht2QgjyHUa3U5Gs3vRtDq8tXNsZneOQRDVwpaOnd4zTQ== + dependencies: + "@xmldom/xmldom" "~0.7.7" + base64-js "^1.2.3" + xmlbuilder "^14.0.0" + "@expo/sdk-runtime-versions@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@expo/sdk-runtime-versions/-/sdk-runtime-versions-1.0.0.tgz#d7ebd21b19f1c6b0395e50d78da4416941c57f7c" @@ -1370,6 +1387,18 @@ dependencies: cross-spawn "^7.0.3" +"@isaacs/cliui@^8.0.2": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" + integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== + dependencies: + string-width "^5.1.2" + string-width-cjs "npm:string-width@^4.2.0" + strip-ansi "^7.0.1" + strip-ansi-cjs "npm:strip-ansi@^6.0.1" + wrap-ansi "^8.1.0" + wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -1542,6 +1571,11 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@pkgjs/parseargs@^0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" + integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== + "@pkgr/core@^0.1.0": version "0.1.1" resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" @@ -1962,7 +1996,7 @@ ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" -ansi-styles@^4.1.0: +ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== @@ -1974,6 +2008,11 @@ ansi-styles@^5.0.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== +ansi-styles@^6.1.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" + integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== + any-promise@^1.0.0: version "1.3.0" resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" @@ -2494,6 +2533,15 @@ cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@^7.0.0: + version "7.0.6" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -2580,6 +2628,13 @@ debug@^3.2.7: dependencies: ms "^2.1.1" +debug@^4.3.5: + version "4.4.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a" + integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA== + dependencies: + ms "^2.1.3" + decimal.js@^10.4.2: version "10.4.3" resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" @@ -2634,6 +2689,11 @@ domexception@^4.0.0: dependencies: webidl-conversions "^7.0.0" +eastasianwidth@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" + integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== + electron-to-chromium@^1.4.668: version "1.4.721" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.721.tgz#a9ee55ba7e54d9ecbcc19825116f3752e7d60ef2" @@ -2644,6 +2704,16 @@ emittery@^0.13.1: resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +emoji-regex@^9.2.2: + version "9.2.2" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" + integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== + entities@^4.4.0: version "4.5.0" resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" @@ -3078,6 +3148,14 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" +foreground-child@^3.1.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.0.tgz#0ac8644c06e431439f8561db8ecf29a7b5519c77" + integrity sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg== + dependencies: + cross-spawn "^7.0.0" + signal-exit "^4.0.1" + form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -3186,6 +3264,18 @@ glob@7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^10.4.2: + version "10.4.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956" + integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== + dependencies: + foreground-child "^3.1.0" + jackspeak "^3.1.2" + minimatch "^9.0.4" + minipass "^7.1.2" + package-json-from-dist "^1.0.0" + path-scurry "^1.11.1" + glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.7, glob@^7.2.0: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -3430,6 +3520,11 @@ is-finalizationregistry@^1.0.2: dependencies: call-bind "^1.0.2" +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + is-generator-function@^1.0.10: version "1.0.10" resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.10.tgz#f1558baf1ac17e0deea7c0415c438351ff2b3c72" @@ -3581,6 +3676,15 @@ iterator.prototype@^1.1.2: reflect.getprototypeof "^1.0.4" set-function-name "^2.0.1" +jackspeak@^3.1.2: + version "3.4.3" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a" + integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw== + dependencies: + "@isaacs/cliui" "^8.0.2" + optionalDependencies: + "@pkgjs/parseargs" "^0.11.0" + jest-diff@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" @@ -3919,6 +4023,11 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: dependencies: js-tokens "^3.0.0 || ^4.0.0" +lru-cache@^10.2.0: + version "10.4.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" + integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -3997,11 +4106,23 @@ minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: dependencies: brace-expansion "^1.1.7" +minimatch@^9.0.4: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + minimist@^1.2.0, minimist@^1.2.6: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" + integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== + mkdirp@^0.5.1: version "0.5.6" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" @@ -4014,7 +4135,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@^2.1.1: +ms@^2.1.1, ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -4200,6 +4321,11 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +package-json-from-dist@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" + integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== + parse-png@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/parse-png/-/parse-png-2.1.0.tgz#2a42ad719fedf90f81c59ebee7ae59b280d6b338" @@ -4244,6 +4370,14 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-scurry@^1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2" + integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA== + dependencies: + lru-cache "^10.2.0" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" + path-type@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" @@ -4667,6 +4801,11 @@ signal-exit@^3.0.2, signal-exit@^3.0.7: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== +signal-exit@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" + integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== + simple-plist@^1.1.0: version "1.3.1" resolved "https://registry.yarnpkg.com/simple-plist/-/simple-plist-1.3.1.tgz#16e1d8f62c6c9b691b8383127663d834112fb017" @@ -4781,6 +4920,33 @@ string-length@^5.0.1: char-regex "^2.0.0" strip-ansi "^7.0.1" +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^5.0.1, string-width@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" + integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== + dependencies: + eastasianwidth "^0.2.0" + emoji-regex "^9.2.2" + strip-ansi "^7.0.1" + string.prototype.matchall@^4.0.10: version "4.0.11" resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.11.tgz#1092a72c59268d2abaad76582dccc687c0297e0a" @@ -4827,7 +4993,14 @@ string.prototype.trimstart@^1.0.7: define-properties "^1.2.1" es-object-atoms "^1.0.0" -strip-ansi@^6.0.0: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -5281,6 +5454,24 @@ which@^2.0.1: dependencies: isexe "^2.0.0" +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" + integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== + dependencies: + ansi-styles "^6.1.0" + string-width "^5.0.1" + strip-ansi "^7.0.1" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" From c25e011b6955d9c4234b17847e9a87b17d8d8c9a Mon Sep 17 00:00:00 2001 From: Ulrich GIBERNE Date: Fri, 20 Dec 2024 12:29:53 -0400 Subject: [PATCH 2/2] doc and changelog --- CHANGELOG.md | 3 +++ README.md | 14 +++++++++++--- package.json | 2 +- plugin/src/withAirship.ts | 8 ++++++-- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 254c4b1..33502be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Airship Expo Plugin Changelog +## Version 1.4.0 - December 20, 2024 +Minor version that adds support for Aiship Plugin Extender. + ## Version 1.3.2 - December 13, 2024 Patch version that fixes the Notification Service Extension for EAS builds. diff --git a/README.md b/README.md index 419d456..579773c 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,16 @@ Add the plugin to the app.json: { "android":{ "icon": "./assets/ic_notification.png", - "customNotificationChannels": "./assets/notification_channels.xml" + "customNotificationChannels": "./assets/notification_channels.xml", + "airshipExtender": "./assets/AirshipExtender.kt" }, "ios":{ "mode": "development", "notificationService": "./assets/NotificationService.swift", - "notificationServiceInfo": "./assets/NotificationServiceExtension-Info.plist" + "notificationServiceInfo": "./assets/NotificationServiceExtension-Info.plist", + "notificationServiceTargetName": "NotificationServiceExtension", + "developmentTeamID": "MY_TEAM_ID", + "airshipExtender": "./assets/AirshipPluginExtender.swift" } } ] @@ -35,11 +39,15 @@ Add the plugin to the app.json: Android Config: - icon: Required. Local path to an image to use as the icon for push notifications. 96x96 all-white png with transparency. The name of the icon will be the resource name. - customNotificationChannels: Optional. The local path to a Custom Notification Channels resource file. +- airshipExtender: Optional. The local path to a AirshipExtender.kt file. iOS Config: - mode: Required. The APNS entitlement. Either `development` or `production`. -- notificationService: Optional. The local path to a custom Notification Service Extension. +- notificationService: Optional. The local path to a custom Notification Service Extension or `DEFAULT_AIRSHIP_SERVICE_EXTENSION` for Airship's default one. - notificationServiceInfo: Optional. Airship will use a default one if not provided. The local path to a Notification Service Extension Info.plist. +- notificationServiceTargetName: Optional. Defaults to NotificationServiceExtension if not provided. +- developmentTeamID: Optional. The Apple Development Team ID used to configure the Notification Service Extension target. +- airshipExtender: Optional. The local path to a AirshipPluginExtender.swift file. ## Calling takeOff diff --git a/package.json b/package.json index cca42a5..6f85220 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "airship-expo-plugin", - "version": "1.3.2", + "version": "1.4.0", "description": "Airship Expo config plugin", "main": "./app.plugin.js", "scripts": { diff --git a/plugin/src/withAirship.ts b/plugin/src/withAirship.ts index fd6edee..63e927f 100644 --- a/plugin/src/withAirship.ts +++ b/plugin/src/withAirship.ts @@ -15,7 +15,9 @@ export type AirshipAndroidPluginProps = { * Optional. The local path to a Custom Notification Channels resource file. */ customNotificationChannels?: string; - + /** + * Optional. The local path to a AirshipExtender.kt file. + */ airshipExtender?: string; }; @@ -41,7 +43,9 @@ export type AirshipIOSPluginProps = { * Optional. The Apple Development Team ID used to configure the Notification Service Extension target. */ developmentTeamID?: string; - + /** + * Optional. The local path to a AirshipPluginExtender.swift file. + */ airshipExtender?: string; }