Skip to content

Commit

Permalink
Changes to fire a delegate method when the dialog is dismissed
Browse files Browse the repository at this point in the history
  • Loading branch information
Taylor King committed Oct 22, 2015
1 parent e40b81b commit 6416187
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions OAuthiOS/Src/OAuthIOModal.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- (void)didReceiveOAuthIOCode:(NSString *)code;
- (void)didAuthenticateServerSide:(NSString *)body andResponse:(NSURLResponse *) response;
- (void)didFailAuthenticationServerSide:(NSString *)body andResponse:(NSURLResponse *)response andError:(NSError *)error;
- (void)didDismissModalDialog;
@end

@interface OAuthIOModal : UIViewController<UIWebViewDelegate>
Expand Down
7 changes: 6 additions & 1 deletion OAuthiOS/Src/OAuthIOModal.m
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ - (void)showWithProvider:(NSString *)provider options:(NSDictionary*)options
[[NSUserDefaults standardUserDefaults] synchronize];
}
[_rootViewController presentViewController:self animated:YES completion:^{

[_browser loadRequest:url];
}];
}
Expand Down Expand Up @@ -442,7 +443,11 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
{
if ([url.scheme isEqual:@"oauthio"] && [url.host isEqual:@"localhost"])
{
[self dismissViewControllerAnimated:YES completion:nil];
[self dismissViewControllerAnimated:YES completion:^(){
if([self.delegate respondsToSelector:@selector(didDismissModalDialog)]) {
[self.delegate didDismissModalDialog];
}
}];
[self getTokens:[url absoluteString]];
return (NO);
}
Expand Down

0 comments on commit 6416187

Please sign in to comment.