@@ -5,38 +5,15 @@ import {
5
5
} from '@expo/config-plugins' ;
6
6
import type { IntercomPluginProps } from './@types' ;
7
7
import {
8
- addObjcImports ,
9
8
findObjcFunctionCodeBlock ,
10
9
insertContentsInsideObjcFunctionBlock ,
11
10
} from '@expo/config-plugins/build/ios/codeMod' ;
12
11
13
12
const appDelegate : ConfigPlugin < IntercomPluginProps > = ( _config ) =>
14
13
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
-
25
14
const setDeviceTokenCode = '[IntercomModule setDeviceToken:deviceToken];' ;
26
15
27
16
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
- }
40
17
41
18
const didRegisterBlock = findObjcFunctionCodeBlock (
42
19
stringContents ,
0 commit comments