| 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/client_connection_view_controller.h" | 9 #import "remoting/ios/app/client_connection_view_controller.h" |
| 10 | 10 |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 _activityIndicator.hidden = NO; | 293 _activityIndicator.hidden = NO; |
| 294 _activityIndicator.indicatorMode = MDCActivityIndicatorModeDeterminate; | 294 _activityIndicator.indicatorMode = MDCActivityIndicatorModeDeterminate; |
| 295 _activityIndicator.cycleColors = @[ [UIColor greenColor] ]; | 295 _activityIndicator.cycleColors = @[ [UIColor greenColor] ]; |
| 296 [_activityIndicator startAnimating]; | 296 [_activityIndicator startAnimating]; |
| 297 _activityIndicator.progress = 1.0; | 297 _activityIndicator.progress = 1.0; |
| 298 | 298 |
| 299 HostViewController* hostViewController = | 299 HostViewController* hostViewController = |
| 300 [[HostViewController alloc] initWithClient:_client]; | 300 [[HostViewController alloc] initWithClient:_client]; |
| 301 _client = nil; | 301 _client = nil; |
| 302 | 302 |
| 303 __weak UIViewController* parentController = self.presentingViewController; | 303 // Replaces current (topmost) view controller with |hostViewController|. |
| 304 | 304 NSMutableArray* controllers = |
| 305 [self dismissViewControllerAnimated:NO | 305 [self.navigationController.viewControllers mutableCopy]; |
| 306 completion:^{ | 306 [controllers removeLastObject]; |
| 307 [parentController | 307 [controllers addObject:hostViewController]; |
| 308 presentViewController:hostViewController | 308 [self.navigationController setViewControllers:controllers animated:NO]; |
| 309 animated:NO | |
| 310 completion:nil]; | |
| 311 }]; | |
| 312 } | 309 } |
| 313 | 310 |
| 314 - (void)didProvidePin:(NSString*)pin createPairing:(BOOL)createPairing { | 311 - (void)didProvidePin:(NSString*)pin createPairing:(BOOL)createPairing { |
| 315 // TODO(nicholss): There is an open question if createPairing is supported on | 312 // TODO(nicholss): There is an open question if createPairing is supported on |
| 316 // iOS. Need to fingure this out. | 313 // iOS. Need to fingure this out. |
| 317 [[NSNotificationCenter defaultCenter] | 314 [[NSNotificationCenter defaultCenter] |
| 318 postNotificationName:kHostSessionPinProvided | 315 postNotificationName:kHostSessionPinProvided |
| 319 object:self | 316 object:self |
| 320 userInfo:[NSDictionary dictionaryWithObject:pin | 317 userInfo:[NSDictionary dictionaryWithObject:pin |
| 321 forKey:kHostSessionPin]]; | 318 forKey:kHostSessionPin]]; |
| 322 } | 319 } |
| 323 | 320 |
| 324 - (void)didTapCancel:(id)sender { | 321 - (void)didTapCancel:(id)sender { |
| 325 _client = nil; | 322 _client = nil; |
| 326 [self dismissViewControllerAnimated:YES completion:nil]; | 323 [self.navigationController popViewControllerAnimated:YES]; |
| 327 } | 324 } |
| 328 | 325 |
| 329 - (void)hostSessionStatusChanged:(NSNotification*)notification { | 326 - (void)hostSessionStatusChanged:(NSNotification*)notification { |
| 330 NSLog(@"hostSessionStatusChanged: %@", [notification userInfo]); | 327 NSLog(@"hostSessionStatusChanged: %@", [notification userInfo]); |
| 331 ClientConnectionViewState state; | 328 ClientConnectionViewState state; |
| 332 ClientSessionDetails* sessionDetails = | 329 ClientSessionDetails* sessionDetails = |
| 333 [[notification userInfo] objectForKey:kSessionDetails]; | 330 [[notification userInfo] objectForKey:kSessionDetails]; |
| 334 switch (sessionDetails.state) { | 331 switch (sessionDetails.state) { |
| 335 case SessionInitializing: | 332 case SessionInitializing: |
| 336 // Same as HostConnecting in UI. Fall-though. | 333 // Same as HostConnecting in UI. Fall-though. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 353 default: | 350 default: |
| 354 LOG(ERROR) << "Unknown State for Session, " << sessionDetails.state; | 351 LOG(ERROR) << "Unknown State for Session, " << sessionDetails.state; |
| 355 return; | 352 return; |
| 356 } | 353 } |
| 357 [[NSOperationQueue mainQueue] addOperationWithBlock:^{ | 354 [[NSOperationQueue mainQueue] addOperationWithBlock:^{ |
| 358 [self setState:state]; | 355 [self setState:state]; |
| 359 }]; | 356 }]; |
| 360 } | 357 } |
| 361 | 358 |
| 362 @end | 359 @end |
| OLD | NEW |