瀏覽代碼

cloud services: remove duplication

Carola Nitz 10 年之前
父節點
當前提交
e4864f0101

+ 3 - 22
Sources/VLCBoxController.h

@@ -11,33 +11,14 @@
  *****************************************************************************/
 
 #import <BoxSDK/BoxSDK.h>
+#import "VLCCloudStorageController.h"
 #import "VLCBoxConstants.h"
 
-@protocol VLCBoxController <NSObject>
-@required
-- (void)mediaListUpdated;
+@interface VLCBoxController : VLCCloudStorageController
 
-@optional
-- (void)operationWithProgressInformationStarted;
-- (void)currentProgressInformation:(CGFloat)progress;
-- (void)updateRemainingTime:(NSString *)time;
-- (void)operationWithProgressInformationStopped;
-- (void)numberOfFilesWaitingToBeDownloadedChanged;
-@end
-
-@interface VLCBoxController : NSObject
-
-@property (nonatomic, weak) id<VLCBoxController> delegate;
-@property (nonatomic, readonly) NSArray *currentListFiles;
-@property (nonatomic, readwrite) BOOL isAuthorized;
-
-+ (VLCBoxController *)sharedInstance;
-- (void)startSession;
 - (void)stopSession;
-- (void)logout;
-- (void)requestDirectoryListingWithFolderId:(NSString *)folderId;
-- (BOOL)hasMoreFiles;
 - (void)streamFile:(BoxFile *)file;
 - (void)downloadFileToDocumentFolder:(BoxFile *)file;
+- (BOOL)hasMoreFiles;
 
 @end

+ 4 - 4
Sources/VLCBoxController.m

@@ -40,7 +40,7 @@
 
 #pragma mark - session handling
 
-+ (VLCBoxController *)sharedInstance
++ (VLCCloudStorageController *)sharedInstance
 {
     static VLCBoxController *sharedInstance = nil;
     static dispatch_once_t pred;
@@ -95,12 +95,12 @@
 }
 
 #pragma mark - file management
-- (void)requestDirectoryListingWithFolderId:(NSString *)folderId
+- (void)requestDirectoryListingAtPath:(NSString *)path
 {
     //we entered a different folder so discard all current files
-    if (![folderId isEqualToString:_folderId])
+    if (![path isEqualToString:_folderId])
         _currentFileList = nil;
-    [self listFilesWithID:folderId];
+    [self listFilesWithID:path];
 }
 
 - (BOOL)hasMoreFiles

+ 23 - 181
Sources/VLCBoxTableViewController.m

@@ -11,28 +11,13 @@
  *****************************************************************************/
 
 #import "VLCBoxTableViewController.h"
-#import "VLCCloudStorageTableViewCell.h"
 #import "VLCBoxController.h"
 #import "VLCAppDelegate.h"
-#import "VLCProgressView.h"
-#import "UIBarButtonItem+Theme.h"
 #import <SSKeychain/SSKeychain.h>
 
-@interface VLCBoxTableViewController () <VLCCloudStorageTableViewCell, VLCBoxController, BoxAuthorizationViewControllerDelegate>
+@interface VLCBoxTableViewController () <VLCCloudStorageTableViewCell, BoxAuthorizationViewControllerDelegate>
 {
     BoxFile *_selectedFile;
-
-    NSString *_currentFolderId;
-
-    UIBarButtonItem *_numberOfFilesBarButtonItem;
-    UIBarButtonItem *_logoutButton;
-    UIBarButtonItem *_progressBarButtonItem;
-
-    VLCProgressView *_progressView;
-
-    UIActivityIndicatorView *_activityIndicator;
-
-    BOOL _authorizationInProgress;
     VLCBoxController *_boxController;
 }
 
@@ -43,54 +28,16 @@
 - (void)viewDidLoad
 {
     [super viewDidLoad];
-    self.modalPresentationStyle = UIModalPresentationFormSheet;
 
-    _boxController = [VLCBoxController sharedInstance];
-    _boxController.delegate = self;
+    _boxController = (VLCBoxController *)[VLCBoxController sharedInstance];
     [_boxController startSession];
-
-    _authorizationInProgress = NO;
+    self.controller = _boxController;
+    self.controller.delegate = self;
 
     self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BoxWhite"]];
-    self.navigationItem.titleView.contentMode = UIViewContentModeScaleAspectFit;
-
-    UIBarButtonItem *backButton = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(goBack:)];
-    self.navigationItem.leftBarButtonItem = backButton;
-
-    _logoutButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BUTTON_LOGOUT", "") style:UIBarButtonItemStyleBordered target:self action:@selector(logout)];
-
-    self.tableView.rowHeight = [VLCCloudStorageTableViewCell heightOfCell];
-    self.tableView.separatorColor = [UIColor VLCDarkBackgroundColor];
-    self.view.backgroundColor = [UIColor VLCDarkBackgroundColor];
-
-    _numberOfFilesBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@"NUM_OF_FILES", nil), 0] style:UIBarButtonItemStylePlain target:nil action:nil];
-    [_numberOfFilesBarButtonItem setTitleTextAttributes:@{ UITextAttributeFont : [UIFont systemFontOfSize:11.] } forState:UIControlStateNormal];
-
-    _progressView = [VLCProgressView new];
-    _progressBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:_progressView];
 
     [self.cloudStorageLogo setImage:[UIImage imageNamed:@"BoxWhite"]];
 
-    if (!SYSTEM_RUNS_IOS7_OR_LATER) {
-        self.flatLoginButton.hidden = YES;
-        [self.loginButton setTitle:NSLocalizedString(@"DROPBOX_LOGIN", nil) forState:UIControlStateNormal];
-    } else {
-        self.loginButton.hidden = YES;
-        [self.flatLoginButton setTitle:NSLocalizedString(@"DROPBOX_LOGIN", nil) forState:UIControlStateNormal];
-    }
-
-    [self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"sudHeaderBg"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
-
-    [self _showProgressInToolbar:NO];
-
-    _activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
-    _activityIndicator.hidesWhenStopped = YES;
-    _activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
-    [self.view addSubview:_activityIndicator];
-
-    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_activityIndicator attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]];
-    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_activityIndicator attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0]];
-
     [self.cloudStorageLogo sizeToFit];
     self.cloudStorageLogo.center = self.view.center;
     
@@ -135,58 +82,24 @@
 
 - (void)viewWillAppear:(BOOL)animated
 {
-    self.navigationController.toolbarHidden = NO;
-    self.navigationController.toolbar.barStyle = UIBarStyleBlack;
-    [self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"bottomBlackBar"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
-    _currentFolderId = @"";
-    if([_boxController.currentListFiles count] == 0)
-        [self _requestInformationForCurrentFolderId];
     [super viewWillAppear:animated];
+    self.currentPath = @"";
+    if([_boxController.currentListFiles count] == 0)
+        [self _requestInformationForCurrentPath];
 }
 
 - (void)viewWillDisappear:(BOOL)animated
 {
-    self.navigationController.toolbarHidden = YES;
+    [super viewWillDisappear:animated];
     if ((VLCAppDelegate*)[UIApplication sharedApplication].delegate.window.rootViewController.presentedViewController == nil) {
         [_boxController stopSession];
         [self.tableView reloadData];
     }
-    [super viewWillDisappear:animated];
-}
-
-- (void)_showProgressInToolbar:(BOOL)value
-{
-    if (!value)
-        [self setToolbarItems:@[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], _numberOfFilesBarButtonItem, [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]] animated:YES];
-    else {
-        _progressView.progressBar.progress = 0.;
-        [self setToolbarItems:@[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], _progressBarButtonItem, [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]] animated:YES];
-    }
-}
-
-- (void)_requestInformationForCurrentFolderId
-{
-    [_activityIndicator startAnimating];
-    [_boxController requestDirectoryListingWithFolderId:_currentFolderId];
-}
-
-- (IBAction)goBack:(id)sender
-{
-    if (![_currentFolderId isEqualToString:@""] && [_currentFolderId length] > 0) {
-        _currentFolderId = [_currentFolderId stringByDeletingLastPathComponent];
-        [self _requestInformationForCurrentFolderId];
-    } else
-        [self.navigationController popViewControllerAnimated:YES];
 }
 
 #pragma mark - Table view data source
 
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
-{
-    return _boxController.currentListFiles.count;
-}
-
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+- (VLCCloudStorageTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
     static NSString *CellIdentifier = @"BoxCell";
 
@@ -202,11 +115,6 @@
 
 #pragma mark - Table view delegate
 
-- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    cell.backgroundColor = (indexPath.row % 2 == 0)? [UIColor blackColor]: [UIColor VLCDarkBackgroundColor];
-}
-
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
     _selectedFile = _boxController.currentListFiles[indexPath.row];
