Browse Source

dropbox table view controller: Added support for ATV

Felix Paul Kühne 9 years ago
parent
commit
64ef62bf1f
1 changed files with 21 additions and 9 deletions
  1. 21 9
      Sources/VLCDropboxTableViewController.m

+ 21 - 9
Sources/VLCDropboxTableViewController.m

@@ -16,9 +16,14 @@
 
 
 #import "VLCDropboxTableViewController.h"
 #import "VLCDropboxTableViewController.h"
 #import "VLCDropboxController.h"
 #import "VLCDropboxController.h"
-#import "VLCAppDelegate.h"
 #import "VLCDropboxConstants.h"
 #import "VLCDropboxConstants.h"
+#import "VLCCloudStorageTableViewCell.h"
 #import "UIDevice+VLC.h"
 #import "UIDevice+VLC.h"
+#import "DBKeychain.h"
+#if TARGET_OS_IOS
+#import "VLCAppDelegate.h"
+#endif
+
 
 
 @interface VLCDropboxTableViewController () <VLCCloudStorageTableViewCell>
 @interface VLCDropboxTableViewController () <VLCCloudStorageTableViewCell>
 {
 {
@@ -43,10 +48,12 @@
     self.controller = _dropboxController;
     self.controller = _dropboxController;
     self.controller.delegate = self;
     self.controller.delegate = self;
 
 
+#if TARGET_OS_IOS
     [[NSNotificationCenter defaultCenter] addObserver:self
     [[NSNotificationCenter defaultCenter] addObserver:self
                                              selector:@selector(sessionWasUpdated:)
                                              selector:@selector(sessionWasUpdated:)
                                                  name:VLCDropboxSessionWasAuthorized
                                                  name:VLCDropboxSessionWasAuthorized
                                                object:nil];
                                                object:nil];
+#endif
 
 
     DBSession* dbSession = [[DBSession alloc] initWithAppKey:kVLCDropboxAppKey appSecret:kVLCDropboxPrivateKey root:kDBRootDropbox];
     DBSession* dbSession = [[DBSession alloc] initWithAppKey:kVLCDropboxAppKey appSecret:kVLCDropboxPrivateKey root:kDBRootDropbox];
     [DBSession setSharedSession:dbSession];
     [DBSession setSharedSession:dbSession];
@@ -113,14 +120,6 @@
     [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
     [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
 }
 }
 
 
-- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
-{
-    if (buttonIndex == 1)
-        [_dropboxController downloadFileToDocumentFolder:_selectedFile];
-
-    _selectedFile = nil;
-}
-
 #pragma mark - login dialog
 #pragma mark - login dialog
 
 
 - (IBAction)loginAction:(id)sender
 - (IBAction)loginAction:(id)sender
@@ -136,10 +135,13 @@
 {
 {
     self.authorizationInProgress = YES;
     self.authorizationInProgress = YES;
     [self updateViewAfterSessionChange];
     [self updateViewAfterSessionChange];
+
+    [_dropboxController shareCredentials];
 }
 }
 
 
 #pragma mark - VLCCloudStorageTableViewCell delegation
 #pragma mark - VLCCloudStorageTableViewCell delegation
 
 
+#if TARGET_OS_IOS
 - (void)triggerDownloadForCell:(VLCCloudStorageTableViewCell *)cell
 - (void)triggerDownloadForCell:(VLCCloudStorageTableViewCell *)cell
 {
 {
     _selectedFile = _dropboxController.currentListFiles[[self.tableView indexPathForCell:cell].row];
     _selectedFile = _dropboxController.currentListFiles[[self.tableView indexPathForCell:cell].row];
@@ -162,4 +164,14 @@
     }
     }
 }
 }
 
 
+- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
+{
+    if (buttonIndex == 1)
+        [_dropboxController downloadFileToDocumentFolder:_selectedFile];
+
+    _selectedFile = nil;
+}
+
+#endif
+
 @end
 @end