|
@@ -35,6 +35,11 @@
|
|
|
|
|
|
- (void)activateIdleTimer
|
|
- (void)activateIdleTimer
|
|
{
|
|
{
|
|
|
|
+ if (![NSThread isMainThread]) {
|
|
|
|
+ [self performSelectorOnMainThread:@selector(activateIdleTimer) withObject:nil waitUntilDone:NO];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
_idleCounter--;
|
|
_idleCounter--;
|
|
if (_idleCounter < 1)
|
|
if (_idleCounter < 1)
|
|
[UIApplication sharedApplication].idleTimerDisabled = NO;
|
|
[UIApplication sharedApplication].idleTimerDisabled = NO;
|
|
@@ -42,6 +47,11 @@
|
|
|
|
|
|
- (void)disableIdleTimer
|
|
- (void)disableIdleTimer
|
|
{
|
|
{
|
|
|
|
+ if (![NSThread isMainThread]) {
|
|
|
|
+ [self performSelectorOnMainThread:@selector(disableIdleTimer) withObject:nil waitUntilDone:NO];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
_idleCounter++;
|
|
_idleCounter++;
|
|
if ([UIApplication sharedApplication].idleTimerDisabled == NO)
|
|
if ([UIApplication sharedApplication].idleTimerDisabled == NO)
|
|
[UIApplication sharedApplication].idleTimerDisabled = YES;
|
|
[UIApplication sharedApplication].idleTimerDisabled = YES;
|
|
@@ -49,6 +59,11 @@
|
|
|
|
|
|
- (void)networkActivityStarted
|
|
- (void)networkActivityStarted
|
|
{
|
|
{
|
|
|
|
+ if (![NSThread isMainThread]) {
|
|
|
|
+ [self performSelectorOnMainThread:@selector(networkActivityStarted) withObject:nil waitUntilDone:NO];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
_networkActivityCounter++;
|
|
_networkActivityCounter++;
|
|
#if TARGET_OS_IOS
|
|
#if TARGET_OS_IOS
|
|
if ([UIApplication sharedApplication].networkActivityIndicatorVisible == NO)
|
|
if ([UIApplication sharedApplication].networkActivityIndicatorVisible == NO)
|
|
@@ -63,6 +78,11 @@
|
|
|
|
|
|
- (void)networkActivityStopped
|
|
- (void)networkActivityStopped
|
|
{
|
|
{
|
|
|
|
+ if (![NSThread isMainThread]) {
|
|
|
|
+ [self performSelectorOnMainThread:@selector(networkActivityStopped) withObject:nil waitUntilDone:NO];
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
_networkActivityCounter--;
|
|
_networkActivityCounter--;
|
|
#if TARGET_OS_IOS
|
|
#if TARGET_OS_IOS
|
|
if (_networkActivityCounter < 1)
|
|
if (_networkActivityCounter < 1)
|