浏览代码

tvOS: Dropbox migration

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
Signed-off-by: Carola Nitz <nitz.carola@googlemail.com>
Soomin Lee 8 年之前
父节点
当前提交
23348522ac

+ 0 - 1
Apple-TV/VLCCloudServicesTVViewController.m

@@ -10,7 +10,6 @@
  *****************************************************************************/
 
 #import "VLCCloudServicesTVViewController.h"
-#import <DropboxTVSDK/DropboxSDK.h>
 #import "VLCDropboxController.h"
 #import "VLCDropboxCollectionViewController.h"
 #import "VLCPlayerDisplayController.h"

+ 1 - 1
SharedSources/Clouds/VLCRemoteBrowsingTVCell+CloudStorage.h

@@ -19,7 +19,7 @@
 
 @interface VLCRemoteBrowsingTVCell (CloudStorage)
 
-- (void)setDropboxFile:(DBMetadata *)dropboxFile;
+- (void)setDropboxFile:(DBFILESMetadata *)dropboxFile;
 - (void)setBoxFile:(BoxItem *)boxFile;
 - (void)setOneDriveFile:(VLCOneDriveObject *)oneDriveFile;
 

+ 9 - 14
SharedSources/Clouds/VLCRemoteBrowsingTVCell+CloudStorage.m

@@ -15,7 +15,7 @@
 
 @implementation VLCRemoteBrowsingTVCell (CloudStorage)
 
-- (void)setDropboxFile:(DBMetadata *)dropboxFile
+- (void)setDropboxFile:(DBFILESMetadata *)dropboxFile
 {
     [self performSelectorOnMainThread:@selector(_updateDropboxRepresentation:)
                            withObject:dropboxFile waitUntilDone:NO];
@@ -33,26 +33,21 @@
                            withObject:oneDriveFile waitUntilDone:NO];
 }
 
-- (void)_updateDropboxRepresentation:(DBMetadata *)dropboxFile
+- (void)_updateDropboxRepresentation:(DBFILESMetadata *)dropboxFile
 {
     if (dropboxFile != nil) {
-        if (dropboxFile.isDirectory) {
+        if ([dropboxFile isKindOfClass: [DBFILESFolderMetadata class]]) {
             self.isDirectory = YES;
-            self.title = dropboxFile.filename;
+            self.thumbnailImage = [UIImage imageNamed:@"folder"];
         } else {
-            self.isDirectory = NO;
-            self.subtitle = (dropboxFile.totalBytes > 0) ? dropboxFile.humanReadableSize : @"";
-
-        }
-        self.title = dropboxFile.filename;
+            DBFILESFileMetadata *file = (DBFILESFileMetadata *)dropboxFile;
 
-        NSString *iconName = dropboxFile.icon;
-        if ([iconName isEqualToString:@"folder_user"] || [iconName isEqualToString:@"folder"] || [iconName isEqualToString:@"folder_public"] || [iconName isEqualToString:@"folder_photos"] || [iconName isEqualToString:@"package"]) {
+            self.isDirectory = NO;
+            self.subtitle = (file.size.integerValue > 0) ? [NSByteCountFormatter stringFromByteCount:file.size.longLongValue countStyle:NSByteCountFormatterCountStyleFile] : @"";
             self.thumbnailImage = [UIImage imageNamed:@"folder"];
-        } else
-            self.thumbnailImage = [UIImage imageNamed:@"blank"];
+        }
+        self.title = dropboxFile.name;
     }
-
 }
 
 - (void)_updateBoxRepresentation:(BoxItem *)boxFile