@@ -215,10 +123,10 @@
         [_boxController downloadFileToDocumentFolder:_selectedFile];
     } else {
         /* dive into subdirectory */
-        if (![_currentFolderId isEqualToString:@""])
-            _currentFolderId = [_currentFolderId stringByAppendingString:@"/"];
-            _currentFolderId = [_currentFolderId stringByAppendingString:_selectedFile.modelID];
-        [self _requestInformationForCurrentFolderId];
+        if (![self.currentPath isEqualToString:@""])
+            self.currentPath = [self.currentPath stringByAppendingString:@"/"];
+        self.currentPath = [self.currentPath stringByAppendingString:_selectedFile.modelID];
+        [self _requestInformationForCurrentPath];
     }
     [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
 }
@@ -232,17 +140,6 @@
     [alert show];
 }
 
-- (void)scrollViewDidScroll:(UIScrollView *)scrollView
-{
-    NSInteger currentOffset = scrollView.contentOffset.y;
-    NSInteger maximumOffset = scrollView.contentSize.height - scrollView.frame.size.height;
-
-    if (maximumOffset - currentOffset <= - self.tableView.rowHeight) {
-        if (_boxController.hasMoreFiles && !_activityIndicator.isAnimating) {
-            [self _requestInformationForCurrentFolderId];
-        }
-    }
-}
 
 - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
 {
@@ -253,40 +150,6 @@
 
 #pragma mark - box controller delegate
 
-- (void)mediaListUpdated
-{
-    [_activityIndicator stopAnimating];
-
-    [self.tableView reloadData];
-
-    NSUInteger count = _boxController.currentListFiles.count;
-    if (count == 0)
-        _numberOfFilesBarButtonItem.title = NSLocalizedString(@"NO_FILES", nil);
-    else if (count != 1)
-        _numberOfFilesBarButtonItem.title = [NSString stringWithFormat:NSLocalizedString(@"NUM_OF_FILES", nil), count];
-    else
-        _numberOfFilesBarButtonItem.title = NSLocalizedString(@"ONE_FILE", nil);
-}
-
-- (void)operationWithProgressInformationStarted
-{
-    [self _showProgressInToolbar:YES];
-}
-
-- (void)updateRemainingTime:(NSString *)time
-{
-   [_progressView updateTime:time];
-}
-
-- (void)currentProgressInformation:(CGFloat)progress {
-    [_progressView.progressBar setProgress:progress animated:YES];
-}
-
-- (void)operationWithProgressInformationStopped
-{
-    [self _showProgressInToolbar:NO];
-}
-
 #pragma mark - BoxAuthorizationViewControllerDelegate
 
 - (BOOL)authorizationViewController:(BoxAuthorizationViewController *)authorizationViewController shouldLoadReceivedOAuth2RedirectRequest:(NSURLRequest *)request
@@ -315,9 +178,9 @@
 {
     NSString *token = [BoxSDK sharedSDK].OAuth2Session.refreshToken;
     [SSKeychain setPassword:token forService:kVLCBoxService account:kVLCBoxAccount];
-    _authorizationInProgress = YES;
+    self.authorizationInProgress = YES;
     [self updateViewAfterSessionChange];
-    _authorizationInProgress = NO;
+    self.authorizationInProgress = NO;
 }
 
 - (void)boxAPIAuthenticationDidFail
@@ -335,48 +198,27 @@
     [self.navigationController popViewControllerAnimated:YES];
 }
 
