Browse Source

gDrive: hide download button if it is a folder

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Pierre SAGASPE 10 years ago
parent
commit
3fb51c26e2

+ 2 - 0
Sources/VLCCloudStorageTableViewCell.h

@@ -31,6 +31,8 @@
 @property (nonatomic, retain) BoxItem *boxFile;
 @property (nonatomic, retain) VLCOneDriveObject *oneDriveFile;
 
+@property (nonatomic, readwrite) BOOL isDownloadable;
+
 + (VLCCloudStorageTableViewCell *)cellWithReuseIdentifier:(NSString *)ident;
 + (CGFloat)heightOfCell;
 

+ 5 - 0
Sources/VLCCloudStorageTableViewCell.m

@@ -204,4 +204,9 @@
     return 48.;
 }
 
+- (void)setIsDownloadable:(BOOL)isDownloadable
+{
+    self.downloadButton.hidden = !isDownloadable;
+}
+
 @end

+ 5 - 0
Sources/VLCGoogleDriveTableViewController.m

@@ -107,6 +107,11 @@
         cell = [VLCCloudStorageTableViewCell cellWithReuseIdentifier:CellIdentifier];
 
     cell.driveFile = _googleDriveController.currentListFiles[indexPath.row];
+    if ([cell.driveFile.mimeType isEqualToString:@"application/vnd.google-apps.folder"])
+        [cell setIsDownloadable:NO];
+    else
+        [cell setIsDownloadable:YES];
+
     cell.delegate = self;
 
     return cell;