From 6923e31db5b94052c4fcdd031ada4036ba758dcf Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Sun, 8 Apr 2012 12:02:19 -0700 Subject: [PATCH] Minor code re-formatting and documentation changes --- AFNetworking/AFNetworkActivityIndicatorManager.h | 12 ++++++------ AFNetworking/AFNetworkActivityIndicatorManager.m | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/AFNetworking/AFNetworkActivityIndicatorManager.h b/AFNetworking/AFNetworkActivityIndicatorManager.h index 2cee153..4a5640c 100644 --- a/AFNetworking/AFNetworkActivityIndicatorManager.h +++ b/AFNetworking/AFNetworkActivityIndicatorManager.h @@ -30,7 +30,7 @@ /** `AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a network request operation has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero. */ -@interface AFNetworkActivityIndicatorManager : NSObject; +@interface AFNetworkActivityIndicatorManager : NSObject /** A Boolean value indicating whether the manager is enabled. @@ -39,6 +39,11 @@ */ @property (nonatomic, assign, getter = isEnabled) BOOL enabled; +/** + A Boolean value indicating whether the network activity indicator is currently displayed in the status bar. + */ +@property (readonly, nonatomic, assign) BOOL isNetworkActivityIndicatorVisible; + /** Returns the shared network activity indicator manager object for the system. @@ -56,11 +61,6 @@ */ - (void)decrementActivityCount; -/** - Returns the network indicator visibility. This is more excact than polling [UIApplication sharedApplication] isNetworkActivityIndicatorVisible] since we add a slight delay while updating the indicator to avoid flickering. You can observe this via KVO. - */ -- (BOOL)isNetworkActivityIndicatorVisible; - @end #endif diff --git a/AFNetworking/AFNetworkActivityIndicatorManager.m b/AFNetworking/AFNetworkActivityIndicatorManager.m index 3e36ba6..01a6851 100644 --- a/AFNetworking/AFNetworkActivityIndicatorManager.m +++ b/AFNetworking/AFNetworkActivityIndicatorManager.m @@ -96,7 +96,7 @@ static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.25; }); } -// not actually exposed, but will be used if someone tries to set activityCount via KVC. +// Not exposed, but used if activityCount is set via KVC. - (void)setActivityCount:(NSInteger)activityCount { __sync_swap(&_activityCount, activityCount); [self updateNetworkActivityIndicatorVisibilityDelayed]; @@ -113,8 +113,8 @@ static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.25; [self willChangeValueForKey:@"activityCount"]; bool success; do { - int32_t orig = _activityCount; - success = OSAtomicCompareAndSwap32(orig, MIN(orig - 1, orig), &_activityCount); + int32_t currentCount = _activityCount; + success = OSAtomicCompareAndSwap32(currentCount, MIN(currentCount - 1, currentCount), &_activityCount); } while(!success); [self didChangeValueForKey:@"activityCount"]; [self updateNetworkActivityIndicatorVisibilityDelayed];