Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

52 lines (42 sloc) 0.963 kb
//
// UIApplication+DTNetworkActivity.m
// DTFoundation
//
// Created by Oliver Drobnik on 5/21/12.
// Copyright (c) 2012 Cocoanetics. All rights reserved.
//
#import "UIApplication+DTNetworkActivity.h"
static NSUInteger __internalOperationCount = 0;
@implementation UIApplication (DTNetworkActivity)
- (void)pushActiveNetworkOperation
{
@synchronized(self)
{
__internalOperationCount++;
dispatch_async(dispatch_get_main_queue(), ^{
if (!self.isNetworkActivityIndicatorVisible && __internalOperationCount)
{
self.networkActivityIndicatorVisible = YES;
}
});
}
}
- (void)popActiveNetworkOperation
{
@synchronized(self)
{
if (__internalOperationCount==0)
{
// nothing to do
return;
}
__internalOperationCount--;
dispatch_async(dispatch_get_main_queue(), ^{
if (self.isNetworkActivityIndicatorVisible && !__internalOperationCount)
{
self.networkActivityIndicatorVisible = NO;
}
});
}
}
@end
Jump to Line
Something went wrong with that request. Please try again.