Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://github.com/eriksundin/AFOAuth1Client i…

…nto eriksundin-master

Conflicts:
	AFOAuth1Client/AFOAuth1Client.m
  • Loading branch information...
commit 07fbafd046ee52d35294ae2d6b53d723d8ca3788 2 parents 7eff30f + aa789ce
@mattt mattt authored
Showing with 18 additions and 1 deletion.
  1. +18 −1 AFOAuth1Client/AFOAuth1Client.m
View
19 AFOAuth1Client/AFOAuth1Client.m
@@ -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
@@ -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
@@ -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"];
@@ -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"];
Please sign in to comment.
Something went wrong with that request. Please try again.