Skip to content

Commit c30b00c

Browse files
committed
Refactor AppDelegate to simplify CodePush integration and remove unused RCTBridge and RCTRootView references
1 parent 1d10dcd commit c30b00c

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
#import "AppDelegate.h"
2-
32
#import <CodePush/CodePush.h>
43

54
#import <React/RCTBundleURLProvider.h>
6-
#import <React/RCTBridge.h>
7-
#import <React/RCTRootView.h>
85

96
@implementation AppDelegate
107

118
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
129
{
13-
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
14-
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
15-
moduleName:@"CODE_PUSH_TEST_APP_NAME"
16-
initialProperties:nil];
17-
1810
self.moduleName = @"TestCodePush";
1911
// You can add your custom initial props in the dictionary below.
2012
// They will be passed down to the ViewController used by React Native.
@@ -25,17 +17,16 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
2517

2618
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
2719
{
28-
return [CodePush bundleURL];
20+
return [self bundleURL];
2921
}
3022

31-
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
32-
///
33-
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
34-
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
35-
/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
36-
- (BOOL)concurrentRootEnabled
23+
- (NSURL *)bundleURL
3724
{
38-
return true;
25+
#if DEBUG
26+
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
27+
#else
28+
return [CodePush bundleURL];
29+
#endif
3930
}
4031

4132
@end

0 commit comments

Comments
 (0)