| 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/client/ios/app/remoting_view_controller.h" | 9 #import "remoting/client/ios/app/remoting_view_controller.h" |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // TODO(nicholss): This is used as a demo of the app functionality for the | 99 // TODO(nicholss): This is used as a demo of the app functionality for the |
| 100 // moment but the real app will force the login flow if unauthenticated. | 100 // moment but the real app will force the login flow if unauthenticated. |
| 101 [self didSelectSettings]; | 101 [self didSelectSettings]; |
| 102 // [self didSelectRefresh]; | 102 // [self didSelectRefresh]; |
| 103 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; | 103 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; |
| 104 message.text = @"Please login."; | 104 message.text = @"Please login."; |
| 105 [MDCSnackbarManager showMessage:message]; | 105 [MDCSnackbarManager showMessage:message]; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 - (void)viewDidLayoutSubviews { |
| 110 [super viewDidLayoutSubviews]; |
| 111 |
| 112 // Adjust the collection view's position and size so that it doesn't get |
| 113 // overlayed by the navigation bar. |
| 114 CGFloat collectionOffsetY = |
| 115 _appBar.headerViewController.headerView.frame.size.height; |
| 116 CGFloat collectionHeight = self.view.bounds.size.height - collectionOffsetY; |
| 117 CGRect oldFrame = _collectionViewController.collectionView.frame; |
| 118 _collectionViewController.collectionView.frame = |
| 119 CGRectMake(oldFrame.origin.x, collectionOffsetY, oldFrame.size.width, |
| 120 collectionHeight); |
| 121 } |
| 122 |
| 109 #pragma mark - RemotingAuthenticationDelegate | 123 #pragma mark - RemotingAuthenticationDelegate |
| 110 | 124 |
| 111 - (void)nowAuthenticated:(BOOL)authenticated { | 125 - (void)nowAuthenticated:(BOOL)authenticated { |
| 112 if (authenticated) { | 126 if (authenticated) { |
| 113 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; | 127 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; |
| 114 message.text = @"Logged In!"; | 128 message.text = @"Logged In!"; |
| 115 [MDCSnackbarManager showMessage:message]; | 129 [MDCSnackbarManager showMessage:message]; |
| 116 [_remotingService setHostListDelegate:self]; | 130 [_remotingService setHostListDelegate:self]; |
| 117 } else { | 131 } else { |
| 118 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; | 132 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; | 256 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; |
| 243 if (_isAuthenticated) { | 257 if (_isAuthenticated) { |
| 244 UserInfo* user = [_remotingService getUser]; | 258 UserInfo* user = [_remotingService getUser]; |
| 245 message.text = [NSString | 259 message.text = [NSString |
| 246 stringWithFormat:@"Currently signed in as %@.", [user userEmail]]; | 260 stringWithFormat:@"Currently signed in as %@.", [user userEmail]]; |
| 247 [MDCSnackbarManager showMessage:message]; | 261 [MDCSnackbarManager showMessage:message]; |
| 248 } | 262 } |
| 249 } | 263 } |
| 250 | 264 |
| 251 @end | 265 @end |
| OLD | NEW |