Index: remoting/client/ios/app/app_delegate.mm |
diff --git a/remoting/client/ios/app/app_delegate.mm b/remoting/client/ios/app/app_delegate.mm |
index bceb7dbb1ddd219a65afcf214d6fcc2bd5c2eb8d..ae4b24f45df0810b32e9775a519965c03fe48b0a 100644 |
--- a/remoting/client/ios/app/app_delegate.mm |
+++ b/remoting/client/ios/app/app_delegate.mm |
@@ -9,11 +9,11 @@ |
#import "remoting/client/ios/app/app_delegate.h" |
#include "base/logging.h" |
- |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/base/resource/resource_bundle.h" |
-#import "remoting/client/ios/app/example_view_controller.h" |
+#import "remoting/client/ios/app/remoting_view_controller.h" |
+#import "remoting/client/ios/facade/remoting_service.h" |
@implementation AppDelegate |
@@ -29,13 +29,33 @@ |
- (BOOL)application:(UIApplication*)application |
didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { |
+ [self launchRemotingViewController]; |
+ return YES; |
+} |
- ExampleViewController *vc = [[ExampleViewController alloc] init]; |
+- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url { |
+ NSMutableDictionary* components = [[NSMutableDictionary alloc] init]; |
+ NSArray* urlComponents = [[url query] componentsSeparatedByString:@"&"]; |
- self.window.rootViewController = vc; |
+ for (NSString* componentPair in urlComponents) { |
+ NSArray* pair = [componentPair componentsSeparatedByString:@"="]; |
+ NSString* key = [[pair firstObject] stringByRemovingPercentEncoding]; |
+ NSString* value = [[pair lastObject] stringByRemovingPercentEncoding]; |
+ [components setObject:value forKey:key]; |
+ } |
+ NSString* authorizationCode = [components objectForKey:@"code"]; |
- [self.window makeKeyAndVisible]; |
+ [[RemotingService SharedInstance] |
+ authenticateWithAuthorizationCode:authorizationCode]; |
+ |
+ [self launchRemotingViewController]; |
return YES; |
} |
+- (void)launchRemotingViewController { |
+ RemotingViewController* vc = [[RemotingViewController alloc] init]; |
+ self.window.rootViewController = vc; |
+ [self.window makeKeyAndVisible]; |
+} |
+ |
@end |