From 64161871d3c49820c982ec86e1ad5eef926d6935 Mon Sep 17 00:00:00 2001 From: Taylor King Date: Thu, 22 Oct 2015 18:21:07 -0400 Subject: [PATCH] Changes to fire a delegate method when the dialog is dismissed --- OAuthiOS/Src/OAuthIOModal.h | 1 + OAuthiOS/Src/OAuthIOModal.m | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/OAuthiOS/Src/OAuthIOModal.h b/OAuthiOS/Src/OAuthIOModal.h index dd2215e..747e871 100644 --- a/OAuthiOS/Src/OAuthIOModal.h +++ b/OAuthiOS/Src/OAuthIOModal.h @@ -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 diff --git a/OAuthiOS/Src/OAuthIOModal.m b/OAuthiOS/Src/OAuthIOModal.m index b04efed..ab62c3c 100644 --- a/OAuthiOS/Src/OAuthIOModal.m +++ b/OAuthiOS/Src/OAuthIOModal.m @@ -396,6 +396,7 @@ - (void)showWithProvider:(NSString *)provider options:(NSDictionary*)options [[NSUserDefaults standardUserDefaults] synchronize]; } [_rootViewController presentViewController:self animated:YES completion:^{ + [_browser loadRequest:url]; }]; } @@ -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); }