Commit ef389642 authored by Carola Nitz's avatar Carola Nitz

clouds: Added one tableViewController for all cloud services

one tab to rule them all
parent 44c53541
......@@ -6,13 +6,13 @@ source 'https://github.com/CocoaPods/Specs.git'
target 'vlc-ios' do
pod 'OBSlider', '1.1.0'
pod 'QuincyKit', :git => 'https://github.com/carolanitz/QuincyKit.git'
pod 'PLCrashReporter', '1.2-rc5'
pod 'GHSidebarNav', '1.0.0'
pod 'InAppSettingsKit', '2.2.2'
pod 'upnpx', '1.3.0'
pod 'box-ios-sdk-v2', :git => 'https://github.com/carolanitz/box-ios-sdk-v2.git'
pod 'SSKeychain'
pod 'QuincyKit', :git => 'https://github.com/carolanitz/QuincyKit.git' #for version 3.0
pod 'box-ios-sdk-v2', :git => 'git://github.com/carolanitz/box-ios-sdk-v2.git', :commit => 'd2df30aa5f76d30910e06f3ef5aff49025de3cf1' #has a logout function added
end
post_install do |installer_representation|
......
......@@ -11,7 +11,7 @@ PODS:
- upnpx (1.3.0)
DEPENDENCIES:
- box-ios-sdk-v2 (from `https://github.com/carolanitz/box-ios-sdk-v2.git`)
- box-ios-sdk-v2 (from `git://github.com/carolanitz/box-ios-sdk-v2.git`, commit `d2df30aa5f76d30910e06f3ef5aff49025de3cf1`)
- GHSidebarNav (= 1.0.0)
- InAppSettingsKit (= 2.2.2)
- OBSlider (= 1.1.0)
......@@ -22,14 +22,15 @@ DEPENDENCIES:
EXTERNAL SOURCES:
box-ios-sdk-v2:
:git: https://github.com/carolanitz/box-ios-sdk-v2.git
:commit: d2df30aa5f76d30910e06f3ef5aff49025de3cf1
:git: git://github.com/carolanitz/box-ios-sdk-v2.git
QuincyKit:
:git: https://github.com/carolanitz/QuincyKit.git
CHECKOUT OPTIONS:
box-ios-sdk-v2:
:commit: 5b9af5cf7ad1a19eff911b2fee6ce16dfeaeab3b
:git: https://github.com/carolanitz/box-ios-sdk-v2.git
:commit: d2df30aa5f76d30910e06f3ef5aff49025de3cf1
:git: git://github.com/carolanitz/box-ios-sdk-v2.git
QuincyKit:
:commit: 5e7938a2e1f3bf08c4ed9f7f1aa3c67826df3625
:git: https://github.com/carolanitz/QuincyKit.git
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6221" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<development version="5000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6213"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
......@@ -19,26 +19,23 @@
<rect key="frame" x="5" y="8" width="64" height="64"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="File Title" lineBreakMode="tailTruncation" baselineAdjustment="none" adjustsFontSizeToFit="NO" id="6">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="File Title" lineBreakMode="tailTruncation" baselineAdjustment="none" adjustsFontSizeToFit="NO" id="6">
<rect key="frame" x="83" y="21" width="177" height="21"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.1215686275" green="0.1215686275" blue="0.1215686275" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</label>
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Folder Title" lineBreakMode="tailTruncation" baselineAdjustment="none" adjustsFontSizeToFit="NO" id="23">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Folder Title" lineBreakMode="tailTruncation" baselineAdjustment="none" adjustsFontSizeToFit="NO" id="23">
<rect key="frame" x="83" y="29" width="177" height="21"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.1215686275" green="0.1215686275" blue="0.1215686275" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</label>
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Subtitle — Subtitle" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="7">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Subtitle — Subtitle" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="7">
<rect key="frame" x="83" y="44" width="177" height="15"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.1215686275" green="0.1215686275" blue="0.1215686275" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
......@@ -59,9 +56,7 @@
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.1215686275" green="0.1215686275" blue="0.1215686275" alpha="1" colorSpace="calibratedRGB"/>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<outlet property="downloadButton" destination="VuV-6r-r3f" id="K9G-fy-OwZ"/>
<outlet property="folderTitleLabel" destination="23" id="24"/>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6221" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<development version="5000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6213"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
......@@ -19,26 +19,23 @@
<rect key="frame" x="5" y="8" width="32" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="File Title" lineBreakMode="tailTruncation" baselineAdjustment="none" adjustsFontSizeToFit="NO" id="6">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="File Title" lineBreakMode="tailTruncation" baselineAdjustment="none" adjustsFontSizeToFit="NO" id="6">
<rect key="frame" x="45" y="8" width="230" height="18"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.1215686275" green="0.1215686275" blue="0.1215686275" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</label>
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Folder Title" lineBreakMode="tailTruncation" baselineAdjustment="none" adjustsFontSizeToFit="NO" id="23">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Folder Title" lineBreakMode="tailTruncation" baselineAdjustment="none" adjustsFontSizeToFit="NO" id="23">
<rect key="frame" x="45" y="15" width="230" height="18"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="0.1215686275" green="0.1215686275" blue="0.1215686275" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</label>
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Subtitle — Subtitle" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="7">
<rect key="frame" x="45" y="25.5" width="230" height="15"/>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Subtitle — Subtitle" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="7">
<rect key="frame" x="45" y="26" width="230" height="15"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<color key="backgroundColor" red="0.1215686275" green="0.1215686275" blue="0.1215686275" alpha="1" colorSpace="calibratedRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
......@@ -59,9 +56,7 @@
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.1215686275" green="0.1215686275" blue="0.1215686275" alpha="1" colorSpace="calibratedRGB"/>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<outlet property="downloadButton" destination="661-nY-3Tr" id="ehk-e3-y2O"/>
<outlet property="folderTitleLabel" destination="23" id="24"/>
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6221" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<development version="5000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6213"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="VLCCloudStorageTableViewController">
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5053" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6221" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1552" identifier="iOS"/>
<deployment identifier="iOS"/>
<development version="5000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6213"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
......@@ -71,4 +71,9 @@ Title 2</string>
<image name="folderIcon.png" width="120" height="112"/>
<image name="thumbOverlayPhone.png" width="129" height="75"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
B"CHOOSE_AUDIO_TRACK"="Choose Audio Track";
......
......@@ -25,8 +25,8 @@
NSMutableArray *_listOfBoxFilesToDownload;
BOOL _downloadInProgress;
NSNumber *_maxOffset;
NSNumber *_offset;
int _maxOffset;
int _offset;
NSString *_folderId;
CGFloat _averageSpeed;
......@@ -192,8 +192,8 @@
- (void)_listOfGoodFilesAndFolders
{
NSMutableArray *listOfGoodFilesAndFolders = [NSMutableArray new];
_maxOffset = _fileList.totalCount;
_offset = [NSNumber numberWithInteger:_fileList.numberOfEntries];
_maxOffset = _fileList.totalCount.intValue;
_offset += _fileList.numberOfEntries;
for (int i = 0; i < _fileList.numberOfEntries; i++)
{
BoxModel *boxFile = [_fileList modelAtIndex:i];
......@@ -231,7 +231,7 @@
BoxDownloadFailureBlock failureBlock = ^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error)
{
[self showAlert:NSLocalizedString(@"BOX_ERROR_DOWNLOADING_FILE_TITLE",nil) message:NSLocalizedString(@"BOX_ERROR_DOWNLOADING_FILE",nil)];
[self showAlert:NSLocalizedString(@"GDRIVE_ERROR_DOWNLOADING_FILE_TITLE",nil) message:NSLocalizedString(@"GDRIVE_ERROR_DOWNLOADING_FILE",nil)];
[self downloadFailedWithError:error];
};
......
......@@ -24,9 +24,6 @@
NSString *_currentFolderId;
UIBarButtonItem *_backButton;
UIBarButtonItem *_backToMenuButton;
UIBarButtonItem *_numberOfFilesBarButtonItem;
UIBarButtonItem *_progressBarButtonItem;
......@@ -56,9 +53,8 @@
self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BoxWhite"]];
self.navigationItem.titleView.contentMode = UIViewContentModeScaleAspectFit;
_backButton = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(goBack:)];
_backToMenuButton = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
self.navigationItem.leftBarButtonItem = _backToMenuButton;
UIBarButtonItem *backButton = [UIBarButtonItem themedBackButtonWithTarget:self andSelector:@selector(goBack:)];
self.navigationItem.leftBarButtonItem = backButton;
self.tableView.rowHeight = [VLCCloudStorageTableViewCell heightOfCell];
self.tableView.separatorColor = [UIColor VLCDarkBackgroundColor];
......@@ -92,6 +88,9 @@
[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;
// Handle logged in
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(boxApiTokenDidRefresh)
......@@ -133,17 +132,13 @@
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.navigationController.toolbarHidden = NO;
self.navigationController.toolbar.barStyle = UIBarStyleBlack;
[self.navigationController.toolbar setBackgroundImage:[UIImage imageNamed:@"bottomBlackBar"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
//reload if we didn't come back from streaming
_currentFolderId = @"";
if([_boxController.currentListFiles count] == 0)
[self _requestInformationForCurrentFolderId];
[self.cloudStorageLogo sizeToFit];
self.cloudStorageLogo.center = self.view.center;
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
......@@ -170,8 +165,6 @@
{
[_activityIndicator startAnimating];
[_boxController requestDirectoryListingWithFolderId:_currentFolderId];
self.navigationItem.leftBarButtonItem = ![_currentFolderId isEqualToString:@""] ? _backButton : _backToMenuButton;
}
- (IBAction)goBack:(id)sender
......@@ -180,7 +173,7 @@
_currentFolderId = [_currentFolderId stringByDeletingLastPathComponent];
[self _requestInformationForCurrentFolderId];
} else
[[(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController] toggleSidebar:![(VLCAppDelegate*)[UIApplication sharedApplication].delegate revealController].sidebarShowing duration:kGHRevealSidebarDefaultAnimationDuration];
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - Table view data source
......@@ -296,7 +289,6 @@
- (BOOL)authorizationViewController:(BoxAuthorizationViewController *)authorizationViewController shouldLoadReceivedOAuth2RedirectRequest:(NSURLRequest *)request
{
[[BoxSDK sharedSDK].OAuth2Session performAuthorizationCodeGrantWithReceivedURL:request.URL];
_authorizationInProgress = NO;
[self.navigationController popViewControllerAnimated:YES];
return NO;
}
......@@ -320,8 +312,9 @@
{
NSString *token = [BoxSDK sharedSDK].OAuth2Session.refreshToken;
[SSKeychain setPassword:token forService:kVLCBoxService account:kVLCBoxAccount];
if (self.loginToCloudStorageView.superview)
[self.loginToCloudStorageView removeFromSuperview];
_authorizationInProgress = YES;
[self updateViewAfterSessionChange];
_authorizationInProgress = NO;
}
- (void)boxAPIAuthenticationDidFail
......@@ -338,12 +331,31 @@
{
[self.navigationController popViewControllerAnimated:YES];
}
- (void)updateViewAfterSessionChange
{
if(_authorizationInProgress) {
if (self.loginToCloudStorageView.superview) {
[self.loginToCloudStorageView removeFromSuperview];
}
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;
if (!self.loginToCloudStorageView.superview)
[self.view addSubview:self.loginToCloudStorageView];
}
......
/*****************************************************************************
* VLCCloudServiceCell.h
* VLC for iOS
*****************************************************************************
* Copyright (c) 2014 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Carola Nitz <nitz.carola # googlemail.com>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
#import <UIKit/UIKit.h>
@interface VLCCloudServiceCell : UITableViewCell
@property(nonatomic) IBOutlet UIImageView *icon;
@property(nonatomic) IBOutlet UILabel *cloudTitle;
@property(nonatomic) IBOutlet UILabel *cloudInformation;
@end
/*****************************************************************************
* VLCCloudServiceCell.m
* VLC for iOS
*****************************************************************************
* Copyright (c) 2014 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Carola Nitz <nitz.carola # googlemail.com>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
#import "VLCCloudServiceCell.h"
@implementation VLCCloudServiceCell
- (void)awakeFromNib {
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6221" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6213"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="66" id="jmV-7P-Ob0" customClass="VLCCloudServiceCell">
<rect key="frame" x="0.0" y="0.0" width="320" height="66"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="jmV-7P-Ob0" id="P7G-Z3-wQa">
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O6V-Qc-Q8x" userLabel="ServiceName">
<rect key="frame" x="61" y="8" width="251" height="27"/>
<constraints>
<constraint firstAttribute="height" constant="27" id="jmY-dU-gUi"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Login" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NEp-19-omb" userLabel="ServiceInformation">
<rect key="frame" x="61" y="40" width="251" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="749" verticalHuggingPriority="749" translatesAutoresizingMaskIntoConstraints="NO" id="k9V-qn-xQh">
<rect key="frame" x="13" y="13" width="40" height="39.5"/>
<constraints>
<constraint firstAttribute="width" secondItem="k9V-qn-xQh" secondAttribute="height" multiplier="1:1" id="G4X-8T-SgW"/>
<constraint firstAttribute="width" constant="40" id="b0z-Gv-5yY"/>
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="G4X-8T-SgW"/>
</mask>
</variation>
</imageView>
</subviews>
<constraints>
<constraint firstAttribute="bottomMargin" secondItem="k9V-qn-xQh" secondAttribute="bottom" constant="5" id="9mT-Ig-oz7"/>
<constraint firstAttribute="trailingMargin" secondItem="O6V-Qc-Q8x" secondAttribute="trailing" id="DGs-Ef-HwX"/>
<constraint firstItem="O6V-Qc-Q8x" firstAttribute="top" secondItem="P7G-Z3-wQa" secondAttribute="topMargin" id="P7b-lX-3qH"/>
<constraint firstItem="k9V-qn-xQh" firstAttribute="leading" secondItem="P7G-Z3-wQa" secondAttribute="leadingMargin" constant="5" id="bjd-BQ-kB6"/>
<constraint firstItem="NEp-19-omb" firstAttribute="leading" secondItem="k9V-qn-xQh" secondAttribute="trailing" constant="8" id="bks-dW-hBU"/>
<constraint firstItem="k9V-qn-xQh" firstAttribute="top" secondItem="P7G-Z3-wQa" secondAttribute="topMargin" constant="5" id="eeS-aO-JcR"/>
<constraint firstItem="NEp-19-omb" firstAttribute="leading" secondItem="O6V-Qc-Q8x" secondAttribute="leading" id="fL2-8r-L4U"/>
<constraint firstAttribute="trailingMargin" secondItem="NEp-19-omb" secondAttribute="trailing" id="p2Z-h2-q2X"/>
<constraint firstAttribute="bottomMargin" secondItem="NEp-19-omb" secondAttribute="bottom" id="xAM-tl-LLT"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="cloudInformation" destination="NEp-19-omb" id="pWE-Kp-d7k"/>
<outlet property="cloudTitle" destination="O6V-Qc-Q8x" id="6Oe-Xb-nFb"/>
<outlet property="icon" destination="k9V-qn-xQh" id="5Bh-XZ-Kkl"/>
</connections>
<point key="canvasLocation" x="358" y="253"/>
</tableViewCell>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
</objects>
</document>
//
// VLCCloudServiceCellTableViewCell.h
// VLC for iOS
//
// Created by Carola Nitz on 23/12/14.
// Copyright (c) 2014 VideoLAN. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface VLCCloudServiceCellTableViewCell : UITableViewCell
@end
//
// VLCCloudServiceCellTableViewCell.m
// VLC for iOS
//
// Created by Carola Nitz on 23/12/14.
// Copyright (c) 2014 VideoLAN. All rights reserved.
//
#import "VLCCloudServiceCellTableViewCell.h"
@implementation VLCCloudServiceCellTableViewCell
- (void)awakeFromNib {
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
/*****************************************************************************
* VLCCloudServicesTableViewController.h
* VLC for iOS
*****************************************************************************
* Copyright (c) 2014 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Carola Nitz <nitz.carola # googlemail.com>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
#import <UIKit/UIKit.h>
@interface VLCCloudServicesTableViewController : UITableViewController
@end
/*****************************************************************************
* VLCCloudServicesTableViewController.m
* VLC for iOS
*****************************************************************************
* Copyright (c) 2014 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Carola Nitz <nitz.carola # googlemail.com>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
#import "UIBarButtonItem+Theme.h"
#import "VLCCloudServicesTableViewController.h"
#import "VLCAppDelegate.h"
#import "VLCDropboxTableViewController.h"
#import "VLCGoogleDriveTableViewController.h"
#import "VLCBoxTableViewController.h"
#import "VLCOneDriveTableViewController.h"
#import "VLCDocumentPickerController.h"
#import "VLCCloudServiceCell.h"
#import <DropboxSDK/DropboxSDK.h>
#import <BoxSDK/BoxSDK.h>
#import "VLCGoogleDriveController.h"
@interface VLCCloudServicesTableViewController ()
@property (nonatomic) VLCDropboxTableViewController *dropboxTableViewController;
@property (nonatomic) VLCGoogleDriveTableViewController *googleDriveTableViewController;
@property (nonatomic) VLCBoxTableViewController *boxTableViewController;
@property (nonatomic) VLCOneDriveTableViewController *oneDriveTableViewController;
@property (nonatomic) VLCDocumentPickerController *documentPickerController;
@end
@implementation VLCCloudServicesTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = NSLocalizedString(@"CLOUD_SERVICES", "");
[self.tableView registerNib:[UINib nibWithNibName:@"VLCCloudServiceCell" bundle:nil] forCellReuseIdentifier:@"CloudServiceCell"];
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack)];
self.tableView.separatorColor = [UIColor VLCDarkBackgroundColor];
self.dropboxTableViewController = [[VLCDropboxTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil];
self.googleDriveTableViewController = [[VLCGoogleDriveTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil];
self.boxTableViewController = [[VLCBoxTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil];
self.oneDriveTableViewController = [[VLCOneDriveTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil];
self.documentPickerController = [VLCDocumentPickerController new];
}
- (void)viewWillAppear:(BOOL)animated
{
[self.tableView reloadData];
[super viewWillAppear:animated];
}
- (void)goBack
{
VLCAppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
[[appDelegate revealController] toggleSidebar:![appDelegate revealController].sidebarShowing duration:kGHRevealSidebarDefaultAnimationDuration];
}
#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [UIDocumentPickerViewController class] ? 5 : 4;// on iOS 8+ add document picker option
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.backgroundColor = (indexPath.row % 2 == 0)? [UIColor blackColor]: [UIColor VLCDarkBackgroundColor];
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
[cell setPreservesSuperviewLayoutMargins:NO];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
VLCCloudServiceCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CloudServiceCell" forIndexPath:indexPath];
switch (indexPath.row) {
case 0: {
//Dropbox
BOOL isAuthorized = [[DBSession sharedSession] isLinked];
cell.icon.image = [UIImage imageNamed:@"Dropbox"];
cell.cloudTitle.text = @"Dropbox";
cell.cloudInformation.text = isAuthorized ? NSLocalizedString(@"LOGGED_IN", "") : NSLocalizedString(@"LOGIN", "");
break;
}
case 1: {
//GoogleDrive
BOOL isAuthorized = [[VLCGoogleDriveController sharedInstance] isAuthorized];
cell.icon.image = [UIImage imageNamed:@"Drive"];
cell.cloudTitle.text = @"Google Drive";
cell.cloudInformation.text = isAuthorized ? NSLocalizedString(@"LOGGED_IN", "") : NSLocalizedString(@"LOGIN", "");
break;
}
case 2: {
//Box
BOOL isAuthorized = [[BoxSDK sharedSDK].OAuth2Session isAuthorized];
cell.icon.image = [UIImage imageNamed:@"Box"];
cell.cloudTitle.text = @"Box";
cell.cloudInformation.text = isAuthorized ? NSLocalizedString(@"LOGGED_IN", "") : NSLocalizedString(@"LOGIN", "");
break;
}
case 3: {
//OneDrive
//TODO: figure out right way to check session state
BOOL isAuthorized = NO;//[[OneDriveSDK sharedSDK] isAuthorized];
cell.icon.image = [UIImage imageNamed:@"OneDrive"];
cell.cloudTitle.text = @"One Drive";
cell.cloudInformation.text = isAuthorized ? NSLocalizedString(@"LOGGED_IN", "") : NSLocalizedString(@"LOGIN", "");
break;
}
case 4:
//Cloud Drives
cell.icon.image = [UIImage imageNamed:@"CloudDrives"];
cell.cloudTitle.text = @"Cloud Drives";
cell.cloudInformation.text = @"";
break;
default:
break;
}
return cell;
}
#pragma mark - Table view delegate
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// don't let select CLOUD_DRIVES menu item since there is no view controller to reveal
if (indexPath.row == 4) {
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[self.documentPickerController showDocumentMenuViewController:[self.tableView cellForRowAtIndexPath:indexPath]];
} else {
[self.documentPickerController showDocumentMenuViewController:nil];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
return nil;
} else
return indexPath;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 66.0;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
switch (indexPath.row) {
case 0:
//dropBox
[self.navigationController pushViewController:self.dropboxTableViewController animated:YES];
break;
case 1:
//GoogleDrive
[self.navigationController pushViewController:self.googleDriveTableViewController animated:YES];
break;
case 2:
//Box
[self.navigationController pushViewController:self.boxTableViewController animated:YES];
break;
case 3:
//OneDrive
[self.navigationController pushViewController:self.oneDriveTableViewController animated:YES];
break;