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

HTTP File Downloader: minor cleanup

parent 8b2cb714
...@@ -95,24 +95,19 @@ ...@@ -95,24 +95,19 @@
-(void)connectionDidFinishLoading:(NSURLConnection *)connection { -(void)connectionDidFinishLoading:(NSURLConnection *)connection {
APLog(@"http file download complete"); APLog(@"http file download complete");
_downloadInProgress = NO;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
VLCAppDelegate * appDelegate = [UIApplication sharedApplication].delegate; VLCAppDelegate * appDelegate = [UIApplication sharedApplication].delegate;
[appDelegate updateMediaList]; [appDelegate updateMediaList];
[self.delegate downloadEnded]; [self _downloadEnded];
} }
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
APLog(@"http file download failed (%i)", error.code); APLog(@"http file download failed (%i)", error.code);
_downloadInProgress = NO;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
if ([self.delegate respondsToSelector:@selector(downloadFailedWithErrorDescription:)]) if ([self.delegate respondsToSelector:@selector(downloadFailedWithErrorDescription:)])
[self.delegate downloadFailedWithErrorDescription:error.description]; [self.delegate downloadFailedWithErrorDescription:error.description];
[self.delegate downloadEnded]; [self _downloadEnded];
} }
- (void)cancelDownload - (void)cancelDownload
...@@ -121,6 +116,14 @@ ...@@ -121,6 +116,14 @@
if ([self.delegate respondsToSelector:@selector(downloadFailedWithErrorDescription:)]) if ([self.delegate respondsToSelector:@selector(downloadFailedWithErrorDescription:)])
[self.delegate downloadFailedWithErrorDescription:@"Download canceled by user"]; [self.delegate downloadFailedWithErrorDescription:@"Download canceled by user"];
[self _downloadEnded];
}
- (void)_downloadEnded
{
_downloadInProgress = NO;
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
[self.delegate downloadEnded]; [self.delegate downloadEnded];
} }
......
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