Permalink
Browse files

Renaming Notifications

  • Loading branch information...
1 parent 56ce675 commit c82b5170d642ee06332aa5977983b2abb2a8bc0b @Gernot Gernot committed Sep 7, 2011
@@ -175,7 +175,7 @@ - (void)oauthClient:(NXOAuth2Client *)client didFailToGetAccessTokenWithError:(N
[accessToken release];
accessToken = nil;
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:error
- forKey:kNXOAuth2AccountStoreError];
+ forKey:NXOAuth2AccountStoreErrorKey];
[[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2AccountDidFailToGetAccessTokenNotification
object:self
userInfo:userInfo];
@@ -421,7 +421,7 @@ - (void)oauthClient:(NXOAuth2Client *)client didFailToGetAccessTokenWithError:(N
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
accountType, kNXOAuth2AccountStoreAccountType,
- error, kNXOAuth2AccountStoreError, nil];
+ error, NXOAuth2AccountStoreErrorKey, nil];
[[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2AccountStoreDidFailToRequestAccessNotification
object:self
@@ -35,13 +35,21 @@
* unsigned requests.
*/
+
#ifndef NXOAuth2ConnectionDebug
#define NXOAuth2ConnectionDebug 0
#endif
+
+
+extern NSString * const NXOAuth2ConnectionDidStartNotification;
+extern NSString * const NXOAuth2ConnectionDidEndNotification;
+
+
typedef void(^NXOAuth2ConnectionResponseHandler)(NSURLResponse *response, NSData *responseData, NSError *error);
typedef void(^NXOAuth2ConnectionSendingProgressHandler)(unsigned long long bytesSend, unsigned long long bytesTotal);
+
@interface NXOAuth2Connection : NSObject {
@private
NSURLConnection *connection;
@@ -26,6 +26,9 @@ - (void)removeConnectionFromWaitingQueue:(NXOAuth2Connection *)connection;
@end
+NSString * const NXOAuth2ConnectionDidStartNotification = @"NXOAuth2ConnectionDidStartNotification";
+NSString * const NXOAuth2ConnectionDidEndNotification = @"NXOAuth2ConnectionDidEndNotification";
+
@interface NXOAuth2Connection ()
- (NSURLConnection *)createConnection;
@@ -82,7 +85,7 @@ - (id)initWithRequest:(NSMutableURLRequest *)aRequest
- (void)dealloc;
{
- if (sendConnectionDidEndNotification) [[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2DidEndConnection object:self];
+ if (sendConnectionDidEndNotification) [[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2ConnectionDidEndNotification object:self];
sendConnectionDidEndNotification = NO;
Block_release(sendingProgressHandler);
@@ -152,7 +155,7 @@ - (NSString *)description;
- (void)cancel;
{
- if (sendConnectionDidEndNotification) [[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2DidEndConnection object:self];
+ if (sendConnectionDidEndNotification) [[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2ConnectionDidEndNotification object:self];
sendConnectionDidEndNotification = NO;
[connection cancel];
@@ -207,7 +210,7 @@ - (NSURLConnection *)createConnection;
[startDate release]; startDate = [[NSDate alloc] init];
#endif
- if (!sendConnectionDidEndNotification) [[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2DidStartConnection object:self];
+ if (!sendConnectionDidEndNotification) [[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2ConnectionDidStartNotification object:self];
sendConnectionDidEndNotification = YES;
return [aConnection autorelease];
@@ -438,7 +441,7 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection;
NSLog(@"%.0fms (SUCC) - %@", -[startDate timeIntervalSinceNow]*1000.0, [self descriptionForRequest:request]);
#endif
- if (sendConnectionDidEndNotification) [[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2DidEndConnection object:self];
+ if (sendConnectionDidEndNotification) [[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2ConnectionDidEndNotification object:self];
sendConnectionDidEndNotification = NO;
if(self.statusCode < 400) {
@@ -483,7 +486,7 @@ - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)err
NSLog(@"%.0fms (FAIL) - %@ (%@ %i)", -[startDate timeIntervalSinceNow]*1000.0, [self descriptionForRequest:request], [error domain], [error code]);
#endif
- if (sendConnectionDidEndNotification) [[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2DidEndConnection object:self];
+ if (sendConnectionDidEndNotification) [[NSNotificationCenter defaultCenter] postNotificationName:NXOAuth2ConnectionDidEndNotification object:self];
sendConnectionDidEndNotification = NO;
if ([delegate respondsToSelector:@selector(oauthConnection:didFailWithError:)]) {
@@ -76,13 +76,6 @@ extern NSString * const NXOAuth2HTTPErrorDomain; // domain
// The error code represents the http status code
-#pragma mark Notifications
-
-extern NSString * const NXOAuth2DidStartConnection;
-extern NSString * const NXOAuth2DidEndConnection;
-
-
-
#pragma mark TLS Trust Modes
/*
@@ -112,5 +105,5 @@ typedef enum {
-extern NSString * const kNXOAuth2AccountStoreError;
+extern NSString * const NXOAuth2AccountStoreErrorKey;
@@ -32,15 +32,9 @@
#pragma mark HTTP Errors
NSString * const NXOAuth2HTTPErrorDomain = @"NXOAuth2HTTPErrorDomain";
-
// The error code represents the http status code
-#pragma mark Notifications
-
-NSString * const NXOAuth2DidStartConnection = @"NXOAuth2DidStartConnection";
-NSString * const NXOAuth2DidEndConnection = @"NXOAuth2DidEndConnection";
-
-
+#pragma mark UserInfo Keys
-NSString * const kNXOAuth2AccountStoreError = @"kNXOAuth2AccountStoreError";
+NSString * const NXOAuth2AccountStoreErrorKey = @"NXOAuth2AccountStoreErrorKey";

0 comments on commit c82b517

Please sign in to comment.