-- (void)updateViewAfterSessionChange
+- (void)scrollViewDidScroll:(UIScrollView *)scrollView
 {
-    self.navigationItem.rightBarButtonItem = _logoutButton;
-    if(_authorizationInProgress) {
-        if (self.loginToCloudStorageView.superview) {
-            [self.loginToCloudStorageView removeFromSuperview];
+    NSInteger currentOffset = scrollView.contentOffset.y;
+    NSInteger maximumOffset = scrollView.contentSize.height - scrollView.frame.size.height;
+
+    if (maximumOffset - currentOffset <= - self.tableView.rowHeight) {
+        if (_boxController.hasMoreFiles && !self.activityIndicator.isAnimating) {
+            [self _requestInformationForCurrentPath];
         }
-        return;
-    }
-    if (![_boxController isAuthorized]) {
-        [self _showLoginPanel];
-        return;
     }
-
-    //reload if we didn't come back from streaming
-    _currentFolderId = @"";
-    if([_boxController.currentListFiles count] == 0)
-        [self _requestInformationForCurrentFolderId];
 }
-
 #pragma mark - login dialog
 
-- (void)_showLoginPanel
-{
-    self.loginToCloudStorageView.frame = self.tableView.frame;
-    self.navigationItem.rightBarButtonItem = nil;
-    [self.view addSubview:self.loginToCloudStorageView];
-}
-
 - (IBAction)loginAction:(id)sender
 {
     if (![_boxController isAuthorized]) {
-        _authorizationInProgress = YES;
+        self.authorizationInProgress = YES;
         [self.navigationController pushViewController:[self createAuthController] animated:YES];
     } else {
         [_boxController logout];
     }
 }
 
-- (void)logout
-{
-    [_boxController logout];
-    [self updateViewAfterSessionChange];
-}
 @end

+ 1 - 0
Sources/VLCCloudServicesTableViewController.m

@@ -52,6 +52,7 @@
     self.oneDriveTableViewController = [[VLCOneDriveTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil];
     self.documentPickerController = [VLCDocumentPickerController new];
 }
+
 - (void)viewWillAppear:(BOOL)animated
 {
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(authenticationSessionsChanged:) name:VLCOneDriveControllerSessionUpdated object:nil];

+ 37 - 0
Sources/VLCCloudStorageController.h

@@ -0,0 +1,37 @@
+//
+//  VLCCloudStorageController.h
+//  VLC for iOS
+//
+//  Created by Carola Nitz on 31/12/14.
+//  Copyright (c) 2014 VideoLAN. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@protocol VLCCloudStorageDelegate <NSObject>
+
+@required
+- (void)mediaListUpdated;
+
+@optional
+- (void)operationWithProgressInformationStarted;
+- (void)currentProgressInformation:(CGFloat)progress;
+- (void)updateRemainingTime:(NSString *)time;
+- (void)operationWithProgressInformationStopped;
+- (void)numberOfFilesWaitingToBeDownloadedChanged;
+- (void)sessionWasUpdated;
+@end
+
+@interface VLCCloudStorageController : NSObject
+
+@property (nonatomic, weak) id<VLCCloudStorageDelegate> delegate;
+@property (nonatomic, readwrite) BOOL isAuthorized;
+@property (nonatomic, readonly) NSArray *currentListFiles;
+
++ (VLCCloudStorageController *)sharedInstance;
+
+- (void)startSession;
+- (void)logout;
+- (void)requestDirectoryListingAtPath:(NSString *)path;
+
+@end

+ 13 - 0
Sources/VLCCloudStorageController.m

@@ -0,0 +1,13 @@
+//
+//  VLCCloudStorageController.m
+//  VLC for iOS
+//
+//  Created by Carola Nitz on 31/12/14.
+//  Copyright (c) 2014 VideoLAN. All rights reserved.
+//
+
+#import "VLCCloudStorageController.h"
+
+@implementation VLCCloudStorageController
+
+@end

+ 12 - 0
Sources/VLCCloudStorageTableViewController.h

@@ -12,6 +12,9 @@
  * Refer to the COPYING file of the official project for license.
  *****************************************************************************/
 
+#import "VLCCloudStorageTableViewCell.h"
+#import "VLCCloudStorageController.h"
+
 @interface VLCCloudStorageTableViewController : UIViewController
 
 @property (nonatomic, strong) IBOutlet UITableView *tableView;
@@ -20,8 +23,17 @@
 @property (nonatomic, strong) IBOutlet UIButton *flatLoginButton;
 @property (nonatomic, strong) IBOutlet UIImageView *cloudStorageLogo;
 
+@property (nonatomic, strong) UIBarButtonItem *numberOfFilesBarButtonItem;
+@property (nonatomic, strong) VLCCloudStorageController *controller;
+@property (nonatomic, strong) NSString *currentPath;
+@property (nonatomic) BOOL authorizationInProgress;
+@property (nonatomic, strong) UIActivityIndicatorView *activityIndicator;
+
 - (IBAction)loginAction:(id)sender;
 
+- (void)_requestInformationForCurrentPath;
+- (void)_showLoginPanel;
 - (void)updateViewAfterSessionChange;
+- (void)goBack;
 
 @end

+ 176 - 1
Sources/VLCCloudStorageTableViewController.m

@@ -13,15 +13,190 @@
  *****************************************************************************/
 
 #import "VLCCloudStorageTableViewController.h"
+#import "UIBarButtonItem+Theme.h"
+#import "VLCProgressView.h"
+
+@interface VLCCloudStorageTableViewController() <VLCCloudStorageDelegate>
+{
+    VLCProgressView *_progressView;
+    
+    UIBarButtonItem *_progressBarButtonItem;
+    UIBarButtonItem *_logoutButton;
+}
+
+@end
 
 @implementation VLCCloudStorageTableViewController
 
-- (IBAction)loginAction:(id)sender
+- (void)viewDidLoad
+{
+    [super viewDidLoad];
+
+    _authorizationInProgress = NO;
+
+    self.modalPresentationStyle = UIModalPresentationFormSheet;
+    self.navigationItem.titleView.contentMode = UIViewContentModeScaleAspectFit;
+    
+    UIBarButtonItem *backButton = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(goBack)];
+    self.navigationItem.leftBarButtonItem = backButton;
+
+    _logoutButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BUTTON_LOGOUT", "") style:UIBarButtonItemStyleBordered target:self action:@selector(logout)];
+
+    if (!SYSTEM_RUNS_IOS7_OR_LATER) {
+        self.flatLoginButton.hidden = YES;
+        [self.loginButton setTitle:NSLocalizedString(@"DROPBOX_LOGIN", nil) forState:UIControlStateNormal];
+    } else {
+        self.loginButton.hidden = YES;
+        [self.flatLoginButton setTitle:NSLocalizedString(@"DROPBOX_LOGIN", nil) forState:UIControlStateNormal];
+    }
+
+    [self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"sudHeaderBg"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
+
+    self.tableView.rowHeight = [VLCCloudStorageTableViewCell heightOfCell];
+    self.tableView.separatorColor = [UIColor VLCDarkBackgroundColor];
+    self.view.backgroundColor = [UIColor VLCDarkBackgroundColor];
+
+    _progressView = [VLCProgressView new];
+    _progressBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:_progressView];
+
+    _numberOfFilesBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@"NUM_OF_FILES", nil), 0] style:UIBarButtonItemStylePlain target:nil action:nil];
+    [_numberOfFilesBarButtonItem setTitleTextAttributes:@{ UITextAttributeFont : [UIFont systemFontOfSize:11.] } forState:UIControlStateNormal];
+
+    _activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
+    _activityIndicator.hidesWhenStopped = YES;
+    _activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
+    
+    [self.view addSubview:_activityIndicator];
+
+    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_activityIndicator attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]];
+    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_activityIndicator attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0]];
+    
+    [self _showProgressInToolbar:NO];
+}
+
+- (void)viewWillAppear:(BOOL)animated
+{
+    self.navigationController.toolbarHidden = NO;
+    self.navigationController.toolbar.barStyle = UIBarStyleBlack;
+    [self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"bottomBlackBar"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
+    [super viewWillAppear:animated];
+}
+
+- (void)viewWillDisappear:(BOOL)animated
 {
+    self.navigationController.toolbarHidden = YES;
+    [super viewWillDisappear:animated];
+}
+
+- (void)_requestInformationForCurrentPath
+{
+    [_activityIndicator startAnimating];
+    [self.controller requestDirectoryListingAtPath:self.currentPath];
+}
+
+- (void)mediaListUpdated
+{
+    [_activityIndicator stopAnimating];
+
+    [self.tableView reloadData];
+
+    NSUInteger count = self.controller.currentListFiles.count;
+    if (count == 0)
+        self.numberOfFilesBarButtonItem.title = NSLocalizedString(@"NO_FILES", nil);
+    else if (count != 1)
+        self.numberOfFilesBarButtonItem.title = [NSString stringWithFormat:NSLocalizedString(@"NUM_OF_FILES", nil), count];
+    else
+        self.numberOfFilesBarButtonItem.title = NSLocalizedString(@"ONE_FILE", nil);
+}
+
+- (void)_showProgressInToolbar:(BOOL)value
+{
+    if (!value)
+        [self setToolbarItems:@[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], _numberOfFilesBarButtonItem, [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]] animated:YES];
+    else {
+        _progressView.progressBar.progress = 0.;
+        [self setToolbarItems:@[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], _progressBarButtonItem, [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]] animated:YES];
+    }
+}
+
+- (void)operationWithProgressInformationStarted
+{
+    [self _showProgressInToolbar:YES];
+}
+
+- (void)updateRemainingTime:(NSString *)time
+{
+    [_progressView updateTime:time];
+}
+
+- (void)currentProgressInformation:(CGFloat)progress
+{
+    [_progressView.progressBar setProgress:progress animated:YES];
+}
+
+- (void)operationWithProgressInformationStopped
+{
+    [self _showProgressInToolbar:NO];
+}
+#pragma mark - UITableViewDataSources
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+    return self.controller.currentListFiles.count;
+}
+
+#pragma mark - UITableViewDelegate
+
+- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    cell.backgroundColor = (indexPath.row % 2 == 0)? [UIColor blackColor]: [UIColor VLCDarkBackgroundColor];
+}
+
+- (void)goBack
+{
+    if ((![self.currentPath isEqualToString:@""] && ![self.currentPath isEqualToString:@"/"]) && [self.currentPath length] > 0) {
+        self.currentPath = [self.currentPath stringByDeletingLastPathComponent];
+        [self _requestInformationForCurrentPath];
+    } else
+        [self.navigationController popViewControllerAnimated:YES];
+}
+
+- (void)_showLoginPanel
+{
+    self.loginToCloudStorageView.frame = self.tableView.frame;
+    self.navigationItem.rightBarButtonItem = nil;
+    [self.view addSubview:self.loginToCloudStorageView];
 }
 
 - (void)updateViewAfterSessionChange
 {
+    self.navigationItem.rightBarButtonItem = _logoutButton;
+    if(_authorizationInProgress) {
+        if (self.loginToCloudStorageView.superview) {
+            [self.loginToCloudStorageView removeFromSuperview];
+        }
+        return;
+    }
+    if (![self.controller isAuthorized]) {
+        [self _showLoginPanel];
+        return;
+    }
+
+    //reload if we didn't come back from streaming
+    self.currentPath = @"";
+    if([self.controller.currentListFiles count] == 0)
+        [self _requestInformationForCurrentPath];
+}
+
+- (void)logout
+{
+    [self.controller logout];
+    [self updateViewAfterSessionChange];
+}
+
+- (IBAction)loginAction:(id)sender
+{
 }
 
+
 @end

+ 2 - 21
Sources/VLCDropboxController.h

@@ -11,31 +11,12 @@
  *****************************************************************************/
 
 #import <DropboxSDK/DropboxSDK.h>
