Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/eriksundin/AFOAuth1Client i…
Browse files Browse the repository at this point in the history
…nto eriksundin-master

Conflicts:
	AFOAuth1Client/AFOAuth1Client.m
  • Loading branch information
mattt committed May 7, 2013
2 parents 7eff30f + aa789ce commit 07fbafd
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion AFOAuth1Client/AFOAuth1Client.m
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ static inline BOOL AFQueryStringValueIsTrue(NSString *value) {
@interface AFOAuth1Client ()
@property (readwrite, nonatomic, copy) NSString *key;
@property (readwrite, nonatomic, copy) NSString *secret;
@property (readwrite, nonatomic, strong) id applicationLaunchNotificationObserver;

- (NSDictionary *)OAuthParameters;
- (NSString *)OAuthSignatureForMethod:(NSString *)method
Expand All @@ -155,6 +156,7 @@ @implementation AFOAuth1Client
@synthesize realm = _realm;
@synthesize accessToken = _accessToken;
@synthesize oauthAccessMethod = _oauthAccessMethod;
@synthesize applicationLaunchNotificationObserver = _applicationLaunchNotificationObserver;

- (id)initWithBaseURL:(NSURL *)url
key:(NSString *)clientID
Expand All @@ -178,6 +180,20 @@ - (id)initWithBaseURL:(NSURL *)url
return self;
}

- (void)dealloc {
self.applicationLaunchNotificationObserver = nil;
}

- (void)setApplicationLaunchNotificationObserver:(id)applicationLaunchNotificationObserver {
if (_applicationLaunchNotificationObserver) {
[[NSNotificationCenter defaultCenter] removeObserver:_applicationLaunchNotificationObserver];
}

[self willChangeValueForKey:@"applicationLaunchNotificationObserver"];
_applicationLaunchNotificationObserver = applicationLaunchNotificationObserver;
[self didChangeValueForKey:@"applicationLaunchNotificationObserver"];
}

- (NSDictionary *)OAuthParameters {
NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
[parameters setValue:kAFOAuth1Version forKey:@"oauth_version"];
Expand Down Expand Up @@ -259,7 +275,8 @@ - (void)authorizeUsingOAuthWithRequestTokenPath:(NSString *)requestTokenPath
{
[self acquireOAuthRequestTokenWithPath:requestTokenPath callbackURL:callbackURL accessMethod:(NSString *)accessMethod scope:scope success:^(AFOAuth1Token *requestToken, id responseObject) {
__block AFOAuth1Token *currentRequestToken = requestToken;
[[NSNotificationCenter defaultCenter] addObserverForName:kAFApplicationLaunchedWithURLNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {

self.applicationLaunchNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kAFApplicationLaunchedWithURLNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {
NSURL *url = [[notification userInfo] valueForKey:kAFApplicationLaunchOptionsURLKey];

currentRequestToken.verifier = [AFParametersFromQueryString([url query]) valueForKey:@"oauth_verifier"];
Expand Down

0 comments on commit 07fbafd

Please sign in to comment.