| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 #if !defined(__has_feature) || !__has_feature(objc_arc) | 5 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 6 #error "This file requires ARC support." | 6 #error "This file requires ARC support." |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #import "remoting/ios/app/remoting_view_controller.h" | 9 #import "remoting/ios/app/remoting_view_controller.h" |
| 10 | 10 |
| 11 #import "base/mac/bind_objc_block.h" | 11 #import "base/mac/bind_objc_block.h" |
| 12 #import "ios/third_party/material_components_ios/src/components/AnimationTiming/
src/MaterialAnimationTiming.h" | 12 #import "ios/third_party/material_components_ios/src/components/AnimationTiming/
src/MaterialAnimationTiming.h" |
| 13 #import "ios/third_party/material_components_ios/src/components/AppBar/src/Mater
ialAppBar.h" | 13 #import "ios/third_party/material_components_ios/src/components/AppBar/src/Mater
ialAppBar.h" |
| 14 #import "ios/third_party/material_components_ios/src/components/Dialogs/src/Mate
rialDialogs.h" | 14 #import "ios/third_party/material_components_ios/src/components/Dialogs/src/Mate
rialDialogs.h" |
| 15 #import "ios/third_party/material_components_ios/src/components/Snackbar/src/Mat
erialSnackbar.h" | 15 #import "ios/third_party/material_components_ios/src/components/Snackbar/src/Mat
erialSnackbar.h" |
| 16 #import "remoting/ios/app/client_connection_view_controller.h" | 16 #import "remoting/ios/app/client_connection_view_controller.h" |
| 17 #import "remoting/ios/app/host_collection_view_controller.h" | 17 #import "remoting/ios/app/host_collection_view_controller.h" |
| 18 #import "remoting/ios/app/host_view_controller.h" | 18 #import "remoting/ios/app/host_view_controller.h" |
| 19 #import "remoting/ios/app/remoting_settings_view_controller.h" | 19 #import "remoting/ios/app/remoting_settings_view_controller.h" |
| 20 #import "remoting/ios/app/remoting_theme.h" |
| 20 #import "remoting/ios/domain/client_session_details.h" | 21 #import "remoting/ios/domain/client_session_details.h" |
| 21 #import "remoting/ios/facade/remoting_authentication.h" | 22 #import "remoting/ios/facade/remoting_authentication.h" |
| 22 #import "remoting/ios/facade/remoting_service.h" | 23 #import "remoting/ios/facade/remoting_service.h" |
| 23 | 24 |
| 24 #include "base/strings/sys_string_conversions.h" | 25 #include "base/strings/sys_string_conversions.h" |
| 25 #include "remoting/base/oauth_token_getter.h" | 26 #include "remoting/base/oauth_token_getter.h" |
| 26 #include "remoting/client/connect_to_host_info.h" | 27 #include "remoting/client/connect_to_host_info.h" |
| 27 | 28 |
| 28 static CGFloat kHostInset = 5.f; | 29 static CGFloat kHostInset = 5.f; |
| 29 | 30 |
| 30 static UIColor* kChromotingBlueBackground = | |
| 31 [UIColor colorWithRed:0.11f green:0.23f blue:0.66f alpha:1.f]; | |
| 32 | |
| 33 @interface RemotingViewController ()<HostCollectionViewControllerDelegate, | 31 @interface RemotingViewController ()<HostCollectionViewControllerDelegate, |
| 34 UIViewControllerAnimatedTransitioning, | 32 UIViewControllerAnimatedTransitioning, |
| 35 UIViewControllerTransitioningDelegate> { | 33 UIViewControllerTransitioningDelegate> { |
| 36 bool _isAuthenticated; | 34 bool _isAuthenticated; |
| 37 MDCDialogTransitionController* _dialogTransitionController; | 35 MDCDialogTransitionController* _dialogTransitionController; |
| 38 MDCAppBar* _appBar; | 36 MDCAppBar* _appBar; |
| 39 HostCollectionViewController* _collectionViewController; | 37 HostCollectionViewController* _collectionViewController; |
| 40 RemotingService* _remotingService; | 38 RemotingService* _remotingService; |
| 41 } | 39 } |
| 42 @end | 40 @end |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 self.navigationItem.leftBarButtonItem = menuButton; | 76 self.navigationItem.leftBarButtonItem = menuButton; |
| 79 | 77 |
| 80 UIBarButtonItem* refreshButton = [[UIBarButtonItem alloc] | 78 UIBarButtonItem* refreshButton = [[UIBarButtonItem alloc] |
| 81 initWithImage:[UIImage imageNamed:@"ic_refresh"] | 79 initWithImage:[UIImage imageNamed:@"ic_refresh"] |
| 82 style:UIBarButtonItemStyleDone | 80 style:UIBarButtonItemStyleDone |
| 83 target:self | 81 target:self |
| 84 action:@selector(didSelectRefresh)]; | 82 action:@selector(didSelectRefresh)]; |
| 85 self.navigationItem.rightBarButtonItem = refreshButton; | 83 self.navigationItem.rightBarButtonItem = refreshButton; |
| 86 | 84 |
| 87 _appBar.headerViewController.headerView.backgroundColor = | 85 _appBar.headerViewController.headerView.backgroundColor = |
| 88 kChromotingBlueBackground; | 86 RemotingTheme.hostListBackgroundColor; |
| 89 _appBar.navigationBar.backgroundColor = kChromotingBlueBackground; | 87 _appBar.navigationBar.backgroundColor = |
| 88 RemotingTheme.hostListBackgroundColor; |
| 90 MDCNavigationBarTextColorAccessibilityMutator* mutator = | 89 MDCNavigationBarTextColorAccessibilityMutator* mutator = |
| 91 [[MDCNavigationBarTextColorAccessibilityMutator alloc] init]; | 90 [[MDCNavigationBarTextColorAccessibilityMutator alloc] init]; |
| 92 [mutator mutate:_appBar.navigationBar]; | 91 [mutator mutate:_appBar.navigationBar]; |
| 93 } | 92 } |
| 94 return self; | 93 return self; |
| 95 } | 94 } |
| 96 | 95 |
| 97 #pragma mark - UIViewController | 96 #pragma mark - UIViewController |
| 98 | 97 |
| 99 - (void)viewDidLoad { | 98 - (void)viewDidLoad { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 189 |
| 191 - (void)didSelectCell:(HostCollectionViewCell*)cell | 190 - (void)didSelectCell:(HostCollectionViewCell*)cell |
| 192 completion:(void (^)())completionBlock { | 191 completion:(void (^)())completionBlock { |
| 193 if (![cell.hostInfo isOnline]) { | 192 if (![cell.hostInfo isOnline]) { |
| 194 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; | 193 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; |
| 195 message.text = @"Host is offline."; | 194 message.text = @"Host is offline."; |
| 196 [MDCSnackbarManager showMessage:message]; | 195 [MDCSnackbarManager showMessage:message]; |
| 197 return; | 196 return; |
| 198 } | 197 } |
| 199 | 198 |
| 199 [MDCSnackbarManager dismissAndCallCompletionBlocksWithCategory:nil]; |
| 200 ClientConnectionViewController* clientConnectionViewController = | 200 ClientConnectionViewController* clientConnectionViewController = |
| 201 [[ClientConnectionViewController alloc] initWithHostInfo:cell.hostInfo]; | 201 [[ClientConnectionViewController alloc] initWithHostInfo:cell.hostInfo]; |
| 202 [self.navigationController pushViewController:clientConnectionViewController | 202 [self.navigationController pushViewController:clientConnectionViewController |
| 203 animated:YES]; | 203 animated:YES]; |
| 204 completionBlock(); | 204 completionBlock(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 - (NSInteger)getHostCount { | 207 - (NSInteger)getHostCount { |
| 208 return _remotingService.hosts.count; | 208 return _remotingService.hosts.count; |
| 209 } | 209 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; | 262 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; |
| 263 if (_isAuthenticated) { | 263 if (_isAuthenticated) { |
| 264 message.text = [NSString | 264 message.text = [NSString |
| 265 stringWithFormat:@"Currently signed in as %@.", | 265 stringWithFormat:@"Currently signed in as %@.", |
| 266 _remotingService.authentication.user.userEmail]; | 266 _remotingService.authentication.user.userEmail]; |
| 267 [MDCSnackbarManager showMessage:message]; | 267 [MDCSnackbarManager showMessage:message]; |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 @end | 271 @end |
| OLD | NEW |