| // Copyright 2021 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/ui/first_run/sync_screen_coordinator.h" |
| |
| #include "ios/chrome/browser/main/browser.h" |
| #import "ios/chrome/browser/ui/first_run/sync_screen_view_controller.h" |
| |
| #if !defined(__has_feature) || !__has_feature(objc_arc) |
| #error "This file requires ARC support." |
| #endif |
| |
| @interface SyncScreenCoordinator () <SyncScreenViewControllerDelegate> |
| |
| // Sync screen view controller. |
| @property(nonatomic, strong) SyncScreenViewController* viewController; |
| |
| @property(nonatomic, weak) id<FirstRunScreenDelegate> delegate; |
| |
| @end |
| |
| @implementation SyncScreenCoordinator |
| |
| @synthesize baseNavigationController = _baseNavigationController; |
| |
| - (instancetype)initWithBaseNavigationController: |
| (UINavigationController*)navigationController |
| browser:(Browser*)browser |
| delegate:(id<FirstRunScreenDelegate>) |
| delegate { |
| self = [super initWithBaseViewController:navigationController |
| browser:browser]; |
| if (self) { |
| _baseNavigationController = navigationController; |
| _delegate = delegate; |
| } |
| return self; |
| } |
| |
| - (void)start { |
| // TODO(crbug.com/1189840): Check if sync screen need to be shown. |
| // if not: |
| // [self.delegate willFinishPresenting] |
| // if yes: |
| self.viewController = [[SyncScreenViewController alloc] init]; |
| self.viewController.delegate = self; |
| BOOL animated = self.baseNavigationController.topViewController != nil; |
| [self.baseNavigationController setViewControllers:@[ self.viewController ] |
| animated:animated]; |
| } |
| |
| - (void)stop { |
| self.delegate = nil; |
| self.viewController = nil; |
| } |
| |
| #pragma mark - SyncScreenViewControllerDelegate |
| |
| - (void)didTapPrimaryActionButton { |
| // TODO(crbug.com/1189840): record sync status. |
| |
| [self.delegate willFinishPresenting]; |
| } |
| |
| - (void)showSyncSettings { |
| // TODO(crbug.com/1189840): show sync settings. |
| } |
| |
| @end |