Created
October 22, 2019 12:18
-
-
Save ahartzog/4df82472771a5750bf33fe30f678a81e to your computer and use it in GitHub Desktop.
NFU AppDelegate.m
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (c) Facebook, Inc. and its affiliates. | |
* | |
* This source code is licensed under the MIT license found in the | |
* LICENSE file in the root directory of this source tree. | |
*/ | |
#import "AppDelegate.h" | |
#import <CodePush/CodePush.h> | |
#import <React/RCTBridge.h> | |
#import <React/RCTBundleURLProvider.h> | |
#import <React/RCTRootView.h> | |
#import <UMCore/UMModuleRegistry.h> | |
#import <UMReactNativeAdapter/UMNativeModulesProxy.h> | |
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h> | |
@implementation AppDelegate | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
// //https://github.com/microsoft/react-native-code-push/issues/1647#issuecomment-525485788 | |
// NSURL *jsCodeLocation; | |
// #ifdef DEBUG | |
// jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; | |
// #else | |
// jsCodeLocation = [CodePush bundleURL]; | |
// #endif | |
self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]]; | |
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; | |
//RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation | |
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge | |
moduleName:@"NFUMobileApp" | |
initialProperties:nil]; | |
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; | |
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; | |
UIViewController *rootViewController = [UIViewController new]; | |
rootViewController.view = rootView; | |
self.window.rootViewController = rootViewController; | |
[self.window makeKeyAndVisible]; | |
return YES; | |
} | |
- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge | |
{ | |
NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge]; | |
// You can inject any extra modules that you would like here, more information at: | |
// https://facebook.github.io/react-native/docs/native-modules-ios.html#dependency-injection | |
return extraModules; | |
} | |
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge | |
{ | |
#if DEBUG | |
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; | |
#else | |
return [CodePush bundleURL]; | |
#endif | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment