Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: remoting/ios/app/remoting_view_controller.mm

Issue 2914233003: [CRD iOS] Don't attempt to connect to an offline host (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 if (_client) { 196 if (_client) {
197 return _client.hostInfo.hostName; 197 return _client.hostInfo.hostName;
198 } 198 }
199 return nil; 199 return nil;
200 } 200 }
201 201
202 #pragma mark - HostCollectionViewControllerDelegate 202 #pragma mark - HostCollectionViewControllerDelegate
203 203
204 - (void)didSelectCell:(HostCollectionViewCell*)cell 204 - (void)didSelectCell:(HostCollectionViewCell*)cell
205 completion:(void (^)())completionBlock { 205 completion:(void (^)())completionBlock {
206 if (![cell.hostInfo isOnline]) {
207 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init];
208 message.text = @"Host is offline.";
nicholss 2017/06/01 21:56:57 Might be overkill but for now yeah, lets use it.
Yuwei 2017/06/01 22:06:49 Okay. BTW this is what we do on Android #_#
209 [MDCSnackbarManager showMessage:message];
210 return;
211 }
212
206 _client = [[RemotingClient alloc] init]; 213 _client = [[RemotingClient alloc] init];
207 214
208 [_remotingService.authentication 215 [_remotingService.authentication
209 callbackWithAccessToken:base::BindBlockArc(^( 216 callbackWithAccessToken:base::BindBlockArc(^(
210 remoting::OAuthTokenGetter::Status status, 217 remoting::OAuthTokenGetter::Status status,
211 const std::string& user_email, 218 const std::string& user_email,
212 const std::string& access_token) { 219 const std::string& access_token) {
213 // TODO(nicholss): Check status. 220 // TODO(nicholss): Check status.
214 HostInfo* hostInfo = cell.hostInfo; 221 HostInfo* hostInfo = cell.hostInfo;
215 [_client connectToHost:hostInfo 222 [_client connectToHost:hostInfo
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init]; 295 MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init];
289 if (_isAuthenticated) { 296 if (_isAuthenticated) {
290 message.text = [NSString 297 message.text = [NSString
291 stringWithFormat:@"Currently signed in as %@.", 298 stringWithFormat:@"Currently signed in as %@.",
292 _remotingService.authentication.user.userEmail]; 299 _remotingService.authentication.user.userEmail];
293 [MDCSnackbarManager showMessage:message]; 300 [MDCSnackbarManager showMessage:message];
294 } 301 }
295 } 302 }
296 303
297 @end 304 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698