From a3db412cd823afd8c2c0351a2333b3df0516f4a7 Mon Sep 17 00:00:00 2001 From: Josh Parnham Date: Mon, 27 May 2024 11:49:03 +1000 Subject: [PATCH] Remove authorization request for notifications from app app delegate --- src/expo-plugins/withPushNotifications.ts | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/expo-plugins/withPushNotifications.ts b/src/expo-plugins/withPushNotifications.ts index 6da0295..f99acb3 100644 --- a/src/expo-plugins/withPushNotifications.ts +++ b/src/expo-plugins/withPushNotifications.ts @@ -5,38 +5,15 @@ import { } from '@expo/config-plugins'; import type { IntercomPluginProps } from './@types'; import { - addObjcImports, findObjcFunctionCodeBlock, insertContentsInsideObjcFunctionBlock, } from '@expo/config-plugins/build/ios/codeMod'; const appDelegate: ConfigPlugin = (_config) => withAppDelegate(_config, (config) => { - const pushCode = ` - // START INTERCOM PUSH - UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; - [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound) - completionHandler:^(BOOL granted, NSError *_Nullable error) { - }]; - [[UIApplication sharedApplication] registerForRemoteNotifications]; - // END INTERCOM PUSH -`; - const setDeviceTokenCode = '[IntercomModule setDeviceToken:deviceToken];'; let stringContents = config.modResults.contents; - stringContents = addObjcImports(stringContents, [ - '', - ]); - - if (!stringContents.includes(pushCode.trim())) { - stringContents = insertContentsInsideObjcFunctionBlock( - stringContents, - 'application didFinishLaunchingWithOptions:', - pushCode, - { position: 'tailBeforeLastReturn' } - ); - } const didRegisterBlock = findObjcFunctionCodeBlock( stringContents,