+#import "VLCCloudStorageController.h"
 
-@protocol VLCDropboxController <NSObject>
-@required
-- (void)mediaListUpdated;
+@interface VLCDropboxController : VLCCloudStorageController <DBRestClientDelegate, DBSessionDelegate, DBNetworkRequestDelegate>
 
-@optional
-- (void)operationWithProgressInformationStarted;
-- (void)currentProgressInformation:(float)progress;
-- (void)updateRemainingTime:(NSString *)time;
-- (void)operationWithProgressInformationStopped;
-
-- (void)numberOfFilesWaitingToBeDownloadedChanged;
-@end
-
-@interface VLCDropboxController : NSObject <DBRestClientDelegate, DBSessionDelegate, DBNetworkRequestDelegate>
-
-@property (nonatomic, weak) id<VLCDropboxController> delegate;
-@property (nonatomic, readonly) NSArray *currentListFiles;
-@property (nonatomic, readonly) BOOL sessionIsLinked;
 @property (nonatomic, readonly) NSInteger numberOfFilesWaitingToBeDownloaded;
 
-- (void)startSession;
-- (void)logout;
-
-- (void)requestDirectoryListingAtPath:(NSString *)path;
 - (void)downloadFileToDocumentFolder:(DBMetadata *)file;
 - (void)streamFile:(DBMetadata *)file;
 

+ 2 - 2
Sources/VLCDropboxController.m

@@ -46,7 +46,7 @@
     [[DBSession sharedSession] unlinkAll];
 }
 
-- (BOOL)sessionIsLinked
+- (BOOL)isAuthorized
 {
     return  [[DBSession sharedSession] isLinked];
 }
@@ -62,7 +62,7 @@
 #pragma mark - file management
 - (void)requestDirectoryListingAtPath:(NSString *)path
 {
-    if (self.sessionIsLinked)
+    if (self.isAuthorized)
         [[self restClient] loadMetadata:path];
 }
 

+ 8 - 167
Sources/VLCDropboxTableViewController.m

@@ -15,27 +15,13 @@
  *****************************************************************************/
 
 #import "VLCDropboxTableViewController.h"
-#import "VLCCloudStorageTableViewCell.h"
 #import "VLCDropboxController.h"
 #import "VLCAppDelegate.h"
-#import "VLCPlaylistViewController.h"
 #import "VLCDropboxConstants.h"
-#import "UIBarButtonItem+Theme.h"
-#import <DropboxSDK/DropboxSDK.h>
-#import "VLCProgressView.h"
 
-@interface VLCDropboxTableViewController () <VLCCloudStorageTableViewCell, VLCDropboxController>
+@interface VLCDropboxTableViewController () <VLCCloudStorageTableViewCell>
 {
     VLCDropboxController *_dropboxController;
-    NSString *_currentPath;
-
-    UIBarButtonItem *_numberOfFilesBarButtonItem;
-    UIBarButtonItem *_progressBarButtonItem;
-    UIBarButtonItem *_logoutButton;
-
-    VLCProgressView *_progressView;
-
-    UIActivityIndicatorView *_activityIndicator;
     DBMetadata *_selectedFile;
 }
 
@@ -46,53 +32,18 @@
 - (void)viewDidLoad
 {
     [super viewDidLoad];
-    self.modalPresentationStyle = UIModalPresentationFormSheet;
 
     _dropboxController = [[VLCDropboxController alloc] init];
-    _dropboxController.delegate = self;
+    self.controller = _dropboxController;
+    self.controller.delegate = self;
 
     DBSession* dbSession = [[DBSession alloc] initWithAppKey:kVLCDropboxAppKey appSecret:kVLCDropboxPrivateKey root:kDBRootDropbox];
     [DBSession setSharedSession:dbSession];
     [DBRequest setNetworkRequestDelegate:_dropboxController];
 
     self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"dropbox-white"]];
-    self.navigationItem.titleView.contentMode = UIViewContentModeScaleAspectFit;
-
-    UIBarButtonItem *backButton = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(goBack:)];
-    self.navigationItem.leftBarButtonItem = backButton;
-
-    _logoutButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BUTTON_LOGOUT", "") style:UIBarButtonItemStyleBordered target:self action:@selector(logout)];
-
-    self.tableView.rowHeight = [VLCCloudStorageTableViewCell heightOfCell];
-    self.tableView.separatorColor = [UIColor VLCDarkBackgroundColor];
-    self.view.backgroundColor = [UIColor VLCDarkBackgroundColor];
-
-    _numberOfFilesBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@"NUM_OF_FILES", nil), 0] style:UIBarButtonItemStylePlain target:nil action:nil];
-    [_numberOfFilesBarButtonItem setTitleTextAttributes:@{ UITextAttributeFont : [UIFont systemFontOfSize:11.] } forState:UIControlStateNormal];
-
-    _progressView = [VLCProgressView new];
-    _progressBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:_progressView];
 
     [self.cloudStorageLogo setImage:[UIImage imageNamed:@"dropbox-white.png"]];
-    if (!SYSTEM_RUNS_IOS7_OR_LATER) {
-        self.flatLoginButton.hidden = YES;
-        [self.loginButton setTitle:NSLocalizedString(@"DROPBOX_LOGIN", nil) forState:UIControlStateNormal];
-    } else {
-        self.loginButton.hidden = YES;
-        [self.flatLoginButton setTitle:NSLocalizedString(@"DROPBOX_LOGIN", nil) forState:UIControlStateNormal];
-    }
-
-    [self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"sudHeaderBg"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
-
-    [self _showProgressInToolbar:NO];
-
-    _activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
-    _activityIndicator.hidesWhenStopped = YES;
-    _activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
-    [self.view addSubview:_activityIndicator];
-
-    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_activityIndicator attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]];
-    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_activityIndicator attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0]];
 
     [self.cloudStorageLogo sizeToFit];
     self.cloudStorageLogo.center = self.view.center;
@@ -100,33 +51,8 @@
 
 - (void)viewWillAppear:(BOOL)animated
 {
-    self.navigationController.toolbarHidden = NO;
-    self.navigationController.toolbar.barStyle = UIBarStyleBlack;
-    [self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"bottomBlackBar"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
-    [self updateViewAfterSessionChange];
     [super viewWillAppear:animated];
-}
-
-- (void)viewWillDisappear:(BOOL)animated
-{
-    self.navigationController.toolbarHidden = YES;
-    [super viewWillDisappear:animated];
-}
-
-- (void)_showProgressInToolbar:(BOOL)value
-{
-    if (!value)
-        [self setToolbarItems:@[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], _numberOfFilesBarButtonItem, [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]] animated:YES];
-    else {
-        _progressView.progressBar.progress = 0.;
-        [self setToolbarItems:@[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], _progressBarButtonItem, [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]] animated:YES];
-    }
-}
-
-- (void)_requestInformationForCurrentPath
-{
-    [_activityIndicator startAnimating];
-    [_dropboxController requestDirectoryListingAtPath:_currentPath];
+    [self updateViewAfterSessionChange];
 }
 
 #pragma mark - interface interaction
@@ -139,22 +65,8 @@
     return YES;
 }
 
-- (IBAction)goBack:(id)sender
-{
-    if (![_currentPath isEqualToString:@"/"] && [_currentPath length] > 0) {
-        _currentPath = [_currentPath stringByDeletingLastPathComponent];
-        [self _requestInformationForCurrentPath];
-    } else
-        [self.navigationController popViewControllerAnimated:YES];
-}
-
 #pragma mark - Table view data source
 
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
-{
-    return _dropboxController.currentListFiles.count;
-}
-
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
     static NSString *CellIdentifier = @"DropboxCell";
@@ -171,11 +83,6 @@
 
 #pragma mark - Table view delegate
 
-- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    cell.backgroundColor = (indexPath.row % 2 == 0)? [UIColor blackColor]: [UIColor VLCDarkBackgroundColor];
-}
-
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
     _selectedFile = _dropboxController.currentListFiles[indexPath.row];
