Application Android et IOS pour l'amicale des élèves
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AppDelegate.m 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. #import "AppDelegate.h"
  8. #import <React/RCTBundleURLProvider.h>
  9. #import <React/RCTRootView.h>
  10. #import <UMCore/UMModuleRegistry.h>
  11. #import <UMReactNativeAdapter/UMNativeModulesProxy.h>
  12. #import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
  13. @interface AppDelegate ()
  14. @property (nonatomic, strong) NSDictionary *launchOptions;
  15. @end
  16. @implementation AppDelegate
  17. @synthesize window = _window;
  18. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  19. {
  20. self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
  21. self.launchOptions = launchOptions;
  22. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  23. #ifdef DEBUG
  24. [self initializeReactNativeApp];
  25. #else
  26. EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance];
  27. controller.delegate = self;
  28. [controller startAndShowLaunchScreen:self.window];
  29. #endif
  30. [super application:application didFinishLaunchingWithOptions:launchOptions];
  31. return YES;
  32. }
  33. - (RCTBridge *)initializeReactNativeApp
  34. {
  35. RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:self.launchOptions];
  36. RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"main" initialProperties:nil];
  37. rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  38. UIViewController *rootViewController = [UIViewController new];
  39. rootViewController.view = rootView;
  40. self.window.rootViewController = rootViewController;
  41. [self.window makeKeyAndVisible];
  42. return bridge;
  43. }
  44. - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
  45. {
  46. NSArray<id<RCTBridgeModule>> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge];
  47. // You can inject any extra modules that you would like here, more information at:
  48. // https://facebook.github.io/react-native/docs/native-modules-ios.html#dependency-injection
  49. return extraModules;
  50. }
  51. - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
  52. #ifdef DEBUG
  53. return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  54. #else
  55. return [[EXUpdatesAppController sharedInstance] launchAssetUrl];
  56. #endif
  57. }
  58. - (void)appController:(EXUpdatesAppController *)appController didStartWithSuccess:(BOOL)success
  59. {
  60. appController.bridge = [self initializeReactNativeApp];
  61. }
  62. @end