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.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import "AppDelegate.h"
  10. #import <Crashlytics/Crashlytics.h>
  11. #import <Fabric/Fabric.h>
  12. #import "RCTBundleURLProvider.h"
  13. #import "RCTLinkingManager.h"
  14. #import "RCTRootView.h"
  15. @implementation AppDelegate
  16. // https://facebook.github.io/react-native/docs/linking.html
  17. - (BOOL)application:(UIApplication *)application
  18. continueUserActivity:(NSUserActivity *)userActivity
  19. restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler
  20. {
  21. return [RCTLinkingManager application:application
  22. continueUserActivity:userActivity
  23. restorationHandler:restorationHandler];
  24. }
  25. - (BOOL)application:(UIApplication *)application
  26. didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  27. {
  28. [Fabric with:@[[Crashlytics class]]];
  29. NSURL *jsCodeLocation
  30. = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios"
  31. fallbackResource:nil];
  32. RCTRootView *rootView
  33. = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
  34. moduleName:@"App"
  35. initialProperties:nil
  36. launchOptions:launchOptions];
  37. // Set a background color which is in accord with the JavaScript and Android
  38. // parts of the application and causes less perceived visual flicker than the
  39. // default background color.
  40. rootView.backgroundColor
  41. = [[UIColor alloc] initWithRed:.07f green:.07f blue:.07f alpha:1];
  42. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  43. UIViewController *rootViewController = [UIViewController new];
  44. rootViewController.view = rootView;
  45. self.window.rootViewController = rootViewController;
  46. [self.window makeKeyAndVisible];
  47. return YES;
  48. }
  49. // https://facebook.github.io/react-native/docs/linking.html
  50. - (BOOL)application:(UIApplication *)application
  51. openURL:(NSURL *)url
  52. sourceApplication:(NSString *)sourceApplication
  53. annotation:(id)annotation
  54. {
  55. return [RCTLinkingManager application:application
  56. openURL:url
  57. sourceApplication:sourceApplication
  58. annotation:annotation];
  59. }
  60. @end