UNPKG

react-native-notificare-push

Version:
35 lines (34 loc) 1.97 kB
"use strict"; /* eslint-disable @typescript-eslint/no-unused-vars */ Object.defineProperty(exports, "__esModule", { value: true }); exports.withNotificarePushIOSNotificationServiceExtension = void 0; const config_plugins_1 = require("@expo/config-plugins"); const setup_notification_service_extension_1 = require("./hooks/setup-notification-service-extension"); const update_notification_service_plist_1 = require("./hooks/update-notification-service-plist"); const withSetupNotificationServiceExtension = (config, props) => { return (0, config_plugins_1.withXcodeProject)(config, async (newConfig) => { const proj = newConfig.modResults; const projRoot = newConfig.modRequest.projectRoot; const appBundleID = newConfig.ios?.bundleIdentifier; const deploymentTarget = props?.ios?.deploymentTarget; newConfig.modResults = await (0, setup_notification_service_extension_1.setupNotificationServiceExtension)(proj, projRoot, appBundleID, deploymentTarget); return newConfig; }); }; const withUpdateNotificationServiceExtensionPlist = (config, props) => { return (0, config_plugins_1.withInfoPlist)(config, (newConfig) => { const projRoot = newConfig.modRequest.projectRoot; const bundleVersion = newConfig.modResults.CFBundleVersion; const bundleShortVersion = newConfig.modResults.CFBundleShortVersionString; (0, update_notification_service_plist_1.updateNotificationServicePlist)(projRoot, bundleVersion, bundleShortVersion); return newConfig; }); }; const withNotificarePushIOSNotificationServiceExtension = (config, props) => { if (props?.ios?.useNotificationServiceExtension) { config = withSetupNotificationServiceExtension(config, props); config = withUpdateNotificationServiceExtensionPlist(config, props); } return config; }; exports.withNotificarePushIOSNotificationServiceExtension = withNotificarePushIOSNotificationServiceExtension;