OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/showcase/core/app_delegate.h" | 5 #import "ios/showcase/core/app_delegate.h" |
6 | 6 |
7 #import "ios/showcase/core/showcase_model.h" | 7 #import "ios/showcase/core/showcase_model.h" |
8 #import "ios/showcase/core/showcase_view_controller.h" | 8 #import "ios/showcase/core/showcase_view_controller.h" |
| 9 #import "ios/third_party/material_components_ios/src/components/Typography/src/M
aterialTypography.h" |
| 10 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MDCTypographyAd
ditions/MDFRobotoFontLoader+MDCTypographyAdditions.h" |
| 11 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF
ontLoader.h" |
9 | 12 |
10 #if !defined(__has_feature) || !__has_feature(objc_arc) | 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
11 #error "This file requires ARC support." | 14 #error "This file requires ARC support." |
12 #endif | 15 #endif |
13 | 16 |
14 @implementation AppDelegate | 17 @implementation AppDelegate |
15 @synthesize window = _window; | 18 @synthesize window = _window; |
16 | 19 |
17 - (BOOL)application:(UIApplication*)application | 20 - (BOOL)application:(UIApplication*)application |
18 didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { | 21 didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { |
19 // Override point for customization after application launch. | 22 [MDCTypography setFontLoader:[MDFRobotoFontLoader sharedInstance]]; |
20 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | 23 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; |
21 ShowcaseViewController* viewController = | 24 ShowcaseViewController* viewController = |
22 [[ShowcaseViewController alloc] initWithRows:[self rowsToDisplay]]; | 25 [[ShowcaseViewController alloc] initWithRows:[self rowsToDisplay]]; |
23 UINavigationController* navigationController = [[UINavigationController alloc] | 26 UINavigationController* navigationController = [[UINavigationController alloc] |
24 initWithRootViewController:viewController]; | 27 initWithRootViewController:viewController]; |
25 self.window.rootViewController = navigationController; | 28 self.window.rootViewController = navigationController; |
26 [self.window makeKeyAndVisible]; | 29 [self.window makeKeyAndVisible]; |
27 return YES; | 30 return YES; |
28 } | 31 } |
29 | 32 |
30 #pragma mark - Private | 33 #pragma mark - Private |
31 | 34 |
32 // Creates model data to display in the view controller. | 35 // Creates model data to display in the view controller. |
33 - (NSArray<showcase::ModelRow*>*)rowsToDisplay { | 36 - (NSArray<showcase::ModelRow*>*)rowsToDisplay { |
34 NSArray<showcase::ModelRow*>* rows = [ShowcaseModel model]; | 37 NSArray<showcase::ModelRow*>* rows = [ShowcaseModel model]; |
35 NSSortDescriptor* sortDescriptor = | 38 NSSortDescriptor* sortDescriptor = |
36 [NSSortDescriptor sortDescriptorWithKey:showcase::kClassForDisplayKey | 39 [NSSortDescriptor sortDescriptorWithKey:showcase::kClassForDisplayKey |
37 ascending:YES]; | 40 ascending:YES]; |
38 return [rows sortedArrayUsingDescriptors:@[ sortDescriptor ]]; | 41 return [rows sortedArrayUsingDescriptors:@[ sortDescriptor ]]; |
39 } | 42 } |
40 | 43 |
41 @end | 44 @end |
OLD | NEW |