Prechádzať zdrojové kódy

ATV: add OneDrive support

Felix Paul Kühne 9 rokov pred
rodič
commit
26bdb0ca14

+ 2 - 2
Sources/VLCCloudStorageTableViewCell.h

@@ -12,10 +12,10 @@
  *****************************************************************************/
 
 #import "VLCDropboxController.h"
+#import "VLCOneDriveObject.h"
 #if TARGET_OS_IOS
 #import "GTLDrive.h"
 #import <BoxSDK/BoxSDK.h>
-#import "VLCOneDriveObject.h"
 #endif
 
 @interface VLCCloudStorageTableViewCell : UITableViewCell
@@ -29,10 +29,10 @@
 @property (nonatomic, strong) IBOutlet UIButton *downloadButton;
 
 @property (nonatomic, retain) DBMetadata *dropboxFile;
+@property (nonatomic, retain) VLCOneDriveObject *oneDriveFile;
 #if TARGET_OS_IOS
 @property (nonatomic, retain) GTLDriveFile *driveFile;
 @property (nonatomic, retain) BoxItem *boxFile;
-@property (nonatomic, retain) VLCOneDriveObject *oneDriveFile;
 #endif
 
 @property (nonatomic, readwrite) BOOL isDownloadable;

+ 4 - 3
Sources/VLCCloudStorageTableViewCell.m

@@ -57,6 +57,7 @@
     [self performSelectorOnMainThread:@selector(_updatedDisplayedInformation)
                            withObject:nil waitUntilDone:NO];
 }
+#endif
 
 - (void)setOneDriveFile:(VLCOneDriveObject *)oneDriveFile
 {
@@ -66,7 +67,6 @@
     [self performSelectorOnMainThread:@selector(_updatedDisplayedInformation)
                            withObject:nil waitUntilDone:NO];
 }
-#endif
 
 - (void)_updatedDisplayedInformation
 {
@@ -152,7 +152,9 @@
             self.thumbnailView.image = [UIImage imageNamed:@"blank"];
             APLog(@"missing icon for type '%@'", self.boxFile);
         }
-    } else if(_oneDriveFile != nil) {
+    }
+#endif
+    else if(_oneDriveFile != nil) {
         if (_oneDriveFile.isFolder) {
             self.downloadButton.hidden = YES;
             self.folderTitleLabel.text = self.oneDriveFile.name;
@@ -191,7 +193,6 @@
                 self.thumbnailView.image = [UIImage imageNamed:@"blank"];
         }
     }
-#endif
 
     [self setNeedsDisplay];
 }

+ 10 - 8
Sources/VLCOneDriveTableViewController.m

@@ -119,14 +119,6 @@
     [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
 }
 
-- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-{
-    if (buttonIndex == 1)
-        [_oneDriveController downloadObject:_selectedFile];
-
-    _selectedFile = nil;
-}
-
 #pragma mark - login dialog
 
 - (void)loginAction:(id)sender
@@ -147,6 +139,7 @@
 
 #pragma mark - cell delegation
 
+#if TARGET_OS_IOS
 - (void)triggerDownloadForCell:(VLCCloudStorageTableViewCell *)cell
 {
     NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
@@ -170,4 +163,13 @@
     }
 }
 
+- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
+{
+    if (buttonIndex == 1)
+        [_oneDriveController downloadObject:_selectedFile];
+
+    _selectedFile = nil;
+}
+#endif
+
 @end

+ 1 - 0
VLC for Apple TV/VLCCloudServicesTVViewController.h

@@ -14,5 +14,6 @@
 @interface VLCCloudServicesTVViewController : UIViewController
 
 - (IBAction)dropbox:(id)sender;
+- (IBAction)onedrive:(id)sender;
 
 @end

+ 9 - 0
VLC for Apple TV/VLCCloudServicesTVViewController.m

@@ -15,10 +15,13 @@
 #import "VLCDropboxTableViewController.h"
 #import "SSKeychain.h"
 #import "VLCPlayerDisplayController.h"
+#import "VLCOneDriveTableViewController.h"
 
 @interface VLCCloudServicesTVViewController ()
 
 @property (nonatomic) VLCDropboxTableViewController *dropboxTableViewController;
+@property (nonatomic) VLCOneDriveTableViewController *oneDriveTableViewController;
+
 @end
 
 @implementation VLCCloudServicesTVViewController
@@ -27,6 +30,7 @@
     [super viewDidLoad];
 
     self.dropboxTableViewController = [[VLCDropboxTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil];
+    self.oneDriveTableViewController = [[VLCOneDriveTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil];
 }
 
 - (NSString *)title
@@ -60,4 +64,9 @@
     [self presentViewController:alert animated:YES completion:nil];
 }
 
+- (void)onedrive:(id)sender
+{
+    [self showDetailViewController:self.oneDriveTableViewController sender:self];
+}
+
 @end

+ 5 - 2
VLC for Apple TV/VLCCloudServicesTVViewController.xib

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder.AppleTV.XIB" version="3.0" toolsVersion="9058" systemVersion="15A284" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder.AppleTV.XIB" version="3.0" toolsVersion="9059" systemVersion="15B42" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9048"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
     </dependencies>
     <objects>
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCCloudServicesTVViewController">
@@ -47,6 +47,9 @@
                     <animations/>
                     <inset key="contentEdgeInsets" minX="40" minY="20" maxX="40" maxY="20"/>
                     <state key="normal" title="OneDrive"/>
+                    <connections>
+                        <action selector="onedrive:" destination="-1" eventType="primaryActionTriggered" id="FXo-bT-UMk"/>
+                    </connections>
                 </button>
             </subviews>
             <animations/>

+ 2 - 0
VLC for iOS.xcodeproj/project.pbxproj

@@ -71,6 +71,7 @@
 		7D0C352F1BD97BC50058CD19 /* libLiveTVSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D0C352E1BD97BC50058CD19 /* libLiveTVSDK.a */; };
 		7D0C35331BD97C100058CD19 /* VLCOneDriveController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D1052ED1A4DCD1E00295F08 /* VLCOneDriveController.m */; };
 		7D0C35341BD97C7B0058CD19 /* VLCOneDriveObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DB847D61A5871570002DC30 /* VLCOneDriveObject.m */; };
+		7D0C35371BD97E870058CD19 /* VLCOneDriveTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D1052E81A4DCC1100295F08 /* VLCOneDriveTableViewController.m */; };
 		7D1052E91A4DCC1100295F08 /* VLCOneDriveTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D1052E81A4DCC1100295F08 /* VLCOneDriveTableViewController.m */; };
 		7D1052EE1A4DCD1E00295F08 /* VLCOneDriveController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D1052ED1A4DCD1E00295F08 /* VLCOneDriveController.m */; };
 		7D1276621AADA0E600F0260C /* VLCMultiSelectionMenuView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D1276611AADA0E600F0260C /* VLCMultiSelectionMenuView.m */; };
@@ -2492,6 +2493,7 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				7D0C35371BD97E870058CD19 /* VLCOneDriveTableViewController.m in Sources */,
 				7DEC8C1F1BD6A113006E1093 /* UIDevice+VLC.m in Sources */,
 				7D0C34E71BD951080058CD19 /* NSString+SupportedMedia.m in Sources */,
 				7DC71D211BC83058001FACAA /* VLCAppSharesTVViewController.m in Sources */,