Index: ios/chrome/browser/suggestions/suggestions_coordinator.mm |
diff --git a/ios/chrome/browser/suggestions/suggestions_coordinator.mm b/ios/chrome/browser/suggestions/suggestions_coordinator.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d00b22c150fc41844155cba68045b9b6fdf40ab0 |
--- /dev/null |
+++ b/ios/chrome/browser/suggestions/suggestions_coordinator.mm |
@@ -0,0 +1,69 @@ |
+// Copyright 2017 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/chrome/browser/suggestions/suggestions_coordinator.h" |
+ |
+#include "base/mac/scoped_nsobject.h" |
+#import "ios/chrome/browser/ui/suggestions/suggestions_commands.h" |
+#import "ios/chrome/browser/ui/suggestions/suggestions_view_controller.h" |
+#include "ios/chrome/grit/ios_strings.h" |
+#include "ui/base/l10n/l10n_util.h" |
+ |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
+@interface SuggestionsCoordinator ()<SuggestionsCommands> { |
+ UINavigationController* _navigationController; |
+} |
+ |
+@end |
+ |
+@implementation SuggestionsCoordinator |
+ |
+- (void)start { |
+ if (_navigationController) { |
+ // 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?
|
+ return; |
+ } |
+ |
+ SuggestionsViewController* suggestionsViewController = |
+ [[SuggestionsViewController alloc] |
+ initWithStyle:CollectionViewControllerStyleDefault]; |
+ |
+ suggestionsViewController.suggestionCommandHandler = self; |
+ _navigationController = [[UINavigationController alloc] |
+ initWithRootViewController:suggestionsViewController]; |
+ |
+ suggestionsViewController.navigationItem.leftBarButtonItem = |
+ [[UIBarButtonItem alloc] |
+ initWithTitle:l10n_util::GetNSString(IDS_IOS_SUGGESTIONS_DONE) |
+ style:UIBarButtonItemStylePlain |
+ target:self |
+ action:@selector(stop)]; |
+ |
+ [self.baseViewController presentViewController:_navigationController |
+ 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
|
+ completion:nil]; |
+} |
+ |
+- (void)stop { |
+ [[_navigationController presentingViewController] |
+ dismissViewControllerAnimated:YES |
+ completion:nil]; |
+ _navigationController = nil; |
+} |
+ |
+#pragma mark - SuggestionsCommands |
+ |
+- (void)openReadingList { |
+} |
+ |
+- (void)openFirstPageOfReadingList { |
+} |
+ |
+- (void)addEmptyItem { |
+} |
+ |
+@end |