fbshipit-source-id: b6fc29740c6875d2e78953b8a7123890a67930f2 Co-authored-by: Sebastian McKenzie <sebmck@fb.com> Co-authored-by: John Knox <jknox@fb.com> Co-authored-by: Emil Sjölander <emilsj@fb.com> Co-authored-by: Pritesh Nandgaonkar <prit91@fb.com>
54 lines
2.1 KiB
Plaintext
54 lines
2.1 KiB
Plaintext
/*
|
|
* Copyright (c) 2018-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the LICENSE
|
|
* file in the root directory of this source tree.
|
|
*
|
|
*/
|
|
#import "AppDelegate.h"
|
|
|
|
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
|
|
#import <SonarKit/SonarClient.h>
|
|
#import <SonarKitLayoutComponentKitSupport/SonarKitLayoutComponentKitSupport.h>
|
|
#import <SonarKitLayoutPlugin/SonarKitLayoutPlugin.h>
|
|
#import <SonarKitNetworkPlugin/SonarKitNetworkPlugin.h>
|
|
|
|
#import "MainViewController.h"
|
|
#import "RootViewController.h"
|
|
|
|
#if !FB_SONARKIT_ENABLED
|
|
#error "Sample need to be run with SonarKit enabled in order to properly interact with Sonar. SonarKit is enabled by default if its a debug build."
|
|
#endif
|
|
|
|
@implementation AppDelegate {
|
|
UIWindow *_window;
|
|
}
|
|
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
{
|
|
_window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
|
|
|
SonarClient *client = [SonarClient sharedClient];
|
|
|
|
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
|
|
[SonarKitLayoutComponentKitSupport setUpWithDescriptorMapper: layoutDescriptorMapper];
|
|
[client addPlugin: [[SonarKitLayoutPlugin alloc] initWithRootNode: application
|
|
withDescriptorMapper: layoutDescriptorMapper]];
|
|
|
|
[[SonarClient sharedClient] addPlugin: [[SonarKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
|
|
[[SonarClient sharedClient] start];
|
|
|
|
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryBoard" bundle:nil];
|
|
MainViewController *mainViewController = [storyboard instantiateViewControllerWithIdentifier:@"MainViewController"];
|
|
|
|
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController: mainViewController];
|
|
navigationController.navigationBar.topItem.title = @"Sample";
|
|
navigationController.navigationBar.translucent = NO;
|
|
|
|
[_window setRootViewController: [[UINavigationController alloc] initWithRootViewController: mainViewController]];
|
|
[_window makeKeyAndVisible];
|
|
return YES;
|
|
}
|
|
|
|
@end
|