Skip to content

Commit 28ea293

Browse files
committed
Merge branch 'master' into develop
2 parents 71e0502 + c31338f commit 28ea293

9 files changed

+26
-13
lines changed

NXOAuth2Account+Private.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,8 @@
1414
#import "NXOAuth2Account.h"
1515

1616
@interface NXOAuth2Account (Private)
17+
1718
- (id)initAccountWithOAuthClient:(NXOAuth2Client *)oauthClient accountType:(NSString *)accountType;
19+
- (id)initAccountWithAccessToken:(NXOAuth2AccessToken *)accessToken accountType:(NSString *)accountType;
20+
1821
@end

NXOAuth2Client.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'NXOAuth2Client'
3-
s.version = '1.2.3'
3+
s.version = '1.2.5'
44
s.license = {
55
:type => 'BSD',
66
:text => <<-LICENSETEXT

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ installation steps automatically.
5252

5353
In order to install the library this way add the following line to your `Podfile`:
5454

55-
```dependency 'NXOAuth2Client','1.2.2'```
55+
```pod 'NXOAuth2Client', '~> 1.2.2'```
5656

5757
and run the following command `pod install`.
5858

Sources/OAuth2Client/NXOAuth2AccessToken.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ + (id)tokenWithResponseBody:(NSString *)theResponseBody tokenType:(NSString *)to
6262
}
6363

6464
NSSet *scope = nil;
65-
if (scopeString) {
65+
if (scopeString && ![scopeString isEqual:[NSNull null]]) {
6666
scope = [NSSet setWithArray:[scopeString componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
6767
}
6868

Sources/OAuth2Client/NXOAuth2Account.m

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,21 @@ @implementation NXOAuth2Account (Private)
4242
#pragma mark Lifecycle
4343

4444
- (id)initAccountWithOAuthClient:(NXOAuth2Client *)anOAuthClient accountType:(NSString *)anAccountType;
45+
{
46+
self = [self initAccountWithAccessToken:anOAuthClient.accessToken
47+
accountType:anAccountType];
48+
if (self) {
49+
oauthClient = anOAuthClient;
50+
}
51+
return self;
52+
}
53+
54+
- (id)initAccountWithAccessToken:(NXOAuth2AccessToken *)anAccessToken accountType:(NSString *)anAccountType;
4555
{
4656
self = [super init];
4757
if (self) {
4858
accountType = anAccountType;
49-
oauthClient = anOAuthClient;
50-
accessToken = oauthClient.accessToken;
59+
accessToken = anAccessToken;
5160
oauthClient.delegate = self;
5261
identifier = [NSString nxoauth2_stringWithUUID];
5362
}

Sources/OAuth2Client/NXOAuth2AccountStore.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ typedef void(^NXOAuth2PreparedAuthorizationURLHandler)(NSURL *preparedURL);
127127
- (void)requestAccessToAccountWithType:(NSString *)accountType username:(NSString *)username password:(NSString *)password;
128128
- (void)requestAccessToAccountWithType:(NSString *)accountType assertionType:(NSURL *)assertionType assertion:(NSString *)assertion;
129129
- (void)requestClientCredentialsAccessWithType:(NSString *)accountType;
130+
- (void)addAccount:(NXOAuth2Account *)account;
130131
- (void)removeAccount:(NXOAuth2Account *)account;
131132

132133

Sources/OAuth2Client/NXOAuth2AccountStore.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,12 @@ - (void)oauthClientDidGetAccessToken:(NXOAuth2Client *)client;
485485
}
486486

487487
NXOAuth2Account *account = [[NXOAuth2Account alloc] initAccountWithOAuthClient:client accountType:accountType];
488+
489+
[self addAccount:account];
490+
}
491+
492+
- (void)addAccount:(NXOAuth2Account *)account;
493+
{
488494
@synchronized (self.accountsDict) {
489495
[self.accountsDict setValue:account forKey:account.identifier];
490496
[NXOAuth2AccountStore storeAccountsInDefaultKeychain:self.accountsDict];

Sources/OAuth2Client/NXOAuth2Connection.m

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ - (void)dealloc;
8989
sendConnectionDidEndNotification = NO;
9090

9191
[connection cancel];
92-
93-
#if (NXOAuth2ConnectionDebug)
94-
[startDate release];
95-
#endif
9692
}
9793

9894

@@ -205,10 +201,6 @@ - (NSURLConnection *)createConnection;
205201
[aConnection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; // let's first schedule it in the current runloop. (see http://github.com/soundcloud/cocoa-api-wrapper/issues#issue/2 )
206202
[aConnection start]; // now start
207203

208-
#if (NXOAuth2ConnectionDebug)
209-
[startDate release]; startDate = [[NSDate alloc] init];
210-
#endif
211-
212204
if (!sendConnectionDidEndNotification) [[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2ConnectionDidStartNotification object:self];
213205
sendConnectionDidEndNotification = YES;
214206

Sources/OAuth2Client/NXOAuth2PostBodyPart.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ - (id)initWithName:(NSString *)name content:(id)content;
3636
{
3737
if ([content isKindOfClass:[NSString class]]) {
3838
return [self initWithName:name stringContent:content];
39+
} else if ([content isKindOfClass:[NSNumber class]]) {
40+
return [self initWithName:name stringContent:[content stringValue]];
3941
} else if ([content isKindOfClass:[NSURL class]] && [content isFileURL]) {
4042
return [self initWithName:name fileContent:[content path]];
4143
} else if ([content isKindOfClass:[NSData class]]) {

0 commit comments

Comments
 (0)