Skip to content
This repository
  • 4 commits
  • 3 files changed
  • 0 comments
  • 2 contributors

Showing 3 changed files with 23 additions and 26 deletions. Show diff stats Hide diff stats

  1. +5 9 OAMutableURLRequest.m
  2. +14 13 OAToken.m
  3. +4 4 OATokenManager.m
14 OAMutableURLRequest.m
@@ -85,14 +85,10 @@ - (id)initWithURL:(NSURL *)aUrl
85 85 signatureProvider:(id<OASignatureProviding>)aProvider
86 86 nonce:(NSString *)aNonce
87 87 timestamp:(NSString *)aTimestamp {
88   - [self initWithURL:aUrl
89   - consumer:aConsumer
90   - token:aToken
91   - realm:aRealm
92   - signatureProvider:aProvider];
93   -
94   - nonce = [aNonce copy];
95   - timestamp = [aTimestamp copy];
  88 + if ((self = [self initWithURL:aUrl consumer:aConsumer token:aToken realm:aRealm signatureProvider:aProvider])) {
  89 + nonce = [aNonce copy];
  90 + timestamp = [aTimestamp copy];
  91 + }
96 92
97 93 return self;
98 94 }
@@ -135,7 +131,7 @@ - (void)_generateTimestamp {
135 131 - (void)_generateNonce {
136 132 CFUUIDRef theUUID = CFUUIDCreate(NULL);
137 133 CFStringRef string = CFUUIDCreateString(NULL, theUUID);
138   - NSMakeCollectable(theUUID);
  134 + [NSMakeCollectable(theUUID) autorelease];
139 135 if (nonce) {
140 136 CFRelease(nonce);
141 137 }
27 OAToken.m
@@ -117,19 +117,20 @@ - (id)initWithHTTPResponseBody:(const NSString *)body {
117 117 }
118 118
119 119 - (id)initWithUserDefaultsUsingServiceProviderName:(const NSString *)provider prefix:(const NSString *)prefix {
120   - [super init];
121   - self.key = [OAToken loadSetting:@"key" provider:provider prefix:prefix];
122   - self.secret = [OAToken loadSetting:@"secret" provider:provider prefix:prefix];
123   - self.session = [OAToken loadSetting:@"session" provider:provider prefix:prefix];
124   - self.duration = [OAToken loadSetting:@"duration" provider:provider prefix:prefix];
125   - self.attributes = [OAToken loadSetting:@"attributes" provider:provider prefix:prefix];
126   - created = [OAToken loadSetting:@"created" provider:provider prefix:prefix];
127   - renewable = [[OAToken loadSetting:@"renewable" provider:provider prefix:prefix] boolValue];
128   -
129   - if (![self isValid]) {
130   - [self autorelease];
131   - return nil;
132   - }
  120 + if ((self = [super init])) {
  121 + self.key = [OAToken loadSetting:@"key" provider:provider prefix:prefix];
  122 + self.secret = [OAToken loadSetting:@"secret" provider:provider prefix:prefix];
  123 + self.session = [OAToken loadSetting:@"session" provider:provider prefix:prefix];
  124 + self.duration = [OAToken loadSetting:@"duration" provider:provider prefix:prefix];
  125 + self.attributes = [OAToken loadSetting:@"attributes" provider:provider prefix:prefix];
  126 + created = [OAToken loadSetting:@"created" provider:provider prefix:prefix];
  127 + renewable = [[OAToken loadSetting:@"renewable" provider:provider prefix:prefix] boolValue];
  128 +
  129 + if (![self isValid]) {
  130 + [self autorelease];
  131 + return nil;
  132 + }
  133 + }
133 134
134 135 return self;
135 136 }
8 OATokenManager.m
@@ -87,7 +87,7 @@ - (void)dealloc {
87 87
88 88 // The application got a new authorized
89 89 // request token and is notifying us
90   -- (void)authorizedToken:(const NSString *)aKey
  90 +- (void)authorizedToken:(NSString *)aKey
91 91 {
92 92 if (reqToken && [aKey isEqualToString:reqToken.key]) {
93 93 [self exchangeToken];
@@ -282,7 +282,7 @@ - (void)exchangeToken
282 282
283 283 - (void)accessTokenReceived:(OACall *)call body:(NSString *)body
284 284 {
285   - OAToken *token = [[OAToken alloc] initWithHTTPResponseBody:body];
  285 + OAToken *token = [[[OAToken alloc] initWithHTTPResponseBody:body] autorelease];
286 286 [self setAccessToken:token];
287 287 }
288 288
@@ -361,10 +361,10 @@ - (void)dispatch {
361 361 - (void)fetchData:(NSString *)aURL method:(NSString *)aMethod parameters:(NSArray *)theParameters
362 362 files:(NSDictionary *)theFiles finished:(SEL)didFinish delegate:(NSObject*)aDelegate {
363 363
364   - OACall *call = [[OACall alloc] initWithURL:[NSURL URLWithString:aURL]
  364 + OACall *call = [[[OACall alloc] initWithURL:[NSURL URLWithString:aURL]
365 365 method:aMethod
366 366 parameters:theParameters
367   - files:theFiles];
  367 + files:theFiles] autorelease];
368 368 NSLog(@"Received request for: %@", aURL);
369 369 [self enqueue:call selector:didFinish];
370 370 if (aDelegate) {

No commit comments for this range

Something went wrong with that request. Please try again.