Guest User

Untitled

a guest
Apr 14th, 2022
412
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. #import "AppDelegate.h"
  2. #import <React/RCTLinkingManager.h>
  3. #import <React/RCTBridge.h>
  4. #import <React/RCTBundleURLProvider.h>
  5. #import <React/RCTRootView.h>
  6.  
  7. #import <React/RCTAppSetupUtils.h>
  8.  
  9. #if RCT_NEW_ARCH_ENABLED
  10. #import <React/CoreModulesPlugins.h>
  11. #import <React/RCTCxxBridgeDelegate.h>
  12. #import <React/RCTFabricSurfaceHostingProxyRootView.h>
  13. #import <React/RCTSurfacePresenter.h>
  14. #import <React/RCTSurfacePresenterBridgeAdapter.h>
  15. #import <ReactCommon/RCTTurboModuleManager.h>
  16.  
  17. #import <react/config/ReactNativeConfig.h>
  18.  
  19. @interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
  20. RCTTurboModuleManager *_turboModuleManager;
  21. RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
  22. std::shared_ptr<const facebook::react::ReactNativeConfig> _reactNativeConfig;
  23. facebook::react::ContextContainer::Shared _contextContainer;
  24. }
  25. @end
  26. #endif
  27.  
  28. @implementation AppDelegate
  29. @synthesize authorizationFlowManagerDelegate;
  30.  
  31. - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *) options {
  32. if ([self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:url]) {
  33. return YES;
  34. }
  35. return [RCTLinkingManager application:app openURL:url options:options];
  36. }
  37.  
  38. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  39. {
  40. RCTAppSetupPrepareApp(application);
  41.  
  42. RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  43.  
  44. #if RCT_NEW_ARCH_ENABLED
  45. _contextContainer = std::make_shared<facebook::react::ContextContainer const>();
  46. _reactNativeConfig = std::make_shared<facebook::react::EmptyReactNativeConfig const>();
  47. _contextContainer->insert("ReactNativeConfig", _reactNativeConfig);
  48. _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer];
  49. bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
  50. #endif
  51.  
  52. UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"VedaxLink", nil);
  53.  
  54. if (@available(iOS 13.0, *)) {
  55. rootView.backgroundColor = [UIColor systemBackgroundColor];
  56. } else {
  57. rootView.backgroundColor = [UIColor whiteColor];
  58. }
  59.  
  60. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  61. UIViewController *rootViewController = [UIViewController new];
  62. rootViewController.view = rootView;
  63. self.window.rootViewController = rootViewController;
  64. [self.window makeKeyAndVisible];
  65. return YES;
  66. }
  67.  
  68. - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
  69. {
  70. #if DEBUG
  71. return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
  72. #else
  73. return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  74. #endif
  75. }
  76.  
  77. #if RCT_NEW_ARCH_ENABLED
  78.  
  79. #pragma mark - RCTCxxBridgeDelegate
  80.  
  81. - (std::unique_ptr<facebook::react::JSExecutorFactory>)jsExecutorFactoryForBridge:(RCTBridge *)bridge
  82. {
  83. _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge
  84. delegate:self
  85. jsInvoker:bridge.jsCallInvoker];
  86. return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager);
  87. }
  88.  
  89. #pragma mark RCTTurboModuleManagerDelegate
  90.  
  91. - (Class)getModuleClassFromName:(const char *)name
  92. {
  93. return RCTCoreModulesClassProvider(name);
  94. }
  95.  
  96. - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
  97. jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
  98. {
  99. return nullptr;
  100. }
  101.  
  102. - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
  103. initParams:
  104. (const facebook::react::ObjCTurboModule::InitParams &)params
  105. {
  106. return nullptr;
  107. }
  108.  
  109. - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
  110. {
  111. return RCTAppSetupDefaultModuleFromClass(moduleClass);
  112. }
  113.  
  114. #endif
  115.  
  116. @end
  117.  
  118.  
Advertisement
Add Comment
Please, Sign In to add comment