Browse Source

VLCDownloadViewController: Fix the download progress that was hidden

Closes #650
Edgar Fouillet 5 years ago
parent
commit
01cbcbe663

+ 4 - 4
Sources/LocalNetworkConnectivity/RemoteNetworkDataSource.swift

@@ -32,7 +32,7 @@ protocol RemoteNetworkDataSourceDelegate {
 class RemoteNetworkDataSource: NSObject, UITableViewDataSource, UITableViewDelegate {
     let cloudVC = VLCCloudServicesTableViewController(nibName: "VLCCloudServicesTableViewController", bundle: Bundle.main)
     let streamingVC = VLCOpenNetworkStreamViewController(nibName: "VLCOpenNetworkStreamViewController", bundle: Bundle.main)
-    let downloadVC = VLCDownloadViewController(nibName: "VLCDownloadViewController", bundle: Bundle.main)
+    let downloadVC = VLCDownloadViewController.sharedInstance()
 
     @objc weak var delegate: RemoteNetworkDataSourceDelegate?
 
@@ -66,9 +66,9 @@ class RemoteNetworkDataSource: NSObject, UITableViewDataSource, UITableViewDeleg
             }
         case .download:
             if let networkCell = tableView.dequeueReusableCell(withIdentifier: VLCRemoteNetworkCell.cellIdentifier) {
-                networkCell.textLabel?.text = downloadVC.title
-                networkCell.detailTextLabel?.text = downloadVC.detailText
-                networkCell.imageView?.image = downloadVC.cellImage
+                networkCell.textLabel?.text = downloadVC?.title
+                networkCell.detailTextLabel?.text = downloadVC?.detailText
+                networkCell.imageView?.image = downloadVC?.cellImage
                 networkCell.accessibilityIdentifier = VLCAccessibilityIdentifier.downloads
                 return networkCell
             }

+ 4 - 4
Sources/VLCDownloadViewController.m

@@ -112,10 +112,10 @@ typedef NS_ENUM(NSUInteger, VLCDownloadScheme) {
     self.downloadButton.backgroundColor = PresentationTheme.current.colors.orangeUI;
     self.whatToDownloadHelpLabel.textColor = PresentationTheme.current.colors.lightTextColor;
     self.progressContainer.backgroundColor = PresentationTheme.current.colors.cellBackgroundB;
-    self.currentDownloadLabel.textColor =  PresentationTheme.current.colors.cellBackgroundB;
-    self.progressPercent.textColor =  PresentationTheme.current.colors.cellBackgroundB;
-    self.speedRate.textColor =  PresentationTheme.current.colors.cellBackgroundB;
-    self.timeDL.textColor = PresentationTheme.current.colors.cellTextColor;
+    self.currentDownloadLabel.textColor =  PresentationTheme.current.colors.cellTextColor;
+    self.progressPercent.textColor =  PresentationTheme.current.colors.cellDetailTextColor;
+    self.speedRate.textColor =  PresentationTheme.current.colors.cellDetailTextColor;
+    self.timeDL.textColor = PresentationTheme.current.colors.cellDetailTextColor;
     [self.downloadsTable reloadData];
     [self setNeedsStatusBarAppearanceUpdate];
 }

+ 2 - 2
Sources/VLCHTTPFileDownloader.m

@@ -131,7 +131,7 @@
 
     downloadTask.sessionTask = sessionTask;
     [self _addDownloadTask:downloadTask identifier:identifier];
-
+    _downloadInProgress = YES;
     return identifier;
 }
 
@@ -241,7 +241,7 @@ willPerformHTTPRedirection:(NSHTTPURLResponse *)response
     }
 
     [self _removeDownloadWithIdentifier:identifier];
-
+    _downloadInProgress = NO;
     dispatch_async(dispatch_get_main_queue(), ^{
         [self.delegate downloadEndedWithIdentifier:identifier];
     });