Commit 13c8cf7e authored by Carola Nitz's avatar Carola Nitz

VLCDownloadViewController: move downloadViewController into LocalNetworkController

parent f2095690
......@@ -127,6 +127,7 @@
"SECTION_HEADER_LIBRARY" = "Media Library";
"STREAMVC_DETAILTEXT" = "Play streams directly without downloading";
"DOWNLOADVC_DETAILTEXT" = "Download files directly to your device";
"LOCAL_NETWORK" = "Local Network";
"CONNECT_TO_SERVER" = "Connect to Server";
......
......@@ -14,6 +14,7 @@ import Foundation
enum RemoteNetworkCellType: Int {
case cloud
case streaming
case download
case wifi
static let count: Int = {
var max: Int = 0
......@@ -30,6 +31,7 @@ protocol RemoteNetworkDataSourceDelegate {
public 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)
@objc weak var delegate: RemoteNetworkDataSourceDelegate?
......@@ -61,6 +63,14 @@ public class RemoteNetworkDataSource: NSObject, UITableViewDataSource, UITableVi
networkCell.accessibilityIdentifier = "Stream"
return networkCell
}
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.accessibilityIdentifier = "Downloads"
return networkCell
}
case .wifi:
if let wifiCell = tableView.dequeueReusableCell(withIdentifier: VLCWiFiUploadTableViewCell.cellIdentifier()) {
return wifiCell
......@@ -92,6 +102,8 @@ public class RemoteNetworkDataSource: NSObject, UITableViewDataSource, UITableVi
return cloudVC
case .streaming:
return streamingVC
case .download:
return downloadVC
case .wifi:
assertionFailure("We shouldn't get in here since we return nil in willSelect")
return nil
......
......@@ -35,5 +35,9 @@
- (IBAction)downloadAction:(id)sender;
- (IBAction)cancelDownload:(id)sender;
- (void)addURLToDownloadList:(NSURL *)aURL fileNameOfMedia:(NSString*) fileName;;
- (void)addURLToDownloadList:(NSURL *)aURL fileNameOfMedia:(NSString*) fileName;
@property (nonatomic, readonly, copy) NSString *detailText;
@property (nonatomic, readonly) UIImage *cellImage;
@end
......@@ -65,6 +65,7 @@ typedef NS_ENUM(NSUInteger, VLCDownloadScheme) {
_currentDownloads = [[NSMutableArray alloc] init];
_currentDownloadFilename = [[NSMutableArray alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateForTheme) name:kVLCThemeDidChangeNotification object:nil];
self.title = NSLocalizedString(@"DOWNLOAD_FROM_HTTP", comment:@"");
}
return self;
}
......@@ -180,6 +181,16 @@ typedef NS_ENUM(NSUInteger, VLCDownloadScheme) {
return _httpDownloader;
}
- (NSString *)detailText
{
return NSLocalizedString(@"DOWNLOADVC_DETAILTEXT", nil);
}
- (UIImage *)cellImage
{
return [UIImage imageNamed:@"Downloads"];
}
#pragma mark - Download management
- (void)_startDownload
......
......@@ -96,16 +96,7 @@ class VLCTabbarCooordinator: NSObject, VLCMediaViewControllerDelegate, UITabBarC
selectedImage: UIImage(named: "Settings"))
settingsVC.tabBarItem.accessibilityIdentifier = "Settings"
//Download
let downloadVC = VLCDownloadViewController()
downloadVC.title = NSLocalizedString("DOWNLOAD_FROM_HTTP", comment:"")
downloadVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("DOWNLOAD_FROM_HTTP", comment: ""),
image: UIImage(named: "Downloads"),
selectedImage: UIImage(named: "Downloads"))
downloadVC.tabBarItem.accessibilityIdentifier = "Downloads"
let controllers = [audioVC, serverVC, videoVC, settingsVC, downloadVC]
let controllers = [audioVC, serverVC, videoVC, settingsVC]
tabBarController.viewControllers = controllers.map { UINavigationController(rootViewController: $0)}
}
......
......@@ -57,7 +57,8 @@ class Screenshot: XCTestCase {
}
func download(name fileName: String) {
helper.tapTabBarItem(.Downloads)
helper.tapTabBarItem(.LocalNetwork)
app.cells["Downloads"].tap()
let downloadTextfield = app.textFields["http://myserver.com/file.mkv"]
downloadTextfield.clearAndEnter(text: fileName)
......
......@@ -52,7 +52,8 @@ class VLCiOSTestMenu: XCTestCase {
}
func testNavigationToDownloads() {
helper.tapTabBarItem(.Downloads)
helper.tapTabBarItem(.LocalNetwork)
app.cells["Downloads"].tap()
XCTAssertNotNil(app.navigationBars[Tab.Downloads.rawValue])
}
......
......@@ -2,22 +2,25 @@
"images" : [
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "Downloads.png"
"filename" : "Downloads.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "Downloads@2x.png"
"filename" : "Downloads@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "Downloads@3x.png"
"filename" : "Downloads@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"template-rendering-intent" : "template"
}
}
\ No newline at end of file
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