Advertisement
Guest User

Untitled

a guest
Apr 20th, 2020
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7.  
  8. @import Firebase;
  9. #import "AppDelegate.h"
  10.  
  11. #import <React/RCTBundleURLProvider.h>
  12. #import <React/RCTRootView.h>
  13.  
  14. #import <UMCore/UMModuleRegistry.h>
  15. #import <UMReactNativeAdapter/UMNativeModulesProxy.h>
  16. #import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
  17.  
  18. @interface AppDelegate ()
  19.  
  20. @property (nonatomic, strong) NSDictionary *launchOptions;
  21.  
  22. @end
  23.  
  24. @implementation AppDelegate
  25.  
  26. @synthesize window = _window;
  27.  
  28. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  29. {
  30. [FIRApp configure];
  31. self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
  32. self.launchOptions = launchOptions;
  33.  
  34. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  35. #ifdef DEBUG
  36. [self initializeReactNativeApp];
  37. #else
  38. EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance];
  39. controller.delegate = self;
  40. [controller startAndShowLaunchScreen:self.window];
  41. #endif
  42.  
  43. [super application:application didFinishLaunchingWithOptions:launchOptions];
  44.  
  45. return YES;
  46. }
  47.  
  48. - (RCTBridge *)initializeReactNativeApp
  49. {
  50. RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:self.launchOptions];
  51. RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
  52. rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  53.  
  54. UIViewController *rootViewController = [UIViewController new];
  55. rootViewController.view = rootView;
  56. self.window.rootViewController = rootViewController;
  57. [self.window makeKeyAndVisible];
  58.  
  59. return bridge;
  60. }
  61.  
  62. - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
  63. {
  64. NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
  65. // You can inject any extra modules that you would like here, more information at:
  66. // https://facebook.github.io/react-native/docs/native-modules-ios.html#dependency-injection
  67. return extraModules;
  68. }
  69.  
  70. - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
  71. #ifdef DEBUG
  72. return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  73. #else
  74. return [[EXUpdatesAppController sharedInstance] launchAssetUrl];
  75. #endif
  76. }
  77.  
  78. - (void)appController:(EXUpdatesAppController *)appController didStartWithSuccess:(BOOL)success
  79. {
  80. appController.bridge = [self initializeReactNativeApp];
  81. }
  82.  
  83. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement