forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsc_content_suggestions_coordinator.mm
52 lines (37 loc) · 1.83 KB
/
sc_content_suggestions_coordinator.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/showcase/content_suggestions/sc_content_suggestions_coordinator.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_commands.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h"
#import "ios/showcase/common/protocol_alerter.h"
#import "ios/showcase/content_suggestions/sc_content_suggestions_data_source.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface SCContentSuggestionsCoordinator ()
@property(nonatomic, strong)
ContentSuggestionsViewController* suggestionViewController;
@property(nonatomic, strong) ProtocolAlerter* alerter;
@property(nonatomic, strong) SCContentSuggestionsDataSource* dataSource;
@end
@implementation SCContentSuggestionsCoordinator
@synthesize baseViewController;
@synthesize suggestionViewController = _suggestionViewController;
@synthesize alerter = _alerter;
@synthesize dataSource = _dataSource;
#pragma mark - Coordinator
- (void)start {
self.alerter = [[ProtocolAlerter alloc]
initWithProtocols:@[ @protocol(ContentSuggestionsCommands) ]];
self.alerter.baseViewController = self.baseViewController;
_dataSource = [[SCContentSuggestionsDataSource alloc] init];
_suggestionViewController = [[ContentSuggestionsViewController alloc]
initWithStyle:CollectionViewControllerStyleDefault];
[_suggestionViewController setDataSource:_dataSource];
_suggestionViewController.suggestionCommandHandler =
reinterpret_cast<id<ContentSuggestionsCommands>>(self.alerter);
[self.baseViewController pushViewController:_suggestionViewController
animated:YES];
}
@end