@lazidog/expo-notification-extension
Version:
| [with FCM compatibility] The Expo Notification Service Extension plugin allows you to add a Notification Service Extension file while staying in the managed workflow.
25 lines (24 loc) • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var config_plugins_1 = require("@expo/config-plugins");
var constants_1 = require("../constants");
/**
* Modify the iOS entitlements plist to add an App Group entitlement.
* Ensures the app and app extension can communicate and share resources securely
*/
var withAppGroupPermissions = function (config) {
return (0, config_plugins_1.withEntitlementsPlist)(config, function (newConfig) {
var _a;
if (!Array.isArray(newConfig.modResults[constants_1.APP_GROUP_KEY])) {
newConfig.modResults[constants_1.APP_GROUP_KEY] = [];
}
var modResultsArray = newConfig.modResults[constants_1.APP_GROUP_KEY];
var entitlement = "group.".concat(((_a = newConfig === null || newConfig === void 0 ? void 0 : newConfig.ios) === null || _a === void 0 ? void 0 : _a.bundleIdentifier) || "", ".nse");
if (modResultsArray.indexOf(entitlement) !== -1) {
return newConfig;
}
modResultsArray.push(entitlement);
return newConfig;
});
};
exports.default = withAppGroupPermissions;