Commit ee606932 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Prevent device from going to sleep during ongoing download processes (close #9062)

parent 7bac1e20
......@@ -170,15 +170,19 @@
- (void)networkRequestStarted
{
_outstandingNetworkRequests++;
if (_outstandingNetworkRequests == 1)
if (_outstandingNetworkRequests == 1) {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
[UIApplication sharedApplication].idleTimerDisabled = YES;
}
}
- (void)networkRequestStopped
{
_outstandingNetworkRequests--;
if (_outstandingNetworkRequests == 0)
if (_outstandingNetworkRequests == 0) {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
[UIApplication sharedApplication].idleTimerDisabled = NO;
}
}
#pragma mark - VLC internal communication and delegate
......
......@@ -44,6 +44,7 @@
} else {
_downloadInProgress = YES;
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[UIApplication sharedApplication].idleTimerDisabled = YES;
}
}
......@@ -128,6 +129,7 @@
{
_downloadInProgress = NO;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
[UIApplication sharedApplication].idleTimerDisabled = NO;
[self.delegate downloadEnded];
}
......
......@@ -284,6 +284,7 @@ static const int httpLogLevel = HTTP_LOG_LEVEL_VERBOSE; // | HTTP_LOG_FLAG_TRACE
storeFile = [NSFileHandle fileHandleForWritingAtPath:filePath];
[uploadedFiles addObject: [NSString stringWithFormat:@"/upload/%@", filename]];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
[UIApplication sharedApplication].idleTimerDisabled = YES;
}
}
......@@ -301,6 +302,7 @@ static const int httpLogLevel = HTTP_LOG_LEVEL_VERBOSE; // | HTTP_LOG_FLAG_TRACE
[storeFile closeFile];
storeFile = nil;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
[UIApplication sharedApplication].idleTimerDisabled = NO;
/* update media library when file upload was completed */
VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment