File tree Expand file tree Collapse file tree 9 files changed +26
-13
lines changed Expand file tree Collapse file tree 9 files changed +26
-13
lines changed Original file line number Diff line number Diff line change 14
14
#import " NXOAuth2Account.h"
15
15
16
16
@interface NXOAuth2Account (Private)
17
+
17
18
- (id )initAccountWithOAuthClient : (NXOAuth2Client *)oauthClient accountType : (NSString *)accountType ;
19
+ - (id )initAccountWithAccessToken : (NXOAuth2AccessToken *)accessToken accountType : (NSString *)accountType ;
20
+
18
21
@end
Original file line number Diff line number Diff line change 1
1
Pod ::Spec . new do |s |
2
2
s . name = 'NXOAuth2Client'
3
- s . version = '1.2.3 '
3
+ s . version = '1.2.5 '
4
4
s . license = {
5
5
:type => 'BSD' ,
6
6
:text => <<-LICENSETEXT
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ installation steps automatically.
52
52
53
53
In order to install the library this way add the following line to your ` Podfile ` :
54
54
55
- ``` dependency 'NXOAuth2Client',' 1.2.2'```
55
+ ``` pod 'NXOAuth2Client', '~> 1.2.2'```
56
56
57
57
and run the following command ` pod install ` .
58
58
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ + (id)tokenWithResponseBody:(NSString *)theResponseBody tokenType:(NSString *)to
62
62
}
63
63
64
64
NSSet *scope = nil ;
65
- if (scopeString) {
65
+ if (scopeString && ![scopeString isEqual: [ NSNull null ]] ) {
66
66
scope = [NSSet setWithArray: [scopeString componentsSeparatedByCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet ]]];
67
67
}
68
68
Original file line number Diff line number Diff line change @@ -42,12 +42,21 @@ @implementation NXOAuth2Account (Private)
42
42
#pragma mark Lifecycle
43
43
44
44
- (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 ;
45
55
{
46
56
self = [super init ];
47
57
if (self) {
48
58
accountType = anAccountType;
49
- oauthClient = anOAuthClient;
50
- accessToken = oauthClient.accessToken ;
59
+ accessToken = anAccessToken;
51
60
oauthClient.delegate = self;
52
61
identifier = [NSString nxoauth2_stringWithUUID ];
53
62
}
Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ typedef void(^NXOAuth2PreparedAuthorizationURLHandler)(NSURL *preparedURL);
127
127
- (void )requestAccessToAccountWithType : (NSString *)accountType username : (NSString *)username password : (NSString *)password ;
128
128
- (void )requestAccessToAccountWithType : (NSString *)accountType assertionType : (NSURL *)assertionType assertion : (NSString *)assertion ;
129
129
- (void )requestClientCredentialsAccessWithType : (NSString *)accountType ;
130
+ - (void )addAccount : (NXOAuth2Account *)account ;
130
131
- (void )removeAccount : (NXOAuth2Account *)account ;
131
132
132
133
Original file line number Diff line number Diff line change @@ -485,6 +485,12 @@ - (void)oauthClientDidGetAccessToken:(NXOAuth2Client *)client;
485
485
}
486
486
487
487
NXOAuth2Account *account = [[NXOAuth2Account alloc ] initAccountWithOAuthClient: client accountType: accountType];
488
+
489
+ [self addAccount: account];
490
+ }
491
+
492
+ - (void )addAccount : (NXOAuth2Account *)account ;
493
+ {
488
494
@synchronized (self.accountsDict ) {
489
495
[self .accountsDict setValue: account forKey: account.identifier];
490
496
[NXOAuth2AccountStore storeAccountsInDefaultKeychain: self .accountsDict];
Original file line number Diff line number Diff line change @@ -89,10 +89,6 @@ - (void)dealloc;
89
89
sendConnectionDidEndNotification = NO ;
90
90
91
91
[connection cancel ];
92
-
93
- #if (NXOAuth2ConnectionDebug)
94
- [startDate release ];
95
- #endif
96
92
}
97
93
98
94
@@ -205,10 +201,6 @@ - (NSURLConnection *)createConnection;
205
201
[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 )
206
202
[aConnection start ]; // now start
207
203
208
- #if (NXOAuth2ConnectionDebug)
209
- [startDate release ]; startDate = [[NSDate alloc ] init ];
210
- #endif
211
-
212
204
if (!sendConnectionDidEndNotification) [[NSNotificationCenter defaultCenter ] postNotificationName: NXOAuth2ConnectionDidStartNotification object: self ];
213
205
sendConnectionDidEndNotification = YES ;
214
206
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ - (id)initWithName:(NSString *)name content:(id)content;
36
36
{
37
37
if ([content isKindOfClass: [NSString class ]]) {
38
38
return [self initWithName: name stringContent: content];
39
+ } else if ([content isKindOfClass: [NSNumber class ]]) {
40
+ return [self initWithName: name stringContent: [content stringValue ]];
39
41
} else if ([content isKindOfClass: [NSURL class ]] && [content isFileURL ]) {
40
42
return [self initWithName: name fileContent: [content path ]];
41
43
} else if ([content isKindOfClass: [NSData class ]]) {
You can’t perform that action at this time.
0 commit comments