| 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/app_delegate.h" |
| 16 #import "remoting/ios/app/client_connection_view_controller.h" | 17 #import "remoting/ios/app/client_connection_view_controller.h" |
| 17 #import "remoting/ios/app/host_collection_view_controller.h" | 18 #import "remoting/ios/app/host_collection_view_controller.h" |
| 18 #import "remoting/ios/app/host_view_controller.h" | 19 #import "remoting/ios/app/host_view_controller.h" |
| 19 #import "remoting/ios/app/remoting_menu_view_controller.h" | 20 #import "remoting/ios/app/remoting_menu_view_controller.h" |
| 20 #import "remoting/ios/app/remoting_theme.h" | 21 #import "remoting/ios/app/remoting_theme.h" |
| 21 #import "remoting/ios/domain/client_session_details.h" | 22 #import "remoting/ios/domain/client_session_details.h" |
| 22 #import "remoting/ios/facade/remoting_authentication.h" | 23 #import "remoting/ios/facade/remoting_authentication.h" |
| 23 #import "remoting/ios/facade/remoting_service.h" | 24 #import "remoting/ios/facade/remoting_service.h" |
| 24 | 25 |
| 25 #include "base/strings/sys_string_conversions.h" | 26 #include "base/strings/sys_string_conversions.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 - (void)viewWillAppear:(BOOL)animated { | 129 - (void)viewWillAppear:(BOOL)animated { |
| 129 [super viewWillAppear:animated]; | 130 [super viewWillAppear:animated]; |
| 130 | 131 |
| 131 [self nowAuthenticated:_remotingService.authentication.user.isAuthenticated]; | 132 [self nowAuthenticated:_remotingService.authentication.user.isAuthenticated]; |
| 132 [self presentStatus]; | 133 [self presentStatus]; |
| 133 } | 134 } |
| 134 | 135 |
| 135 - (void)viewDidAppear:(BOOL)animated { | 136 - (void)viewDidAppear:(BOOL)animated { |
| 136 [super viewDidAppear:animated]; | 137 [super viewDidAppear:animated]; |
| 137 if (!_isAuthenticated) { | 138 if (!_isAuthenticated) { |
| 138 // TODO(nicholss): This is used as a demo of the app functionality for the | 139 [AppDelegate.instance requestSignIn]; |
| 139 // moment but the real app will force the login flow if unauthenticated. | |
| 140 [self didSelectMenu]; | |
| 141 // [self didSelectRefresh]; | |
| 142 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; | 140 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; |
| 143 message.text = @"Please login."; | 141 message.text = @"Please login."; |
| 144 [MDCSnackbarManager showMessage:message]; | 142 [MDCSnackbarManager showMessage:message]; |
| 145 } else { | 143 } else { |
| 146 [_remotingService requestHostListFetch]; | 144 [_remotingService requestHostListFetch]; |
| 147 } | 145 } |
| 148 } | 146 } |
| 149 | 147 |
| 150 - (UIStatusBarStyle)preferredStatusBarStyle { | 148 - (UIStatusBarStyle)preferredStatusBarStyle { |
| 151 return UIStatusBarStyleLightContent; | 149 return UIStatusBarStyleLightContent; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 [self dismissViewControllerAnimated:true completion:nil]; | 242 [self dismissViewControllerAnimated:true completion:nil]; |
| 245 } | 243 } |
| 246 | 244 |
| 247 - (void)didSelectRefresh { | 245 - (void)didSelectRefresh { |
| 248 // TODO(nicholss): Might want to rate limit this. Maybe remoting service | 246 // TODO(nicholss): Might want to rate limit this. Maybe remoting service |
| 249 // controls that. | 247 // controls that. |
| 250 [_remotingService requestHostListFetch]; | 248 [_remotingService requestHostListFetch]; |
| 251 } | 249 } |
| 252 | 250 |
| 253 - (void)didSelectMenu { | 251 - (void)didSelectMenu { |
| 254 RemotingMenuViewController* menuViewController = | 252 [AppDelegate.instance setMenuVisible:YES animated:YES]; |
| 255 [[RemotingMenuViewController alloc] init]; | |
| 256 [self presentViewController:menuViewController animated:YES completion:nil]; | |
| 257 } | 253 } |
| 258 | 254 |
| 259 - (void)presentStatus { | 255 - (void)presentStatus { |
| 260 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; | 256 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; |
| 261 if (_isAuthenticated) { | 257 if (_isAuthenticated) { |
| 262 message.text = [NSString | 258 message.text = [NSString |
| 263 stringWithFormat:@"Currently signed in as %@.", | 259 stringWithFormat:@"Currently signed in as %@.", |
| 264 _remotingService.authentication.user.userEmail]; | 260 _remotingService.authentication.user.userEmail]; |
| 265 [MDCSnackbarManager showMessage:message]; | 261 [MDCSnackbarManager showMessage:message]; |
| 266 } | 262 } |
| 267 } | 263 } |
| 268 | 264 |
| 269 @end | 265 @end |
| OLD | NEW |