Skip to content

Commit

Permalink
expo: fix rnbatch import during pre-build
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-roland committed Jun 20, 2024
1 parent ee6fb57 commit 96d3709
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
9.0.1
----

**Expo**

* Fixed an issue on iOS where the `RNBatch` import was not added during the Expo pre-build.

9.0.0
----

Expand Down
2 changes: 2 additions & 0 deletions plugin/src/fixtures/appDelegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ static void InitializeFlipper(UIApplication *application) {

export const appDelegateExpectedFixture = `#import "AppDelegate.h"
#import <RNBatchPush/RNBatch.h>
#if defined(EX_DEV_MENU_ENABLED)
@import EXDevMenu;
#endif
Expand Down
3 changes: 3 additions & 0 deletions plugin/src/ios/withReactNativeBatchAppDelegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import { ConfigPlugin, withAppDelegate } from '@expo/config-plugins';
const DID_FINISH_LAUNCHING_WITH_OPTIONS_DECLARATION =
'- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{';

const IMPORT_BATCH = '\n\n#import <RNBatchPush/RNBatch.h>\n';
const REGISTER_BATCH = '\n [RNBatch start];\n';

export const modifyAppDelegate = (contents: string) => {
contents = contents.replace('\n', IMPORT_BATCH);

const [beforeDeclaration, afterDeclaration] = contents.split(DID_FINISH_LAUNCHING_WITH_OPTIONS_DECLARATION);

const newAfterDeclaration = DID_FINISH_LAUNCHING_WITH_OPTIONS_DECLARATION.concat(REGISTER_BATCH).concat(afterDeclaration);
Expand Down

0 comments on commit 96d3709

Please sign in to comment.