Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

63 rader
2.3 KiB

  1. #import "AppDelegate.h"
  2. #import <React/RCTBridge.h>
  3. #import <React/RCTBundleURLProvider.h>
  4. #import <React/RCTRootView.h>
  5. #ifdef FB_SONARKIT_ENABLED
  6. #import <FlipperKit/FlipperClient.h>
  7. #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
  8. #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
  9. #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
  10. #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
  11. #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
  12. static void InitializeFlipper(UIApplication *application) {
  13. FlipperClient *client = [FlipperClient sharedClient];
  14. SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
  15. [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
  16. [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
  17. [client addPlugin:[FlipperKitReactPlugin new]];
  18. [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
  19. [client start];
  20. }
  21. #endif
  22. @implementation AppDelegate
  23. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  24. {
  25. #ifdef FB_SONARKIT_ENABLED
  26. InitializeFlipper(application);
  27. #endif
  28. RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  29. RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
  30. moduleName:@"LessPass"
  31. initialProperties:nil];
  32. if (@available(iOS 13.0, *)) {
  33. rootView.backgroundColor = [UIColor systemBackgroundColor];
  34. } else {
  35. rootView.backgroundColor = [UIColor whiteColor];
  36. }
  37. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  38. UIViewController *rootViewController = [UIViewController new];
  39. rootViewController.view = rootView;
  40. self.window.rootViewController = rootViewController;
  41. [self.window makeKeyAndVisible];
  42. return YES;
  43. }
  44. - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
  45. {
  46. #if DEBUG
  47. return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  48. #else
  49. return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  50. #endif
  51. }
  52. @end