12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- #import "AppDelegate.h"
- #import "AVFoundation/AVFoundation.h"
- #import <React/RCTBridge.h>
- #import <React/RCTBundleURLProvider.h>
- #import <React/RCTRootView.h>
- #import <React/RCTLinkingManager.h>
- #import <React/RCTConvert.h>
- // #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
- // #import <FlipperKit/FlipperClient.h>
- // #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
- // #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
- // #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
- // #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
- //#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
- // static void InitializeFlipper(UIApplication *application) {
- // FlipperClient *client = [FlipperClient sharedClient];
- // SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
- // [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
- // [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
- // [client addPlugin:[FlipperKitReactPlugin new]];
- // [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
- // [client start];
- // }
- //#endif
- @implementation AppDelegate
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- // #if defined(FB_SONARKIT_ENABLED) && __has_include(<FlipperKit/FlipperClient.h>)
- // InitializeFlipper(application);
- //#endif
- AVAudioSession *session = [AVAudioSession sharedInstance];
- [session setCategory:AVAudioSessionCategoryPlayAndRecord
- mode:AVAudioSessionModeDefault
- options:AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowAirPlay | AVAudioSessionCategoryOptionAllowBluetoothA2DP | AVAudioSessionCategoryOptionAllowBluetooth
- error:nil];
- [session setActive:YES error:nil];
-
- RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
- RCTRootView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
- id rootViewBackgroundColor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"RCTRootViewBackgroundColor"];
- if (rootViewBackgroundColor != nil) {
- rootView.backgroundColor = [RCTConvert UIColor:rootViewBackgroundColor];
- } else {
- rootView.backgroundColor = [UIColor whiteColor];
- }
- self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- UIViewController *rootViewController = [self.reactDelegate createRootViewController];
- rootViewController.view = rootView;
- self.window.rootViewController = rootViewController;
- [self.window makeKeyAndVisible];
- [super application:application didFinishLaunchingWithOptions:launchOptions];
- return YES;
- }
- - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
- {
- // If you'd like to export some custom RCTBridgeModules, add them here!
- return @[];
- }
- - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
- #ifdef DEBUG
- return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
- #else
- return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
- #endif
- }
- // Linking API
- - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
- return [RCTLinkingManager application:application openURL:url options:options];
- }
- // Universal Links
- - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
- return [RCTLinkingManager application:application
- continueUserActivity:userActivity
- restorationHandler:restorationHandler];
- }
- @end
|