@@ -183,7 +90,7 @@
         [_dropboxController streamFile:_selectedFile];
     else {
         /* dive into subdirectory */
-        _currentPath = [_currentPath stringByAppendingFormat:@"/%@", _selectedFile.filename];
+        self.currentPath = [self.currentPath stringByAppendingFormat:@"/%@", _selectedFile.filename];
         [self _requestInformationForCurrentPath];
     }
     _selectedFile = nil;
@@ -199,80 +106,14 @@
     _selectedFile = nil;
 }
 
-#pragma mark - dropbox controller delegate
-
-- (void)mediaListUpdated
-{
-    [_activityIndicator stopAnimating];
-
-    [self.tableView reloadData];
-
-    NSUInteger count = _dropboxController.currentListFiles.count;
-    if (count == 0)
-        _numberOfFilesBarButtonItem.title = NSLocalizedString(@"NO_FILES", nil);
-    else if (count != 1)
-        _numberOfFilesBarButtonItem.title = [NSString stringWithFormat:NSLocalizedString(@"NUM_OF_FILES", nil), count];
-    else
-        _numberOfFilesBarButtonItem.title = NSLocalizedString(@"ONE_FILE", nil);
-}
-
-- (void)operationWithProgressInformationStarted
-{
-    [self _showProgressInToolbar:YES];
-}
-
-- (void)updateRemainingTime:(NSString *)time
-{
-    [_progressView updateTime:time];
-}
-
-- (void)currentProgressInformation:(float)progress
-{
-    [_progressView.progressBar setProgress:progress animated:YES];
-}
-
-- (void)operationWithProgressInformationStopped
-{
-    [self _showProgressInToolbar:NO];
-}
-
-#pragma mark - communication with app delegate
-
-- (void)updateViewAfterSessionChange
-{
-    self.navigationItem.rightBarButtonItem = _logoutButton;
-    if (![[DBSession sharedSession] isLinked]) {
-        [self _showLoginPanel];
-        return;
-    } else if (self.loginToCloudStorageView.superview) {
-        [self.loginToCloudStorageView removeFromSuperview];
-    }
-
-    _currentPath = @"/";
-    if([_dropboxController.currentListFiles count] == 0)
-        [self _requestInformationForCurrentPath];
-}
-
 #pragma mark - login dialog
 
-- (void)logout
-{
-    [_dropboxController logout];
-    [self updateViewAfterSessionChange];
-}
-
-- (void)_showLoginPanel
-{
-    self.loginToCloudStorageView.frame = self.tableView.frame;
-    self.navigationItem.rightBarButtonItem = nil;
-    [self.view addSubview:self.loginToCloudStorageView];
-}
-
 - (IBAction)loginAction:(id)sender
 {
-    if (!_dropboxController.sessionIsLinked)
+    if (!_dropboxController.isAuthorized) {
+        self.authorizationInProgress = YES;
         [[DBSession sharedSession] linkFromController:self];
-    else
+    } else
         [_dropboxController logout];
 }
 

+ 3 - 21
Sources/VLCGoogleDriveController.h

@@ -13,34 +13,16 @@
 
 #import "GTLDrive.h"
 #import "GTMOAuth2ViewControllerTouch.h"
+#import "VLCCloudStorageController.h"
 #import "VLCGoogleDriveConstants.h"
 
-@protocol VLCGoogleDriveControllerDelegate <NSObject>
-@required
-- (void)mediaListUpdated;
+@interface VLCGoogleDriveController : VLCCloudStorageController
 
-@optional
-- (void)operationWithProgressInformationStarted;
-- (void)currentProgressInformation:(float)progress;
-- (void)updateRemainingTime:(NSString *)time;
-- (void)operationWithProgressInformationStopped;
-- (void)numberOfFilesWaitingToBeDownloadedChanged;
-@end
-
-@interface VLCGoogleDriveController : NSObject
-
-@property (nonatomic, weak) id<VLCGoogleDriveControllerDelegate> delegate;
-@property (nonatomic, readonly) NSArray *currentListFiles;
-@property (nonatomic, readwrite) BOOL isAuthorized;
 @property (nonatomic, retain) GTLServiceDrive *driveService;
 
-+ (VLCGoogleDriveController *)sharedInstance;
-- (void)startSession;
 - (void)stopSession;
-- (void)logout;
-- (void)requestDirectoryListingWithFolderId:(NSString *)folderId;
-- (BOOL)hasMoreFiles;
 - (void)streamFile:(GTLDriveFile *)file;
 - (void)downloadFileToDocumentFolder:(GTLDriveFile *)file;
+- (BOOL)hasMoreFiles;
 
 @end

+ 4 - 4
Sources/VLCGoogleDriveController.m

@@ -39,7 +39,7 @@
 
 #pragma mark - session handling
 
-+ (VLCGoogleDriveController *)sharedInstance
++ (VLCCloudStorageController *)sharedInstance
 {
     static VLCGoogleDriveController *sharedInstance = nil;
     static dispatch_once_t pred;
@@ -93,13 +93,13 @@
 }
 
 #pragma mark - file management
-- (void)requestDirectoryListingWithFolderId:(NSString *)folderId
+- (void)requestDirectoryListingAtPath:(NSString *)path
 {
     if (self.isAuthorized) {
         //we entered a different folder so discard all current files
-        if (![folderId isEqualToString:_folderId])
+        if (![path isEqualToString:_folderId])
             _currentFileList = nil;
-        [self listFilesWithID:folderId];
+        [self listFilesWithID:path];
     }
 }
 

+ 27 - 189
Sources/VLCGoogleDriveTableViewController.m

@@ -12,32 +12,17 @@
  *****************************************************************************/
 
 #import "VLCGoogleDriveTableViewController.h"
-#import "VLCCloudStorageTableViewCell.h"
 #import "VLCAppDelegate.h"
-#import "UIBarButtonItem+Theme.h"
-#import "VLCProgressView.h"
 #import "GTMOAuth2ViewControllerTouch.h"
 #import "VLCGoogleDriveController.h"
 
-@interface VLCGoogleDriveTableViewController () <VLCCloudStorageTableViewCell, VLCGoogleDriveControllerDelegate>
+@interface VLCGoogleDriveTableViewController () <VLCCloudStorageTableViewCell>
 {
 
     VLCGoogleDriveController *_googleDriveController;
 
     GTLDriveFile *_selectedFile;
     GTMOAuth2ViewControllerTouch *_authController;
-
-    NSString *_currentFolderId;
-
-    UIBarButtonItem *_numberOfFilesBarButtonItem;
-    UIBarButtonItem *_progressBarButtonItem;
-    UIBarButtonItem *_logoutButton;
-
-    VLCProgressView *_progressView;
-
-    UIActivityIndicatorView *_activityIndicator;
-
-    BOOL _authorizationInProgress;
 }
 
 @end
@@ -47,55 +32,35 @@
 - (void)viewDidLoad
 {
     [super viewDidLoad];
-    self.modalPresentationStyle = UIModalPresentationFormSheet;
-
-    _authorizationInProgress = NO;
 
     _googleDriveController = [VLCGoogleDriveController sharedInstance];
     _googleDriveController.delegate = self;
+    self.controller = _googleDriveController;
 
     self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"DriveWhite"]];
-    self.navigationItem.titleView.contentMode = UIViewContentModeScaleAspectFit;
-
-    UIBarButtonItem *backButton = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(goBack)];
-    self.navigationItem.leftBarButtonItem = backButton;
-
-    _logoutButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BUTTON_LOGOUT", "") style:UIBarButtonItemStyleBordered target:self action:@selector(logout)];
-
-    self.tableView.rowHeight = [VLCCloudStorageTableViewCell heightOfCell];
-    self.tableView.separatorColor = [UIColor VLCDarkBackgroundColor];
-    self.view.backgroundColor = [UIColor VLCDarkBackgroundColor];
-
-    _numberOfFilesBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@"NUM_OF_FILES", nil), 0] style:UIBarButtonItemStylePlain target:nil action:nil];
-    [_numberOfFilesBarButtonItem setTitleTextAttributes:@{ UITextAttributeFont : [UIFont systemFontOfSize:11.] } forState:UIControlStateNormal];
-
-    _progressView = [VLCProgressView new];
-    _progressBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:_progressView];
 
     [self.cloudStorageLogo setImage:[UIImage imageNamed:@"DriveWhite"]];
 
