Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Allow customising the auth view controller through a delegate #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/LiveSDK/Library/Internal/LiveAuthDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ - (void)viewDidLoad

//Load the Url request in the UIWebView.
NSURLRequest *requestObj = [NSURLRequest requestWithURL:_startUrl];
[webView loadRequest:requestObj];
[webView loadRequest:requestObj];

[_delegate authDialogLoaded];
}

- (void) viewDidAppear:(BOOL)animated
Expand Down
2 changes: 2 additions & 0 deletions src/LiveSDK/Library/Internal/LiveAuthDialogDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

@protocol LiveAuthDialogDelegate <NSObject>

- (void) authDialogLoaded;

- (void) authDialogCompletedWithResponse:(NSURL *)responseUrl;

- (void) authDialogFailedWithError:(NSError *)error;
Expand Down
13 changes: 10 additions & 3 deletions src/LiveSDK/Library/Internal/LiveAuthRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ - (void)dismissModal
// Adding a checking logic and wait for the modal dialog to appear before we can dismiss it.
if (self.authViewController.canDismiss)
{
[self.currentViewController dismissModalViewControllerAnimated:YES];
[self.currentViewController dismissViewControllerAnimated:YES completion:nil];
self.currentViewController = nil;
self.authViewController = nil;
}
Expand Down Expand Up @@ -178,8 +178,7 @@ - (void)authorize
UINavigationController *modalDialog = [[[UINavigationController alloc]initWithRootViewController:self.authViewController]
autorelease];

[self.currentViewController presentModalViewController:modalDialog
animated:YES];
[self.currentViewController presentViewController:modalDialog animated:YES completion:nil];
}

- (void)retrieveToken
Expand All @@ -200,6 +199,14 @@ - (void)retrieveToken

#pragma mark - LiveAuthDialogDelegate

- (void) authDialogLoaded
{
if ([_delegate respondsToSelector:@selector(authViewControllerLoaded:)])
{
[_delegate authViewControllerLoaded:self.authViewController];
}
}

- (void) authDialogCompletedWithResponse:(NSURL *)responseUrl
{
NSDictionary *responseData = [UrlHelper parseUrl:responseUrl];
Expand Down
3 changes: 3 additions & 0 deletions src/LiveSDK/Library/Public/LiveAuthDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "LiveConnectSession.h"
#import "LiveConnectSessionStatus.h"

Expand All @@ -38,4 +39,6 @@
- (void) authFailed: (NSError *) error
userState: (id)userState;

- (void) authViewControllerLoaded: (UIViewController *) authViewController;

@end