Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import "ios/chrome/browser/suggestions/suggestions_coordinator.h" | |
| 6 | |
| 7 #include "base/mac/scoped_nsobject.h" | |
| 8 #import "ios/chrome/browser/ui/suggestions/suggestions_commands.h" | |
| 9 #import "ios/chrome/browser/ui/suggestions/suggestions_view_controller.h" | |
| 10 #include "ios/chrome/grit/ios_strings.h" | |
| 11 #include "ui/base/l10n/l10n_util.h" | |
| 12 | |
| 13 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 14 #error "This file requires ARC support." | |
| 15 #endif | |
| 16 | |
| 17 @interface SuggestionsCoordinator ()<SuggestionsCommands> { | |
| 18 UINavigationController* _navigationController; | |
| 19 } | |
| 20 | |
| 21 @end | |
| 22 | |
| 23 @implementation SuggestionsCoordinator | |
| 24 | |
| 25 - (void)start { | |
| 26 if (_navigationController) { | |
| 27 // Prevent this coordinator to be started twice in a row. | |
|
marq (ping after 24h)
2017/01/19 16:32:31
Ideally this would be the problem of the code that
gambard
2017/01/19 17:50:12
I can add a "running" property and check it in the
lpromero
2017/01/19 18:49:13
I think there is a fundamental problem here: the B
gambard
2017/01/20 07:37:43
In the normal case, the suggestion UI has a "done"
lpromero
2017/01/20 08:58:02
Ah missed that one! I think I looked for " stop];"
lpromero
2017/01/20 08:58:02
At some point in the New Architecture we'll need t
gambard
2017/01/20 12:22:17
For now the parent is BVC, not sure that adding co
marq (ping after 24h)
2017/01/20 12:34:46
Again, I think the object creating the coordinator
gambard
2017/01/23 09:45:54
As we discussed it, what solution do you suggest?
| |
| 28 return; | |
| 29 } | |
| 30 | |
| 31 SuggestionsViewController* suggestionsViewController = | |
| 32 [[SuggestionsViewController alloc] | |
| 33 initWithStyle:CollectionViewControllerStyleDefault]; | |
| 34 | |
| 35 suggestionsViewController.suggestionCommandHandler = self; | |
| 36 _navigationController = [[UINavigationController alloc] | |
| 37 initWithRootViewController:suggestionsViewController]; | |
| 38 | |
| 39 suggestionsViewController.navigationItem.leftBarButtonItem = | |
| 40 [[UIBarButtonItem alloc] | |
| 41 initWithTitle:l10n_util::GetNSString(IDS_IOS_SUGGESTIONS_DONE) | |
| 42 style:UIBarButtonItemStylePlain | |
| 43 target:self | |
| 44 action:@selector(stop)]; | |
| 45 | |
| 46 [self.baseViewController presentViewController:_navigationController | |
| 47 animated:YES | |
|
marq (ping after 24h)
2017/01/19 16:32:32
self.context.animated? Not sure if that landed yet
lpromero
2017/01/19 17:42:40
Not yet in ios/chrome. I will make a new pass when
| |
| 48 completion:nil]; | |
| 49 } | |
| 50 | |
| 51 - (void)stop { | |
| 52 [[_navigationController presentingViewController] | |
| 53 dismissViewControllerAnimated:YES | |
| 54 completion:nil]; | |
| 55 _navigationController = nil; | |
| 56 } | |
| 57 | |
| 58 #pragma mark - SuggestionsCommands | |
| 59 | |
| 60 - (void)openReadingList { | |
| 61 } | |
| 62 | |
| 63 - (void)openFirstPageOfReadingList { | |
| 64 } | |
| 65 | |
| 66 - (void)addEmptyItem { | |
| 67 } | |
| 68 | |
| 69 @end | |
| OLD | NEW |