-    if (!SYSTEM_RUNS_IOS7_OR_LATER) {
-        self.flatLoginButton.hidden = YES;
-        [self.loginButton setTitle:NSLocalizedString(@"DROPBOX_LOGIN", nil) forState:UIControlStateNormal];
-    } else {
-        self.loginButton.hidden = YES;
-        [self.flatLoginButton setTitle:NSLocalizedString(@"DROPBOX_LOGIN", nil) forState:UIControlStateNormal];
-    }
-
-    [self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"sudHeaderBg"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
-
-    [self _showProgressInToolbar:NO];
+    [self.cloudStorageLogo sizeToFit];
+    self.cloudStorageLogo.center = self.view.center;
+}
 
-    _activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
-    _activityIndicator.hidesWhenStopped = YES;
-    _activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
-    [self.view addSubview:_activityIndicator];
+- (void)viewWillAppear:(BOOL)animated
+{
+    [super viewWillAppear:animated];
+    [self updateViewAfterSessionChange];
+}
 
-    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_activityIndicator attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]];
-    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_activityIndicator attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0]];
+- (void)scrollViewDidScroll:(UIScrollView *)scrollView
+{
+    NSInteger currentOffset = scrollView.contentOffset.y;
+    NSInteger maximumOffset = scrollView.contentSize.height - scrollView.frame.size.height;
 
-    [self.cloudStorageLogo sizeToFit];
-    self.cloudStorageLogo.center = self.view.center;
+    if (maximumOffset - currentOffset <= - self.tableView.rowHeight) {
+        if (_googleDriveController.hasMoreFiles && !self.activityIndicator.isAnimating) {
+            [self _requestInformationForCurrentPath];
+        }
+    }
 }
 
 - (GTMOAuth2ViewControllerTouch *)createAuthController
@@ -111,7 +76,7 @@
 
 - (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController finishedWithAuth:(GTMOAuth2Authentication *)authResult error:(NSError *)error
 {
-    _authorizationInProgress = NO;
+    self.authorizationInProgress = NO;
     if (error != nil) {
         _googleDriveController.driveService.authorizer = nil;
     } else {
@@ -120,63 +85,18 @@
     [self updateViewAfterSessionChange];
 }
 
-- (void)viewWillAppear:(BOOL)animated
-{
-    self.navigationController.toolbarHidden = NO;
-    self.navigationController.toolbar.barStyle = UIBarStyleBlack;
-    [self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"bottomBlackBar"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
-    [self updateViewAfterSessionChange];
-    [super viewWillAppear:animated];
-}
-
 - (void)viewWillDisappear:(BOOL)animated
 {
-    self.navigationController.toolbarHidden = YES;
-    if ((VLCAppDelegate*)[UIApplication sharedApplication].delegate.window.rootViewController.presentedViewController == nil) {
+    [super viewWillDisappear:animated];
+    if ((VLCAppDelegate *)[UIApplication sharedApplication].delegate.window.rootViewController.presentedViewController == nil) {
         [_googleDriveController stopSession];
         [self.tableView reloadData];
     }
-    [super viewWillDisappear:animated];
-}
-
-- (void)_showProgressInToolbar:(BOOL)value
-{
-    if (!value)
-        [self setToolbarItems:@[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], _numberOfFilesBarButtonItem, [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]] animated:YES];
-    else {
-        _progressView.progressBar.progress = 0.;
-        [self setToolbarItems:@[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], _progressBarButtonItem, [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]] animated:YES];
-    }
-}
-
-- (void)_requestInformationForCurrentFolderId
-{
-    [_activityIndicator startAnimating];
-    [_googleDriveController requestDirectoryListingWithFolderId:_currentFolderId];
-}
-
-- (void)goBack
-{
-    if (![_currentFolderId isEqualToString:@""] && [_currentFolderId length] > 0) {
-        _currentFolderId = [_currentFolderId stringByDeletingLastPathComponent];
-        [self _requestInformationForCurrentFolderId];
-    } else
-        [self.navigationController popViewControllerAnimated:YES];
-}
 
-- (void)logout
-{
-    [_googleDriveController logout];
-    [self updateViewAfterSessionChange];
 }
 
 #pragma mark - Table view data source
 
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
-{
-    return _googleDriveController.currentListFiles.count;
-}
-
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
     static NSString *CellIdentifier = @"GoogleDriveCell";
@@ -193,11 +113,6 @@
 
 #pragma mark - Table view delegate
 
-- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    cell.backgroundColor = (indexPath.row % 2 == 0)? [UIColor blackColor]: [UIColor VLCDarkBackgroundColor];
-}
-
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
     _selectedFile = _googleDriveController.currentListFiles[indexPath.row];
@@ -205,10 +120,10 @@
         [_googleDriveController streamFile:_selectedFile];
     } else {
         /* dive into subdirectory */
-        if (![_currentFolderId isEqualToString:@""])
-            _currentFolderId = [_currentFolderId stringByAppendingString:@"/"];
-        _currentFolderId = [_currentFolderId stringByAppendingString:_selectedFile.identifier];
-        [self _requestInformationForCurrentFolderId];
+        if (![self.currentPath isEqualToString:@""])
+            self.currentPath = [self.currentPath stringByAppendingString:@"/"];
+        self.currentPath = [self.currentPath stringByAppendingString:_selectedFile.identifier];
+        [self _requestInformationForCurrentPath];
     }
     [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
 }
@@ -222,18 +137,6 @@
     [alert show];
 }
 
-- (void)scrollViewDidScroll:(UIScrollView *)scrollView
-{
-    NSInteger currentOffset = scrollView.contentOffset.y;
-    NSInteger maximumOffset = scrollView.contentSize.height - scrollView.frame.size.height;
-
-    if (maximumOffset - currentOffset <= - self.tableView.rowHeight) {
-        if (_googleDriveController.hasMoreFiles && !_activityIndicator.isAnimating) {
-            [self _requestInformationForCurrentFolderId];
-        }
-    }
-}
-
 - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
 {
     if (buttonIndex == 1)
@@ -241,77 +144,12 @@
     _selectedFile = nil;
 }
 
-#pragma mark - google drive controller delegate
-
-- (void)mediaListUpdated
-{
-    [_activityIndicator stopAnimating];
-
-    [self.tableView reloadData];
-
-    NSUInteger count = _googleDriveController.currentListFiles.count;
-    if (count == 0)
-        _numberOfFilesBarButtonItem.title = NSLocalizedString(@"NO_FILES", nil);
-    else if (count != 1)
-        _numberOfFilesBarButtonItem.title = [NSString stringWithFormat:NSLocalizedString(@"NUM_OF_FILES", nil), count];
-    else
-        _numberOfFilesBarButtonItem.title = NSLocalizedString(@"ONE_FILE", nil);
-}
-
-- (void)operationWithProgressInformationStarted
-{
-    [self _showProgressInToolbar:YES];
-}
-
-- (void)updateRemainingTime:(NSString *)time
-{
-    [_progressView updateTime:time];
-}
-
-- (void)currentProgressInformation:(float)progress {
-    [_progressView.progressBar setProgress:progress animated:YES];
-}
-
-- (void)operationWithProgressInformationStopped
-{
-    [self _showProgressInToolbar:NO];
-}
-
-#pragma mark - communication with app delegate
-
-- (void)updateViewAfterSessionChange
-{
-    self.navigationItem.rightBarButtonItem = _logoutButton;
-    if(_authorizationInProgress) {
-        if (self.loginToCloudStorageView.superview) {
-            [self.loginToCloudStorageView removeFromSuperview];
-        }
-        return;
-    }
-    if (![_googleDriveController isAuthorized]) {
-        [self _showLoginPanel];
-        return;
-    }
-
-    //reload if we didn't come back from streaming
-    _currentFolderId = @"";
-    if([_googleDriveController.currentListFiles count] == 0)
-        [self _requestInformationForCurrentFolderId];
-}
-
 #pragma mark - login dialog
 
