xref: /aosp_15_r20/external/webrtc/examples/objc/AppRTCMobile/ios/ARDAppDelegate.m (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker/*
2*d9f75844SAndroid Build Coastguard Worker *  Copyright 2013 The WebRTC Project Authors. All rights reserved.
3*d9f75844SAndroid Build Coastguard Worker *
4*d9f75844SAndroid Build Coastguard Worker *  Use of this source code is governed by a BSD-style license
5*d9f75844SAndroid Build Coastguard Worker *  that can be found in the LICENSE file in the root of the source
6*d9f75844SAndroid Build Coastguard Worker *  tree. An additional intellectual property rights grant can be found
7*d9f75844SAndroid Build Coastguard Worker *  in the file PATENTS.  All contributing project authors may
8*d9f75844SAndroid Build Coastguard Worker *  be found in the AUTHORS file in the root of the source tree.
9*d9f75844SAndroid Build Coastguard Worker */
10*d9f75844SAndroid Build Coastguard Worker
11*d9f75844SAndroid Build Coastguard Worker#import "ARDAppDelegate.h"
12*d9f75844SAndroid Build Coastguard Worker
13*d9f75844SAndroid Build Coastguard Worker#import "sdk/objc/api/peerconnection/RTCFieldTrials.h"
14*d9f75844SAndroid Build Coastguard Worker#import "sdk/objc/api/peerconnection/RTCSSLAdapter.h"
15*d9f75844SAndroid Build Coastguard Worker#import "sdk/objc/api/peerconnection/RTCTracing.h"
16*d9f75844SAndroid Build Coastguard Worker#import "sdk/objc/base/RTCLogging.h"
17*d9f75844SAndroid Build Coastguard Worker
18*d9f75844SAndroid Build Coastguard Worker#import "ARDMainViewController.h"
19*d9f75844SAndroid Build Coastguard Worker
20*d9f75844SAndroid Build Coastguard Worker@implementation ARDAppDelegate {
21*d9f75844SAndroid Build Coastguard Worker  UIWindow *_window;
22*d9f75844SAndroid Build Coastguard Worker}
23*d9f75844SAndroid Build Coastguard Worker
24*d9f75844SAndroid Build Coastguard Worker#pragma mark - UIApplicationDelegate methods
25*d9f75844SAndroid Build Coastguard Worker
26*d9f75844SAndroid Build Coastguard Worker- (BOOL)application:(UIApplication *)application
27*d9f75844SAndroid Build Coastguard Worker    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
28*d9f75844SAndroid Build Coastguard Worker  NSDictionary *fieldTrials = @{};
29*d9f75844SAndroid Build Coastguard Worker  RTCInitFieldTrialDictionary(fieldTrials);
30*d9f75844SAndroid Build Coastguard Worker  RTCInitializeSSL();
31*d9f75844SAndroid Build Coastguard Worker  RTCSetupInternalTracer();
32*d9f75844SAndroid Build Coastguard Worker  _window =  [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
33*d9f75844SAndroid Build Coastguard Worker  [_window makeKeyAndVisible];
34*d9f75844SAndroid Build Coastguard Worker  ARDMainViewController *viewController = [[ARDMainViewController alloc] init];
35*d9f75844SAndroid Build Coastguard Worker
36*d9f75844SAndroid Build Coastguard Worker  UINavigationController *root =
37*d9f75844SAndroid Build Coastguard Worker      [[UINavigationController alloc] initWithRootViewController:viewController];
38*d9f75844SAndroid Build Coastguard Worker  root.navigationBar.translucent = NO;
39*d9f75844SAndroid Build Coastguard Worker  _window.rootViewController = root;
40*d9f75844SAndroid Build Coastguard Worker
41*d9f75844SAndroid Build Coastguard Worker#if defined(NDEBUG)
42*d9f75844SAndroid Build Coastguard Worker  // In debug builds the default level is LS_INFO and in non-debug builds it is
43*d9f75844SAndroid Build Coastguard Worker  // disabled. Continue to log to console in non-debug builds, but only
44*d9f75844SAndroid Build Coastguard Worker  // warnings and errors.
45*d9f75844SAndroid Build Coastguard Worker  RTCSetMinDebugLogLevel(RTCLoggingSeverityWarning);
46*d9f75844SAndroid Build Coastguard Worker#endif
47*d9f75844SAndroid Build Coastguard Worker
48*d9f75844SAndroid Build Coastguard Worker  return YES;
49*d9f75844SAndroid Build Coastguard Worker}
50*d9f75844SAndroid Build Coastguard Worker
51*d9f75844SAndroid Build Coastguard Worker- (void)applicationWillTerminate:(UIApplication *)application {
52*d9f75844SAndroid Build Coastguard Worker  RTCShutdownInternalTracer();
53*d9f75844SAndroid Build Coastguard Worker  RTCCleanupSSL();
54*d9f75844SAndroid Build Coastguard Worker}
55*d9f75844SAndroid Build Coastguard Worker
56*d9f75844SAndroid Build Coastguard Worker@end
57