Minor code re-formatting and documentation changes
This commit is contained in:
parent
37275860d7
commit
6923e31db5
2 changed files with 9 additions and 9 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue