File tree 3 files changed +5
-19
lines changed 3 files changed +5
-19
lines changed Original file line number Diff line number Diff line change
1
+ import { appDelegateExpectedFixture , appDelegateFixture } from '../fixtures/appDelegate' ;
1
2
import { modifyAppDelegate } from '../ios/withReactNativeBatchAppDelegate' ;
2
- import {
3
- appDelegateExpectedFixture ,
4
- appDelegateFixture ,
5
- } from '../fixtures/appDelegate' ;
6
3
7
4
describe ( modifyAppDelegate , ( ) => {
8
5
it ( 'should modify the AppDelegate' , ( ) => {
Original file line number Diff line number Diff line change @@ -157,8 +157,6 @@ static void InitializeFlipper(UIApplication *application) {
157
157
158
158
export const appDelegateExpectedFixture = `#import "AppDelegate.h"
159
159
160
- #import <RNBatchPush/RNBatch.h>
161
-
162
160
#if defined(EX_DEV_MENU_ENABLED)
163
161
@import EXDevMenu;
164
162
#endif
@@ -210,7 +208,6 @@ static void InitializeFlipper(UIApplication *application) {
210
208
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
211
209
{
212
210
[RNBatch start];
213
- [BatchUNUserNotificationCenterDelegate registerAsDelegate];
214
211
215
212
#if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
216
213
InitializeFlipper(application);
Original file line number Diff line number Diff line change 1
1
import { ConfigPlugin , withAppDelegate } from '@expo/config-plugins' ;
2
- import { Props } from '../withReactNativeBatch' ;
3
2
4
3
const DID_FINISH_LAUNCHING_WITH_OPTIONS_DECLARATION =
5
4
'- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{' ;
6
5
7
- const IMPORT_BATCH = '\n\n#import <RNBatchPush/RNBatch.h>\n' ;
8
- const REGISTER_BATCH = '\n [RNBatch start];\n [BatchUNUserNotificationCenterDelegate registerAsDelegate];\n' ;
6
+ const REGISTER_BATCH = '\n [RNBatch start];\n' ;
9
7
10
8
export const modifyAppDelegate = ( contents : string ) => {
11
- contents = contents . replace ( '\n' , IMPORT_BATCH ) ;
9
+ const [ beforeDeclaration , afterDeclaration ] = contents . split ( DID_FINISH_LAUNCHING_WITH_OPTIONS_DECLARATION ) ;
12
10
13
- const [ beforeDeclaration , afterDeclaration ] = contents . split (
14
- DID_FINISH_LAUNCHING_WITH_OPTIONS_DECLARATION
15
- ) ;
16
-
17
- const newAfterDeclaration = DID_FINISH_LAUNCHING_WITH_OPTIONS_DECLARATION . concat (
18
- REGISTER_BATCH
19
- ) . concat ( afterDeclaration ) ;
11
+ const newAfterDeclaration = DID_FINISH_LAUNCHING_WITH_OPTIONS_DECLARATION . concat ( REGISTER_BATCH ) . concat ( afterDeclaration ) ;
20
12
21
13
contents = beforeDeclaration . concat ( newAfterDeclaration ) ;
22
14
return contents ;
23
15
} ;
24
16
25
- export const withReactNativeBatchAppDelegate : ConfigPlugin < { } | void > = config => {
17
+ export const withReactNativeBatchAppDelegate : ConfigPlugin < object | void > = config => {
26
18
return withAppDelegate ( config , config => {
27
19
config . modResults . contents = modifyAppDelegate ( config . modResults . contents ) ;
28
20
return config ;
You can’t perform that action at this time.
0 commit comments