-- (void)_showLoginPanel
-{
-    self.loginToCloudStorageView.frame = self.tableView.frame;
-    self.navigationItem.rightBarButtonItem = nil;
-    [self.view addSubview:self.loginToCloudStorageView];
-}
-
 - (IBAction)loginAction:(id)sender
 {
     if (![_googleDriveController isAuthorized]) {
-        _authorizationInProgress = YES;
+        self.authorizationInProgress = YES;
         [self.navigationController pushViewController:[self createAuthController] animated:YES];
     } else {
         [_googleDriveController logout];

+ 1 - 20
Sources/VLCOneDriveController.h

@@ -15,34 +15,15 @@
 
 #define VLCOneDriveControllerSessionUpdated @"VLCOneDriveControllerSessionUpdated"
 
-@protocol VLCOneDriveControllerDelegate <NSObject>
+@interface VLCOneDriveController : VLCCloudStorageController
 
-@required
-- (void)sessionWasUpdated;
-- (void)mediaListUpdated;
-
-@optional
-- (void)operationWithProgressInformationStarted;
-- (void)currentProgressInformation:(float)progress;
-- (void)updateRemainingTime:(NSString *)time;
-- (void)operationWithProgressInformationStopped;
-
-- (void)numberOfFilesWaitingToBeDownloadedChanged;
-
-@end
-
-@interface VLCOneDriveController : NSObject
-
-@property (nonatomic, weak) UIViewController <VLCOneDriveControllerDelegate>*delegate;
 @property (readonly) BOOL activeSession;
-@property (readonly) BOOL userAuthenticated;
 @property (nonatomic, readonly) VLCOneDriveObject *rootFolder;
 @property (nonatomic, readwrite) VLCOneDriveObject *currentFolder;
 
 + (VLCOneDriveController *)sharedInstance;
 
 - (void)login;
-- (void)logout;
 
 - (void)downloadObject:(VLCOneDriveObject *)object;
 

+ 19 - 1
Sources/VLCOneDriveController.m

@@ -24,8 +24,11 @@
 @interface VLCOneDriveController () <LiveAuthDelegate, VLCOneDriveObjectDelegate, VLCOneDriveObjectDownloadDelegate>
 {
     LiveConnectClient *_liveClient;
+    //VLCOneDriveObject *_folderiD;
+    NSString *_folderId;
     NSArray *_liveScopes;
     BOOL _activeSession;
+    BOOL _userAuthenticated;
 
     NSMutableArray *_pendingDownloads;
     BOOL _downloadInProgress;
@@ -40,7 +43,7 @@
 
 @implementation VLCOneDriveController
 
-+ (VLCOneDriveController *)sharedInstance
++ (VLCCloudStorageController *)sharedInstance
 {
     static VLCOneDriveController *sharedInstance = nil;
     static dispatch_once_t pred;
@@ -91,6 +94,16 @@
     _userAuthenticated = NO;
 }
 
+- (NSArray *)currentListFiles
+{
+    return _currentFolder.items;
+}
+
+- (BOOL)isAuthorized
+{
+    return _liveClient.session != NULL;
+}
+
 - (void)authCompleted:(LiveConnectSessionStatus)status session:(LiveConnectSession *)session userState:(id)userState
 {
     APLog(@"OneDrive: authCompleted, status %i, state %@", status, userState);
@@ -137,6 +150,11 @@
 
 #pragma mark - listing
 
+- (void)requestDirectoryListingAtPath:(NSString *)path
+{
+    [self loadCurrentFolder];
+}
+
 - (void)loadTopLevelFolder
 {
     _rootFolder = [[VLCOneDriveObject alloc] init];

+ 11 - 163
Sources/VLCOneDriveTableViewController.m

@@ -18,19 +18,9 @@
 #import "VLCOneDriveController.h"
 #import "VLCProgressView.h"
 
-@interface VLCOneDriveTableViewController () <UITableViewDataSource, UITableViewDelegate, VLCOneDriveControllerDelegate, VLCCloudStorageTableViewCell>
+@interface VLCOneDriveTableViewController ()
 {
-    UIBarButtonItem *_backButton;
-    UIBarButtonItem *_logoutButton;
-    UIBarButtonItem *_numberOfFilesBarButtonItem;
-    UIBarButtonItem *_progressBarButtonItem;
-    VLCProgressView *_progressView;
-
-    UIActivityIndicatorView *_activityIndicator;
-
     VLCOneDriveController *_oneDriveController;
-    NSString *_currentPath;
-
     VLCOneDriveObject *_selectedFile;
 }
 @end
@@ -40,77 +30,26 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
 
-    _oneDriveController = [VLCOneDriveController sharedInstance];
-    _oneDriveController.delegate = self;
-
-    self.modalPresentationStyle = UIModalPresentationFormSheet;
+    _oneDriveController = (VLCOneDriveController *)[VLCOneDriveController sharedInstance];
+    self.controller = _oneDriveController;
+    self.controller.delegate = self;
 
     self.navigationItem.title = @"OneDrive";
 
-    _backButton = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(goBack:)];
-    self.navigationItem.leftBarButtonItem = _backButton;
-
-    _logoutButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"BUTTON_LOGOUT", "") style:UIBarButtonItemStyleBordered target:self action:@selector(logout)];
-
-    self.tableView.rowHeight = [VLCCloudStorageTableViewCell heightOfCell];
-    self.tableView.separatorColor = [UIColor VLCDarkBackgroundColor];
-    self.view.backgroundColor = [UIColor VLCDarkBackgroundColor];
-
-    _numberOfFilesBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@"NUM_OF_FILES", nil), 0] style:UIBarButtonItemStylePlain target:nil action:nil];
-    [_numberOfFilesBarButtonItem setTitleTextAttributes:@{ UITextAttributeFont : [UIFont systemFontOfSize:11.] } forState:UIControlStateNormal];
-
-    _progressView = [VLCProgressView new];
-    _progressBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:_progressView];
-
     self.cloudStorageLogo = nil;
