Skip to content

Commit c2d0a56

Browse files
authored
Remove authorization request for notifications from app app delegate (#203)
1 parent fd0303c commit c2d0a56

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

src/expo-plugins/withPushNotifications.ts

-23
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,15 @@ import {
55
} from '@expo/config-plugins';
66
import type { IntercomPluginProps } from './@types';
77
import {
8-
addObjcImports,
98
findObjcFunctionCodeBlock,
109
insertContentsInsideObjcFunctionBlock,
1110
} from '@expo/config-plugins/build/ios/codeMod';
1211

1312
const appDelegate: ConfigPlugin<IntercomPluginProps> = (_config) =>
1413
withAppDelegate(_config, (config) => {
15-
const pushCode = `
16-
// START INTERCOM PUSH
17-
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
18-
[center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound)
19-
completionHandler:^(BOOL granted, NSError *_Nullable error) {
20-
}];
21-
[[UIApplication sharedApplication] registerForRemoteNotifications];
22-
// END INTERCOM PUSH
23-
`;
24-
2514
const setDeviceTokenCode = '[IntercomModule setDeviceToken:deviceToken];';
2615

2716
let stringContents = config.modResults.contents;
28-
stringContents = addObjcImports(stringContents, [
29-
'<UserNotifications/UserNotifications.h>',
30-
]);
31-
32-
if (!stringContents.includes(pushCode.trim())) {
33-
stringContents = insertContentsInsideObjcFunctionBlock(
34-
stringContents,
35-
'application didFinishLaunchingWithOptions:',
36-
pushCode,
37-
{ position: 'tailBeforeLastReturn' }
38-
);
39-
}
4017

4118
const didRegisterBlock = findObjcFunctionCodeBlock(
4219
stringContents,

0 commit comments

Comments
 (0)