From a8776b93800bf149188f74ac7684f44552c47bbc Mon Sep 17 00:00:00 2001 From: Arnaud Roland Date: Thu, 24 Oct 2024 13:30:24 +0200 Subject: [PATCH] expo: add ios notification entitlement during expo prebuild --- plugin/src/ios/withReactNativeBatchEntitlements.ts | 8 ++++++++ plugin/src/withReactNativeBatch.ts | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 plugin/src/ios/withReactNativeBatchEntitlements.ts diff --git a/plugin/src/ios/withReactNativeBatchEntitlements.ts b/plugin/src/ios/withReactNativeBatchEntitlements.ts new file mode 100644 index 0000000..2ef8a61 --- /dev/null +++ b/plugin/src/ios/withReactNativeBatchEntitlements.ts @@ -0,0 +1,8 @@ +import { ConfigPlugin, withEntitlementsPlist } from '@expo/config-plugins'; + +export const withReactNativeBatchEntitlements: ConfigPlugin = config => { + return withEntitlementsPlist(config, config => { + config.modResults = { ...config.modResults, 'aps-environment': 'development' }; + return config; + }); +}; diff --git a/plugin/src/withReactNativeBatch.ts b/plugin/src/withReactNativeBatch.ts index 1d31070..28b5676 100644 --- a/plugin/src/withReactNativeBatch.ts +++ b/plugin/src/withReactNativeBatch.ts @@ -1,11 +1,12 @@ import { ConfigPlugin, createRunOncePlugin } from '@expo/config-plugins'; -import { withClassPath, withApplyPlugin, withGoogleServicesFile } from '@expo/config-plugins/build/android/GoogleServices'; +import { withApplyPlugin, withClassPath, withGoogleServicesFile } from '@expo/config-plugins/build/android/GoogleServices'; import { withReactNativeBatchAppBuildGradle } from './android/withReactNativeBatchAppBuildGradle'; import { withReactNativeBatchMainActivity } from './android/withReactNativeBatchMainActivity'; import { withReactNativeBatchMainApplication } from './android/withReactNativeBatchMainApplication'; import { withReactNativeBatchManifest } from './android/withReactNativeBatchManifest'; import { withReactNativeBatchAppDelegate } from './ios/withReactNativeBatchAppDelegate'; +import { withReactNativeBatchEntitlements } from './ios/withReactNativeBatchEntitlements'; import { withReactNativeBatchInfoPlist } from './ios/withReactNativeBatchInfoPlist'; export type Props = { @@ -30,6 +31,7 @@ const withReactNativeBatch: ConfigPlugin = (config, props) => { newConfig = withReactNativeBatchMainApplication(newConfig); newConfig = withReactNativeBatchMainActivity(newConfig); newConfig = withReactNativeBatchInfoPlist(newConfig, _props); + newConfig = withReactNativeBatchEntitlements(newConfig); newConfig = withReactNativeBatchAppDelegate(newConfig); // Return the modified config. return newConfig;