75db3beae82b70d57829b155c504689b6e14188d
[atutor.git] / mods / atsocial_iphone_app / Classes / QAWebController.m
1     //
2 //  QAWebController.m
3 //  ATutor
4 //
5 //  Created by Quang Anh Do on 30/05/2010.
6 //  Copyright 2010 Quang Anh Do. All rights reserved.
7 //
8
9 #import "QAWebController.h"
10
11
12 @implementation QAWebController
13
14 @synthesize oAuthDelegate;
15
16 - (void)dealloc {
17         [oAuthDelegate release];
18         
19         [super dealloc];
20 }
21
22 - (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
23         // Ignore normal URLs
24         if (![[[request URL] scheme] isEqualToString:@"internal"]) {
25                 return [super webView:webView shouldStartLoadWithRequest:request navigationType:navigationType];
26         }       
27         
28         // OAuth
29         if ([[[request URL] host] isEqualToString:@"finish-auth"]) {
30                 if (oAuthDelegate && [oAuthDelegate respondsToSelector:@selector(didFinishAuthorizationInWebViewController:)]) {
31                         [oAuthDelegate performSelector:@selector(didFinishAuthorizationInWebViewController:) withObject:self];
32                 }
33         }
34         
35         return YES;
36 }
37
38 @end