From 134b71eeaf5d0bb675d0bd882edd18c01b7f38df Mon Sep 17 00:00:00 2001 From: Adrian Castro <22133246+castdrian@users.noreply.github.com> Date: Tue, 19 Mar 2024 20:05:53 +0100 Subject: [PATCH] fix: add config plugin to remove notification entitlement during prebuild --- apps/expo/app.config.ts | 2 ++ .../withRemoveiOSNotificationEntitlement.js | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 apps/expo/config-plugins/withRemoveiOSNotificationEntitlement.js diff --git a/apps/expo/app.config.ts b/apps/expo/app.config.ts index 3b9e87a..98dffdc 100644 --- a/apps/expo/app.config.ts +++ b/apps/expo/app.config.ts @@ -1,5 +1,6 @@ import type { ExpoConfig } from "expo/config"; +import withRemoveiOSNotificationEntitlement from "./config-plugins/withRemoveiOSNotificationEntitlement"; import { version } from "./package.json"; const defineConfig = (): ExpoConfig => ({ @@ -37,6 +38,7 @@ const defineConfig = (): ExpoConfig => ({ }, plugins: [ "expo-router", + [withRemoveiOSNotificationEntitlement as unknown as string], [ "expo-screen-orientation", { diff --git a/apps/expo/config-plugins/withRemoveiOSNotificationEntitlement.js b/apps/expo/config-plugins/withRemoveiOSNotificationEntitlement.js new file mode 100644 index 0000000..c9b9c78 --- /dev/null +++ b/apps/expo/config-plugins/withRemoveiOSNotificationEntitlement.js @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-return */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +const withEntitlementsPlist = require("@expo/config-plugins").withEntitlementsPlist; + +const withRemoveiOSNotificationEntitlement = (config) => { + return withEntitlementsPlist(config, mod => { + delete mod.modResults['aps-environment']; + return mod; + }) +} + +module.exports = withRemoveiOSNotificationEntitlement; \ No newline at end of file