Skip to content

Commit 6416187

Browse files
author
Taylor King
committed
Changes to fire a delegate method when the dialog is dismissed
1 parent e40b81b commit 6416187

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

OAuthiOS/Src/OAuthIOModal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
- (void)didReceiveOAuthIOCode:(NSString *)code;
2929
- (void)didAuthenticateServerSide:(NSString *)body andResponse:(NSURLResponse *) response;
3030
- (void)didFailAuthenticationServerSide:(NSString *)body andResponse:(NSURLResponse *)response andError:(NSError *)error;
31+
- (void)didDismissModalDialog;
3132
@end
3233

3334
@interface OAuthIOModal : UIViewController<UIWebViewDelegate>

OAuthiOS/Src/OAuthIOModal.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ - (void)showWithProvider:(NSString *)provider options:(NSDictionary*)options
396396
[[NSUserDefaults standardUserDefaults] synchronize];
397397
}
398398
[_rootViewController presentViewController:self animated:YES completion:^{
399+
399400
[_browser loadRequest:url];
400401
}];
401402
}
@@ -442,7 +443,11 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
442443
{
443444
if ([url.scheme isEqual:@"oauthio"] && [url.host isEqual:@"localhost"])
444445
{
445-
[self dismissViewControllerAnimated:YES completion:nil];
446+
[self dismissViewControllerAnimated:YES completion:^(){
447+
if([self.delegate respondsToSelector:@selector(didDismissModalDialog)]) {
448+
[self.delegate didDismissModalDialog];
449+
}
450+
}];
446451
[self getTokens:[url absoluteString]];
447452
return (NO);
448453
}

0 commit comments

Comments
 (0)