Chromium Code Reviews| Index: remoting/ios/app/app_delegate.mm |
| diff --git a/remoting/ios/app/app_delegate.mm b/remoting/ios/app/app_delegate.mm |
| index 50a7597cc81d116f771850da072ba007c50ce668..3670c0c631feade007672a15e6a4034eaebca7a7 100644 |
| --- a/remoting/ios/app/app_delegate.mm |
| +++ b/remoting/ios/app/app_delegate.mm |
| @@ -14,7 +14,7 @@ |
| #import "remoting/ios/app/app_view_controller.h" |
| #import "remoting/ios/app/remoting_view_controller.h" |
| -#import "remoting/ios/facade/remoting_authentication.h" |
| +#import "remoting/ios/facade/remoting_oauth_authentication.h" |
| #import "remoting/ios/facade/remoting_service.h" |
| @interface AppDelegate () { |
| @@ -31,6 +31,9 @@ |
| self.window = |
| [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; |
| self.window.backgroundColor = [UIColor whiteColor]; |
| + _appViewController = [[AppViewController alloc] init]; |
| + [[RemotingService SharedInstance] |
| + setAuthentication:_appViewController.authentication]; |
|
nicholss
2017/06/21 21:31:06
This feels backwards to me. The view controller sh
Yuwei
2017/06/21 22:44:15
Done. It's now injected in the main function.
|
| return YES; |
| } |
| @@ -41,6 +44,12 @@ |
| } |
| - (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url { |
| + if (![_appViewController.authentication |
|
nicholss
2017/06/21 21:31:06
Could it be cleaner to wrap this method in somethi
Yuwei
2017/06/21 22:44:15
Done. Use marco here. I put the DCHECK here just t
|
| + isKindOfClass:[RemotingOAuthAuthentication class]]) { |
| + NSLog(@"OAuth authentication is not supported."); |
| + return NO; |
| + } |
| + |
| NSMutableDictionary* components = [[NSMutableDictionary alloc] init]; |
| NSArray* urlComponents = [[url query] componentsSeparatedByString:@"&"]; |
| @@ -52,7 +61,7 @@ |
| } |
| NSString* authorizationCode = [components objectForKey:@"code"]; |
| - [[RemotingService SharedInstance].authentication |
| + [(RemotingOAuthAuthentication*)_appViewController.authentication |
| authenticateWithAuthorizationCode:authorizationCode]; |
| [self launchRemotingViewController]; |
| @@ -88,9 +97,7 @@ |
| UINavigationController* navController = |
| [[UINavigationController alloc] initWithRootViewController:vc]; |
| navController.navigationBarHidden = true; |
| - |
| - _appViewController = |
| - [[AppViewController alloc] initWithMainViewController:navController]; |
| + _appViewController.mainViewController = navController; |
| self.window.rootViewController = _appViewController; |
| [self.window makeKeyAndVisible]; |
| } |