-    if (!SYSTEM_RUNS_IOS7_OR_LATER) {
-        self.flatLoginButton.hidden = YES;
-        [self.loginButton setTitle:NSLocalizedString(@"DROPBOX_LOGIN", nil) forState:UIControlStateNormal];
-    } else {
-        self.loginButton.hidden = YES;
-        [self.flatLoginButton setTitle:NSLocalizedString(@"DROPBOX_LOGIN", nil) forState:UIControlStateNormal];
-    }
-
-    [self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"sudHeaderBg"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
-
-    [self _showProgressInToolbar:NO];
-
-    _activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
-    _activityIndicator.hidesWhenStopped = YES;
-    _activityIndicator.translatesAutoresizingMaskIntoConstraints = NO;
-    [self.view addSubview:_activityIndicator];
-
-    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_activityIndicator attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0]];
-    [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_activityIndicator attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0]];
-}
-
-- (void)viewWillAppear:(BOOL)animated
-{
-    self.navigationController.toolbarHidden = NO;
-    self.navigationController.toolbar.barStyle = UIBarStyleBlack;
-    [self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"bottomBlackBar"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
-
-    [super viewWillAppear:animated];
-
-    if (_oneDriveController.activeSession)
-        [_oneDriveController login];
-
-    if (!_oneDriveController.userAuthenticated)
-        [self _showLoginDialog];
-
     [self.cloudStorageLogo sizeToFit];
     self.cloudStorageLogo.center = self.view.center;
 }
 
-- (void)viewWillDisappear:(BOOL)animated
+- (void)viewWillAppear:(BOOL)animated
 {
-    self.navigationController.toolbarHidden = YES;
-    [super viewWillDisappear:animated];
+    [super viewWillAppear:animated];
+    [self updateViewAfterSessionChange];
 }
 
 #pragma mark - generic interface interaction
 
-- (IBAction)goBack:(id)sender
+- (void)goBack
 {
     if (_oneDriveController.rootFolder != _oneDriveController.currentFolder) {
         if ([_oneDriveController.rootFolder.name isEqualToString:_oneDriveController.currentFolder.parent.name]) {
@@ -120,7 +59,7 @@
             _oneDriveController.currentFolder = _oneDriveController.currentFolder.parent;
             self.title = _oneDriveController.currentFolder.name;
         }
-        [_activityIndicator startAnimating];
+        [self.activityIndicator startAnimating];
         [_oneDriveController loadCurrentFolder];
     } else
         [self.navigationController popViewControllerAnimated:YES];
@@ -128,11 +67,6 @@
 
 #pragma mark - table view data source
 
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
-{
-    return _oneDriveController.currentFolder.items.count;
-}
-
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
     static NSString *CellIdentifier = @"OneDriveCell";
@@ -149,18 +83,13 @@
 
 #pragma mark - table view delegate
 
-- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    cell.backgroundColor = (indexPath.row % 2 == 0)? [UIColor blackColor]: [UIColor VLCDarkBackgroundColor];
-}
-
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
     VLCOneDriveObject *selectedObject = _oneDriveController.currentFolder.items[indexPath.row];
 
     if (selectedObject.isFolder) {
         /* dive into sub folder */
-        [_activityIndicator startAnimating];
+        [self.activityIndicator startAnimating];
         _oneDriveController.currentFolder = selectedObject;
         [_oneDriveController loadCurrentFolder];
         self.title = selectedObject.name;
@@ -184,19 +113,6 @@
 
 #pragma mark - login dialog
 
-- (void)logout
-{
-    [_oneDriveController logout];
-    [self updateViewAfterSessionChange];
-}
-
-- (void)_showLoginDialog
-{
-    self.loginToCloudStorageView.frame = self.tableView.frame;
-    self.navigationItem.rightBarButtonItem = nil;
-    [self.view addSubview:self.loginToCloudStorageView];
-}
-
 - (void)loginAction:(id)sender
 {
     [_oneDriveController login];
@@ -204,80 +120,12 @@
 
 #pragma mark - onedrive controller delegation
 
-- (void)mediaListUpdated
-{
-    [_activityIndicator stopAnimating];
-
-    [self.tableView reloadData];
-
-    NSUInteger count = _oneDriveController.currentFolder.items.count;
-    if (count == 0)
-        _numberOfFilesBarButtonItem.title = NSLocalizedString(@"NO_FILES", nil);
-    else if (count != 1)
-        _numberOfFilesBarButtonItem.title = [NSString stringWithFormat:NSLocalizedString(@"NUM_OF_FILES", nil), count];
-    else
-        _numberOfFilesBarButtonItem.title = NSLocalizedString(@"ONE_FILE", nil);
-}
-
 - (void)sessionWasUpdated
 {
     [self updateViewAfterSessionChange];
 }
 
-#pragma mark - download visualization
-
-- (void)_showProgressInToolbar:(BOOL)value
-{
-    if (!value)
-        [self setToolbarItems:@[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], _numberOfFilesBarButtonItem, [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]] animated:YES];
-    else {
-        _progressView.progressBar.progress = 0.;
-        [self setToolbarItems:@[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], _progressBarButtonItem, [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]] animated:YES];
-    }
-}
-
-
-- (void)operationWithProgressInformationStarted
-{
-    [self _showProgressInToolbar:YES];
-}
-
-- (void)currentProgressInformation:(float)progress
-{
-    [_progressView.progressBar setProgress:progress animated:YES];
-}
-
-- (void)updateRemainingTime:(NSString *)time
-{
-    [_progressView updateTime:time];
-}
-
-- (void)operationWithProgressInformationStopped
-{
-    [self _showProgressInToolbar:NO];
-}
-
-#pragma mark - app delegate
-
-- (void)updateViewAfterSessionChange
-{
-    self.navigationItem.rightBarButtonItem = _logoutButton;
-    if (![_oneDriveController userAuthenticated]) {
-        [self _showLoginDialog];
-        return;
-    } else if (self.loginToCloudStorageView.superview) {
-        [self.loginToCloudStorageView removeFromSuperview];
-    }
-
-    if (_oneDriveController.currentFolder != nil)
-        [self mediaListUpdated];
-    else {
-        [_activityIndicator startAnimating];
-        [_oneDriveController loadCurrentFolder];
-    }
-}
-
-#pragma mark - cell delegationx
+#pragma mark - cell delegation
 
 - (void)triggerDownloadForCell:(VLCCloudStorageTableViewCell *)cell
 {

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

@@ -47,6 +47,7 @@
 		4171D35818A2D90200A16EF9 /* LXReorderableCollectionViewFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 4171D35718A2D90200A16EF9 /* LXReorderableCollectionViewFlowLayout.m */; };
 		417CDA231A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 417CDA211A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.m */; };
 		417CDA241A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 417CDA221A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.xib */; };
+		4184AA151A5492070063DF5A /* VLCCloudStorageController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4184AA141A5492070063DF5A /* VLCCloudStorageController.m */; };
 		418FF4B11A0EC1D5005FE808 /* libPods-vlc-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 418FF4B01A0EC1D5005FE808 /* libPods-vlc-ios.a */; };
 		41B93C011A53833B00102E8B /* VLCProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 41B93C001A53833B00102E8B /* VLCProgressView.m */; };
 		41B93C051A53835300102E8B /* VLCCloudServiceCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 41B93C031A53835300102E8B /* VLCCloudServiceCell.m */; };
@@ -563,6 +564,8 @@
 		417CDA201A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCCloudServicesTableViewController.h; path = Sources/VLCCloudServicesTableViewController.h; sourceTree = SOURCE_ROOT; };
 		417CDA211A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCCloudServicesTableViewController.m; path = Sources/VLCCloudServicesTableViewController.m; sourceTree = SOURCE_ROOT; };
 		417CDA221A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = VLCCloudServicesTableViewController.xib; path = Sources/VLCCloudServicesTableViewController.xib; sourceTree = SOURCE_ROOT; };
+		4184AA131A5492070063DF5A /* VLCCloudStorageController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCCloudStorageController.h; path = Sources/VLCCloudStorageController.h; sourceTree = SOURCE_ROOT; };
+		4184AA141A5492070063DF5A /* VLCCloudStorageController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCCloudStorageController.m; path = Sources/VLCCloudStorageController.m; sourceTree = SOURCE_ROOT; };
 		418FF4B01A0EC1D5005FE808 /* libPods-vlc-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libPods-vlc-ios.a"; path = "Pods/build/Debug-iphoneos/libPods-vlc-ios.a"; sourceTree = "<group>"; };
 		41B93BFF1A53833B00102E8B /* VLCProgressView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCProgressView.h; path = Sources/VLCProgressView.h; sourceTree = SOURCE_ROOT; };
 		41B93C001A53833B00102E8B /* VLCProgressView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCProgressView.m; path = Sources/VLCProgressView.m; sourceTree = SOURCE_ROOT; };
@@ -1897,6 +1900,8 @@
 				9B088307183D7BEC004B5C2A /* VLCCloudStorageTableViewController.m */,
 				417CDA201A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.h */,
 				417CDA211A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.m */,
+				4184AA131A5492070063DF5A /* VLCCloudStorageController.h */,
+				4184AA141A5492070063DF5A /* VLCCloudStorageController.m */,
 			);
 			name = "Cloud Integration";
 			sourceTree = "<group>";
@@ -3135,6 +3140,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				4144C4661A0ED6C700918C89 /* Reachability.m in Sources */,
+				4184AA151A5492070063DF5A /* VLCCloudStorageController.m in Sources */,
 				9BE4D1CE183D76950006346C /* VLCCloudStorageTableViewCell.m in Sources */,
 				2915540117490A1E00B86CAD /* DDData.m in Sources */,
 				2915540217490A1E00B86CAD /* DDNumber.m in Sources */,