Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC-iOS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
311
Issues
311
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
VLC-iOS
Commits
e25397e3
Commit
e25397e3
authored
Nov 08, 2013
by
Carola Nitz
Committed by
Felix Paul Kühne
Nov 09, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unified dropbox and gdrivecells, proper uiupdate for login/logout in gdrive
Signed-off-by:
Felix Paul Kühne
<
fkuehne@videolan.org
>
parent
3d4eb5cf
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
220 additions
and
261 deletions
+220
-261
AspenProject/VLCCloudStorageTableViewCell.h
AspenProject/VLCCloudStorageTableViewCell.h
+8
-5
AspenProject/VLCCloudStorageTableViewCell.m
AspenProject/VLCCloudStorageTableViewCell.m
+108
-0
AspenProject/VLCDropboxTableViewCell.m
AspenProject/VLCDropboxTableViewCell.m
+0
-74
AspenProject/VLCDropboxTableViewController.m
AspenProject/VLCDropboxTableViewController.m
+6
-6
AspenProject/VLCGoogleDriveController.h
AspenProject/VLCGoogleDriveController.h
+2
-0
AspenProject/VLCGoogleDriveController.m
AspenProject/VLCGoogleDriveController.m
+36
-26
AspenProject/VLCGoogleDriveTableViewController.m
AspenProject/VLCGoogleDriveTableViewController.m
+37
-13
AspenProject/VLCSettingsController.m
AspenProject/VLCSettingsController.m
+1
-1
Resources/VLCCloudStorageTableViewCell~ipad.xib
Resources/VLCCloudStorageTableViewCell~ipad.xib
+5
-5
Resources/VLCCloudStorageTableViewCell~iphone.xib
Resources/VLCCloudStorageTableViewCell~iphone.xib
+3
-3
Resources/VLCGoogleDriveTableViewCell~ipad.xib
Resources/VLCGoogleDriveTableViewCell~ipad.xib
+0
-53
Resources/VLCGoogleDriveTableViewCell~iphone.xib
Resources/VLCGoogleDriveTableViewCell~iphone.xib
+0
-53
VLC for iOS.xcodeproj/project.pbxproj
VLC for iOS.xcodeproj/project.pbxproj
+14
-22
No files found.
AspenProject/VLC
Dropbox
TableViewCell.h
→
AspenProject/VLC
CloudStorage
TableViewCell.h
View file @
e25397e3
//
// VLC
Dropbox
TableViewCell.h
// VLC
CloudStorage
TableViewCell.h
// VLC for iOS
//
// Created by Felix Paul Kühne on 24.05.13.
// Modified by Carola Nitz on 07.11.13
// Copyright (c) 2013 VideoLAN. All rights reserved.
//
// Refer to the COPYING file of the official project for license.
//
#import <DropboxSDK/DropboxSDK.h>
#import "GTLDrive.h"
@interface
VLC
Dropbox
TableViewCell
:
UITableViewCell
@interface
VLC
CloudStorage
TableViewCell
:
UITableViewCell
@property
(
nonatomic
,
weak
)
id
delegate
;
...
...
@@ -21,16 +23,17 @@
@property
(
nonatomic
,
strong
)
IBOutlet
UIButton
*
downloadButton
;
@property
(
nonatomic
,
retain
)
DBMetadata
*
fileMetadata
;
@property
(
nonatomic
,
retain
)
GTLDriveFile
*
driveFile
;
+
(
VLC
Dropbox
TableViewCell
*
)
cellWithReuseIdentifier
:(
NSString
*
)
ident
;
+
(
VLC
CloudStorage
TableViewCell
*
)
cellWithReuseIdentifier
:(
NSString
*
)
ident
;
+
(
CGFloat
)
heightOfCell
;
-
(
IBAction
)
triggerDownload
:(
id
)
sender
;
@end
@protocol
VLC
Dropbox
TableViewCell
<
NSObject
>
@protocol
VLC
CloudStorage
TableViewCell
<
NSObject
>
-
(
void
)
triggerDownloadForCell
:(
VLC
Dropbox
TableViewCell
*
)
cell
;
-
(
void
)
triggerDownloadForCell
:(
VLC
CloudStorage
TableViewCell
*
)
cell
;
@end
AspenProject/VLCCloudStorageTableViewCell.m
0 → 100644
View file @
e25397e3
//
// VLCCloudStorageTableViewCell.m
// VLC for iOS
//
// Created by Felix Paul Kühne on 24.05.13.
// Modified by Carola Nitz on 07.11.13
// Copyright (c) 2013 VideoLAN. All rights reserved.
//
// Refer to the COPYING file of the official project for license.
//
#import "VLCCloudStorageTableViewCell.h"
@implementation
VLCCloudStorageTableViewCell
+
(
VLCCloudStorageTableViewCell
*
)
cellWithReuseIdentifier
:(
NSString
*
)
ident
{
NSArray
*
nibContentArray
=
[[
NSBundle
mainBundle
]
loadNibNamed
:
@"VLCCloudStorageTableViewCell"
owner
:
nil
options
:
nil
];
NSAssert
([
nibContentArray
count
]
==
1
,
@"meh"
);
NSAssert
([[
nibContentArray
lastObject
]
isKindOfClass
:[
VLCCloudStorageTableViewCell
class
]],
@"meh meh"
);
VLCCloudStorageTableViewCell
*
cell
=
(
VLCCloudStorageTableViewCell
*
)[
nibContentArray
lastObject
];
return
cell
;
}
-
(
void
)
setFileMetadata
:(
DBMetadata
*
)
fileMetadata
{
if
(
fileMetadata
!=
_fileMetadata
)
_fileMetadata
=
fileMetadata
;
[
self
_updatedDisplayedInformation
];
}
-
(
void
)
setDriveFile
:(
GTLDriveFile
*
)
driveFile
{
if
(
driveFile
!=
_driveFile
)
_driveFile
=
driveFile
;
[
self
_updatedDisplayedInformation
];
}
-
(
void
)
_updatedDisplayedInformation
{
if
(
_fileMetadata
!=
nil
)
{
if
(
self
.
fileMetadata
.
isDirectory
)
{
self
.
folderTitleLabel
.
text
=
self
.
fileMetadata
.
filename
;
self
.
titleLabel
.
text
=
@""
;
self
.
subtitleLabel
.
text
=
@""
;
}
else
{
self
.
titleLabel
.
text
=
self
.
fileMetadata
.
filename
;
self
.
subtitleLabel
.
text
=
(
self
.
fileMetadata
.
totalBytes
>
0
)
?
self
.
fileMetadata
.
humanReadableSize
:
@""
;
self
.
folderTitleLabel
.
text
=
@""
;
}
NSString
*
iconName
=
self
.
fileMetadata
.
icon
;
if
([
iconName
isEqualToString
:
@"folder_user"
]
||
[
iconName
isEqualToString
:
@"folder"
]
||
[
iconName
isEqualToString
:
@"folder_public"
]
||
[
iconName
isEqualToString
:
@"folder_photos"
]
||
[
iconName
isEqualToString
:
@"package"
])
{
self
.
thumbnailView
.
image
=
[
UIImage
imageNamed
:
@"folder"
];
self
.
downloadButton
.
hidden
=
YES
;
}
else
if
([
iconName
isEqualToString
:
@"page_white"
]
||
[
iconName
isEqualToString
:
@"page_white_text"
])
self
.
thumbnailView
.
image
=
[
UIImage
imageNamed
:
@"blank"
];
else
if
([
iconName
isEqualToString
:
@"page_white_film"
])
self
.
thumbnailView
.
image
=
[
UIImage
imageNamed
:
@"movie"
];
else
APLog
(
@"missing icon for type '%@'"
,
self
.
fileMetadata
.
icon
);
}
else
if
(
_driveFile
!=
nil
){
BOOL
isDirectory
=
[
self
.
driveFile
.
mimeType
isEqualToString
:
@"application/vnd.google-apps.folder"
];
if
(
isDirectory
)
{
self
.
folderTitleLabel
.
text
=
self
.
driveFile
.
title
;
self
.
titleLabel
.
text
=
@""
;
self
.
subtitleLabel
.
text
=
@""
;
}
else
{
self
.
titleLabel
.
text
=
self
.
driveFile
.
title
;
self
.
subtitleLabel
.
text
=
(
self
.
driveFile
.
fileSize
>
0
)
?
[
NSByteCountFormatter
stringFromByteCount
:[
self
.
driveFile
.
fileSize
longLongValue
]
countStyle
:
NSByteCountFormatterCountStyleFile
]:
@""
;
self
.
folderTitleLabel
.
text
=
@""
;
}
NSString
*
iconName
=
self
.
driveFile
.
iconLink
;
if
([
iconName
isEqualToString
:
@"https://ssl.gstatic.com/docs/doclist/images/icon_11_shared_collection_list.png"
]
||
[
iconName
isEqualToString
:
@"https://ssl.gstatic.com/docs/doclist/images/icon_11_collection_list.png"
])
{
self
.
thumbnailView
.
image
=
[
UIImage
imageNamed
:
@"folder"
];
}
else
if
([
iconName
isEqualToString
:
@"https://ssl.gstatic.com/docs/doclist/images/icon_10_audio_list.png"
])
{
self
.
thumbnailView
.
image
=
[
UIImage
imageNamed
:
@"blank"
];
}
else
if
([
iconName
isEqualToString
:
@"https://ssl.gstatic.com/docs/doclist/images/icon_11_video_list.png"
])
{
self
.
thumbnailView
.
image
=
[
UIImage
imageNamed
:
@"movie"
];
}
else
{
self
.
thumbnailView
.
image
=
[
UIImage
imageNamed
:
@"blank"
];
APLog
(
@"missing icon for type '%@'"
,
self
.
driveFile
.
iconLink
);
}
}
self
.
downloadButton
.
hidden
=
NO
;
[
self
setNeedsDisplay
];
}
-
(
IBAction
)
triggerDownload
:(
id
)
sender
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
triggerDownloadForCell
:)])
[
self
.
delegate
triggerDownloadForCell
:
self
];
}
+
(
CGFloat
)
heightOfCell
{
if
([[
UIDevice
currentDevice
]
userInterfaceIdiom
]
==
UIUserInterfaceIdiomPad
)
return
80
.;
return
48
.;
}
@end
AspenProject/VLCDropboxTableViewCell.m
deleted
100644 → 0
View file @
3d4eb5cf
//
// VLCDropboxTableViewCell.m
// VLC for iOS
//
// Created by Felix Paul Kühne on 24.05.13.
// Copyright (c) 2013 VideoLAN. All rights reserved.
//
// Refer to the COPYING file of the official project for license.
//
#import "VLCDropboxTableViewCell.h"
@implementation
VLCDropboxTableViewCell
+
(
VLCDropboxTableViewCell
*
)
cellWithReuseIdentifier
:(
NSString
*
)
ident
{
NSArray
*
nibContentArray
=
[[
NSBundle
mainBundle
]
loadNibNamed
:
@"VLCDropboxTableViewCell"
owner
:
nil
options
:
nil
];
NSAssert
([
nibContentArray
count
]
==
1
,
@"meh"
);
NSAssert
([[
nibContentArray
lastObject
]
isKindOfClass
:[
VLCDropboxTableViewCell
class
]],
@"meh meh"
);
VLCDropboxTableViewCell
*
cell
=
(
VLCDropboxTableViewCell
*
)[
nibContentArray
lastObject
];
return
cell
;
}
-
(
void
)
setFileMetadata
:(
DBMetadata
*
)
fileMetadata
{
if
(
fileMetadata
!=
_fileMetadata
)
_fileMetadata
=
fileMetadata
;
[
self
_updatedDisplayedInformation
];
}
-
(
void
)
_updatedDisplayedInformation
{
if
(
self
.
fileMetadata
.
isDirectory
)
{
self
.
folderTitleLabel
.
text
=
self
.
fileMetadata
.
filename
;
self
.
titleLabel
.
text
=
@""
;
self
.
subtitleLabel
.
text
=
@""
;
}
else
{
self
.
titleLabel
.
text
=
self
.
fileMetadata
.
filename
;
self
.
subtitleLabel
.
text
=
(
self
.
fileMetadata
.
totalBytes
>
0
)
?
self
.
fileMetadata
.
humanReadableSize
:
@""
;
self
.
folderTitleLabel
.
text
=
@""
;
}
self
.
downloadButton
.
hidden
=
NO
;
NSString
*
iconName
=
self
.
fileMetadata
.
icon
;
if
([
iconName
isEqualToString
:
@"folder_user"
]
||
[
iconName
isEqualToString
:
@"folder"
]
||
[
iconName
isEqualToString
:
@"folder_public"
]
||
[
iconName
isEqualToString
:
@"folder_photos"
]
||
[
iconName
isEqualToString
:
@"package"
])
{
self
.
thumbnailView
.
image
=
[
UIImage
imageNamed
:
@"folder"
];
self
.
downloadButton
.
hidden
=
YES
;
}
else
if
([
iconName
isEqualToString
:
@"page_white"
]
||
[
iconName
isEqualToString
:
@"page_white_text"
])
self
.
thumbnailView
.
image
=
[
UIImage
imageNamed
:
@"blank"
];
else
if
([
iconName
isEqualToString
:
@"page_white_film"
])
self
.
thumbnailView
.
image
=
[
UIImage
imageNamed
:
@"movie"
];
else
APLog
(
@"missing icon for type '%@'"
,
self
.
fileMetadata
.
icon
);
[
self
setNeedsDisplay
];
}
-
(
IBAction
)
triggerDownload
:(
id
)
sender
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
triggerDownloadForCell
:)])
[
self
.
delegate
triggerDownloadForCell
:
self
];
}
+
(
CGFloat
)
heightOfCell
{
if
([[
UIDevice
currentDevice
]
userInterfaceIdiom
]
==
UIUserInterfaceIdiomPad
)
return
80
.;
return
48
.;
}
@end
AspenProject/VLCDropboxTableViewController.m
View file @
e25397e3
...
...
@@ -9,7 +9,7 @@
//
#import "VLCDropboxTableViewController.h"
#import "VLC
Dropbox
TableViewCell.h"
#import "VLC
CloudStorage
TableViewCell.h"
#import "VLCDropboxController.h"
#import "VLCAppDelegate.h"
#import "VLCPlaylistViewController.h"
...
...
@@ -17,7 +17,7 @@
#import "UIBarButtonItem+Theme.h"
#import <DropboxSDK/DropboxSDK.h>
@interface
VLCDropboxTableViewController
()
<
VLC
Dropbox
TableViewCell
>
@interface
VLCDropboxTableViewController
()
<
VLC
CloudStorage
TableViewCell
>
{
VLCDropboxController
*
_dropboxController
;
NSString
*
_currentPath
;
...
...
@@ -58,7 +58,7 @@
_backToMenuButton
=
[
UIBarButtonItem
themedRevealMenuButtonWithTarget
:
self
andSelector
:
@selector
(
goBack
:
)];
self
.
navigationItem
.
leftBarButtonItem
=
_backToMenuButton
;
self
.
tableView
.
rowHeight
=
[
VLC
Dropbox
TableViewCell
heightOfCell
];
self
.
tableView
.
rowHeight
=
[
VLC
CloudStorage
TableViewCell
heightOfCell
];
self
.
tableView
.
separatorColor
=
[
UIColor
colorWithWhite
:.
122
alpha
:
1
.];
self
.
view
.
backgroundColor
=
[
UIColor
colorWithWhite
:.
122
alpha
:
1
.];
...
...
@@ -157,9 +157,9 @@
{
static
NSString
*
CellIdentifier
=
@"DropboxCell"
;
VLC
DropboxTableViewCell
*
cell
=
(
VLCDropbox
TableViewCell
*
)[
tableView
dequeueReusableCellWithIdentifier
:
CellIdentifier
];
VLC
CloudStorageTableViewCell
*
cell
=
(
VLCCloudStorage
TableViewCell
*
)[
tableView
dequeueReusableCellWithIdentifier
:
CellIdentifier
];
if
(
cell
==
nil
)
cell
=
[
VLC
Dropbox
TableViewCell
cellWithReuseIdentifier
:
CellIdentifier
];
cell
=
[
VLC
CloudStorage
TableViewCell
cellWithReuseIdentifier
:
CellIdentifier
];
cell
.
fileMetadata
=
_dropboxController
.
currentListFiles
[
indexPath
.
row
];
cell
.
delegate
=
self
;
...
...
@@ -263,7 +263,7 @@
#pragma mark - VLCLocalNetworkListCell delegation
-
(
void
)
triggerDownloadForCell
:(
VLC
Dropbox
TableViewCell
*
)
cell
-
(
void
)
triggerDownloadForCell
:(
VLC
CloudStorage
TableViewCell
*
)
cell
{
_selectedFile
=
_dropboxController
.
currentListFiles
[[
self
.
tableView
indexPathForCell
:
cell
].
row
];
...
...
AspenProject/VLCGoogleDriveController.h
View file @
e25397e3
...
...
@@ -30,9 +30,11 @@
@property
(
nonatomic
,
readonly
)
NSInteger
numberOfFilesWaitingToBeDownloaded
;
@property
(
nonatomic
,
retain
)
GTLServiceDrive
*
driveService
;
+
(
VLCGoogleDriveController
*
)
sharedInstance
;
-
(
void
)
startSession
;
-
(
void
)
logout
;
-
(
void
)
requestDirectoryListingAtPath
:(
NSString
*
)
path
;
-
(
void
)
downloadFileToDocumentFolder
:(
GTLDriveFile
*
)
file
;
-
(
void
)
streamFile
:(
GTLDriveFile
*
)
file
;
@end
AspenProject/VLCGoogleDriveController.m
View file @
e25397e3
...
...
@@ -33,6 +33,18 @@
#pragma mark - session handling
+
(
VLCGoogleDriveController
*
)
sharedInstance
{
static
VLCGoogleDriveController
*
sharedInstance
=
nil
;
static
dispatch_once_t
pred
;
dispatch_once
(
&
pred
,
^
{
sharedInstance
=
[[
self
alloc
]
init
];
});
return
sharedInstance
;
}
-
(
void
)
startSession
{
self
.
driveService
=
[[
GTLServiceDrive
alloc
]
init
];
...
...
@@ -43,6 +55,9 @@
{
[
GTMOAuth2ViewControllerTouch
removeAuthFromKeychainForName
:
kKeychainItemName
];
self
.
driveService
.
authorizer
=
nil
;
_currentFileList
=
0
;
if
([
self
.
delegate
respondsToSelector
:
@selector
(
mediaListUpdated
)])
[
self
.
delegate
mediaListUpdated
];
}
-
(
BOOL
)
isAuthorized
...
...
@@ -92,22 +107,33 @@
GTLQueryDrive
*
query
=
[
GTLQueryDrive
queryForFilesList
];
query
.
maxResults
=
150
;
query
.
fields
=
@"items(originalFilename,title,mimeType,fileExtension,fileSize,iconLink)"
;
//+ (id)queryForChildrenListWithFolderId:(NSString *)folderId;
query
.
fields
=
@"items(originalFilename,title,mimeType,fileExtension,fileSize,iconLink,downloadUrl)"
;
_fileListTicket
=
[
service
executeQuery
:
query
completionHandler:
^
(
GTLServiceTicket
*
ticket
,
GTLDriveFileList
*
fileList
,
NSError
*
error
)
{
// Callback
_fileList
=
fileList
;
_fileListFetchError
=
error
;
_fileListTicket
=
nil
;
[
self
listOfGoodFilesAndFolders
];
if
(
error
==
nil
)
{
_fileList
=
fileList
;
_fileListFetchError
=
error
;
_fileListTicket
=
nil
;
[
self
listOfGoodFilesAndFolders
];
}
else
{
//TODO: localize
[
self
showAlert
:
@"Fetching Files Error"
message
:
error
.
localizedDescription
];
}
}];
}
-
(
void
)
streamFile
:(
GTLDriveFile
*
)
file
{
BOOL
isDirectory
=
[
file
.
mimeType
isEqualToString
:
@"application/vnd.google-apps.folder"
];
if
(
!
isDirectory
)
{
// [[self restClient] loadStreamableURLForFile:file.path];
}
}
-
(
void
)
_triggerNextDownload
{
if
(
_listOfGoogleDriveFilesToDownload
.
count
>
0
&&
!
_downloadInProgress
)
{
...
...
@@ -174,10 +200,7 @@
NSURLRequest
*
request
=
[
NSURLRequest
requestWithURL
:
url
];
GTMHTTPFetcher
*
fetcher
=
[
GTMHTTPFetcher
fetcherWithRequest
:
request
];
// Requests of user data from Google services must be authorized.
fetcher
.
authorizer
=
self
.
driveService
.
authorizer
;
// The fetcher can save data directly to a file.
fetcher
.
downloadPath
=
destinationPath
;
// Fetcher logging can include comments.
...
...
@@ -193,25 +216,12 @@
};
[
fetcher
beginFetchWithCompletionHandler
:
^
(
NSData
*
data
,
NSError
*
error
)
{
// Callback
//TODO:localize Strings
if
(
error
==
nil
)
{
UIAlertView
*
alert
;
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"Downloaded"
message:
@"your file has been sucessfully downloaded"
delegate:
nil
cancelButtonTitle:
@"OK"
otherButtonTitles:
nil
];
[
alert
show
];
[
self
showAlert
:
@"Downloaded"
message
:
@"Your file has been sucessfully downloaded"
];
[
self
downloadSucessfull
];
}
else
{
UIAlertView
*
alert
;
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
@"Error"
message:
@"AN Error occured while downloading"
delegate:
nil
cancelButtonTitle:
@"OK"
otherButtonTitles:
nil
];
[
alert
show
];
[
self
showAlert
:
@"Error"
message
:
@"An Error occured while downloading"
];
[
self
downloadFailedWithError
:
error
];
}
}];
...
...
AspenProject/VLCGoogleDriveTableViewController.m
View file @
e25397e3
...
...
@@ -9,7 +9,7 @@
//
#import "VLCGoogleDriveTableViewController.h"
#import "VLC
GoogleDriv
eTableViewCell.h"
#import "VLC
CloudStorag
eTableViewCell.h"
#import "VLCGoogleDriveController.h"
#import "VLCAppDelegate.h"
#import "VLCPlaylistViewController.h"
...
...
@@ -17,7 +17,7 @@
#import "VLCGoogleDriveConstants.h"
#import "GTMOAuth2ViewControllerTouch.h"
@interface
VLCGoogleDriveTableViewController
()
@interface
VLCGoogleDriveTableViewController
()
<
VLCCloudStorageTableViewCell
>
{
GTLDriveFile
*
_selectedFile
;
GTMOAuth2ViewControllerTouch
*
_authController
;
...
...
@@ -34,6 +34,7 @@
UIActivityIndicatorView
*
_activityIndicator
;
BOOL
_authorizationInProgress
;
VLCGoogleDriveController
*
_googleDriveController
;
}
...
...
@@ -47,9 +48,12 @@
self
.
modalPresentationStyle
=
UIModalPresentationFormSheet
;
_googleDriveController
=
[
[
VLCGoogleDriveController
alloc
]
init
];
_googleDriveController
=
[
VLCGoogleDriveController
sharedInstance
];
_googleDriveController
.
delegate
=
self
;
[
_googleDriveController
startSession
];
_authorizationInProgress
=
NO
;
self
.
navigationItem
.
titleView
=
[[
UIImageView
alloc
]
initWithImage
:[
UIImage
imageNamed
:
@"DriveWhite"
]];
self
.
navigationItem
.
titleView
.
contentMode
=
UIViewContentModeScaleAspectFit
;
...
...
@@ -57,7 +61,7 @@
_backToMenuButton
=
[
UIBarButtonItem
themedRevealMenuButtonWithTarget
:
self
andSelector
:
@selector
(
goBack
:
)];
self
.
navigationItem
.
leftBarButtonItem
=
_backToMenuButton
;
self
.
tableView
.
rowHeight
=
[
VLC
GoogleDriv
eTableViewCell
heightOfCell
];
self
.
tableView
.
rowHeight
=
[
VLC
CloudStorag
eTableViewCell
heightOfCell
];
self
.
tableView
.
separatorColor
=
[
UIColor
colorWithWhite
:.
122
alpha
:
1
.];
self
.
view
.
backgroundColor
=
[
UIColor
colorWithWhite
:.
122
alpha
:
1
.];
...
...
@@ -95,7 +99,9 @@
-
(
void
)
viewController
:(
GTMOAuth2ViewControllerTouch
*
)
viewController
finishedWithAuth
:(
GTMOAuth2Authentication
*
)
authResult
error
:(
NSError
*
)
error
{
_authorizationInProgress
=
NO
;
if
(
error
!=
nil
)
{
//TODO:Localize
[
self
showAlert
:
@"Authentication Error"
message
:
error
.
localizedDescription
];
_googleDriveController
.
driveService
.
authorizer
=
nil
;
}
else
{
...
...
@@ -188,11 +194,12 @@
{
static
NSString
*
CellIdentifier
=
@"GoogleDriveCell"
;
VLC
GoogleDriveTableViewCell
*
cell
=
(
VLCGoogleDriv
eTableViewCell
*
)[
tableView
dequeueReusableCellWithIdentifier
:
CellIdentifier
];
VLC
CloudStorageTableViewCell
*
cell
=
(
VLCCloudStorag
eTableViewCell
*
)[
tableView
dequeueReusableCellWithIdentifier
:
CellIdentifier
];
if
(
cell
==
nil
)
cell
=
[
VLC
GoogleDriv
eTableViewCell
cellWithReuseIdentifier
:
CellIdentifier
];
cell
=
[
VLC
CloudStorag
eTableViewCell
cellWithReuseIdentifier
:
CellIdentifier
];
cell
.
driveFile
=
_googleDriveController
.
currentListFiles
[
indexPath
.
row
];
cell
.
delegate
=
self
;
return
cell
;
}
...
...
@@ -208,16 +215,13 @@
{
_selectedFile
=
_googleDriveController
.
currentListFiles
[
indexPath
.
row
];
if
(
!
[
_selectedFile
.
mimeType
isEqualToString
:
@"application/vnd.google-apps.folder"
])
{
/* selected item is a proper file, ask the user if s/he wants to download it */
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"GOOGLE_DRIVE_DOWNLOAD"
,
@""
)
message
:[
NSString
stringWithFormat
:
NSLocalizedString
(
@"GOOGLE_DRIVE_DL_LONG"
,
@""
),
_selectedFile
.
title
,
[[
UIDevice
currentDevice
]
model
]]
delegate
:
self
cancelButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
@""
)
otherButtonTitles
:
NSLocalizedString
(
@"BUTTON_DOWNLOAD"
,
@""
),
nil
];
[
alert
show
];
[
_googleDriveController
streamFile
:
_selectedFile
];
}
else
{
/* dive into subdirectory */
_currentPath
=
[
_currentPath
stringByAppendingFormat
:
@"/%@"
,
_selectedFile
.
title
];
[
self
_requestInformationForCurrentPath
];
_selectedFile
=
nil
;
}
_selectedFile
=
nil
;
[
self
.
tableView
deselectRowAtIndexPath
:
indexPath
animated
:
NO
];
}
...
...
@@ -229,7 +233,20 @@
_selectedFile
=
nil
;
}
#pragma mark - dropbox controller delegate
#pragma mark - table view cell delegation
#pragma mark - VLCLocalNetworkListCell delegation
-
(
void
)
triggerDownloadForCell
:(
VLCCloudStorageTableViewCell
*
)
cell
{
_selectedFile
=
_googleDriveController
.
currentListFiles
[[
self
.
tableView
indexPathForCell
:
cell
].
row
];
/* selected item is a proper file, ask the user if s/he wants to download it */
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"GOOGLEDRIVE_DOWNLOAD"
,
@""
)
message
:[
NSString
stringWithFormat
:
NSLocalizedString
(
@"GOOGLEDRIVE_DL_LONG"
,
@""
),
_selectedFile
.
title
,
[[
UIDevice
currentDevice
]
model
]]
delegate
:
self
cancelButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
@""
)
otherButtonTitles
:
NSLocalizedString
(
@"BUTTON_DOWNLOAD"
,
@""
),
nil
];
[
alert
show
];
}
#pragma mark - google drive controller delegate
-
(
void
)
mediaListUpdated
{
...
...
@@ -265,12 +282,18 @@
-
(
void
)
updateViewAfterSessionChange
{
if
(
_authorizationInProgress
)
{
if
(
self
.
loginToGoogleDriveView
.
superview
)
[
self
.
loginToGoogleDriveView
removeFromSuperview
];
return
;
}
if
(
!
[
_googleDriveController
isAuthorized
])
{
[
self
_showLoginPanel
];
return
;
}
else
if
(
self
.
loginToGoogleDriveView
.
superview
)
[
self
.
loginToGoogleDriveView
removeFromSuperview
];
_currentPath
=
@"/"
;
_currentPath
=
@"/"
;
[
self
_requestInformationForCurrentPath
];
}
...
...
@@ -285,6 +308,7 @@
-
(
IBAction
)
loginToGoogleDriveAction
:(
id
)
sender
{
if
(
!
[
_googleDriveController
isAuthorized
])
{
_authorizationInProgress
=
YES
;
[
self
.
navigationController
pushViewController
:[
self
createAuthController
]
animated
:
YES
];
}
else
{
[
_googleDriveController
logout
];
...
...
AspenProject/VLCSettingsController.m
View file @
e25397e3
...
...
@@ -58,7 +58,7 @@
if
([
specifier
.
key
isEqualToString
:
@"UnlinkDropbox"
])
{
[[
DBSession
sharedSession
]
unlinkAll
];
}
else
if
([
specifier
.
key
isEqualToString
:
@"UnlinkGoogleDrive"
])
{
[
GTMOAuth2ViewControllerTouch
removeAuthFromKeychainForName
:
kKeychainItemName
];
[
[
VLCGoogleDriveController
sharedInstance
]
logout
];
}
}
...
...
Resources/VLC
Dropbox
TableViewCell~ipad.xib
→
Resources/VLC
CloudStorage
TableViewCell~ipad.xib
View file @
e25397e3
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"4514"
systemVersion=
"1
2F45
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"4514"
systemVersion=
"1
3A603
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
>
<dependencies>
<deployment
version=
"1296"
defaultVersion=
"1552"
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"374
6
"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"374
7
"
/>
</dependencies>
<objects>
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
/>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"-2"
customClass=
"UIResponder"
/>
<tableViewCell
contentMode=
"scaleToFill"
selectionStyle=
"blue"
indentationWidth=
"10"
reuseIdentifier=
"
DropboxCell"
rowHeight=
"76"
id=
"3"
customClass=
"VLCDropbox
TableViewCell"
>
<tableViewCell
contentMode=
"scaleToFill"
selectionStyle=
"blue"
indentationWidth=
"10"
reuseIdentifier=
"
CloudStorageCell"
rowHeight=
"76"
id=
"3"
userLabel=
"Cloud Storage Table View Cell - CloudStorageCell"
customClass=
"VLCCloudStorage
TableViewCell"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"320"
height=
"80"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<tableViewCellContentView
key=
"contentView"
opaque=
"NO"
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"center"
tableViewCell=
"3"
id=
"StH-9P-AYV"
>
...
...
@@ -51,14 +51,14 @@
<color
key=
"titleColor"
white=
"1"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
</state>
<connections>
<action
selector=
"triggerDownload:"
destination=
"3"
eventType=
"touchUpInside"
id=
"
hPm-Bm-zCI
"
/>
<action
selector=
"triggerDownload:"
destination=
"3"
eventType=
"touchUpInside"
id=
"
7Fr-3V-SzO
"
/>
</connections>
</button>
</subviews>
</tableViewCellContentView>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"1"
colorSpace=
"calibratedWhite"
/>
<connections>
<outlet
property=
"downloadButton"
destination=
"VuV-6r-r3f"
id=
"
obo-SG-FDa
"
/>
<outlet
property=
"downloadButton"
destination=
"VuV-6r-r3f"
id=
"
K9G-fy-OwZ
"
/>
<outlet
property=
"folderTitleLabel"
destination=
"23"
id=
"24"
/>
<outlet
property=
"subtitleLabel"
destination=
"7"
id=
"8"
/>
<outlet
property=
"thumbnailView"
destination=
"4"
id=
"9"
/>
...
...
Resources/VLC
Dropbox
TableViewCell~iphone.xib
→
Resources/VLC
CloudStorage
TableViewCell~iphone.xib
View file @
e25397e3
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"4514"
systemVersion=
"1
2F45
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"4514"
systemVersion=
"1
3A603
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
>
<dependencies>
<deployment
version=
"1296"
defaultVersion=
"1552"
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"374
6
"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"374
7
"
/>
</dependencies>
<objects>
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
/>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"-2"
customClass=
"UIResponder"
/>
<tableViewCell
contentMode=
"scaleToFill"
selectionStyle=
"blue"
indentationWidth=
"10"
reuseIdentifier=
"
DropboxCell"
rowHeight=
"44"
id=
"3"
customClass=
"VLCDropbox
TableViewCell"
>
<tableViewCell
contentMode=
"scaleToFill"
selectionStyle=
"blue"
indentationWidth=
"10"
reuseIdentifier=
"
CloudStorageCell"
rowHeight=
"44"
id=
"3"
userLabel=
"Cloud Storage Table View Cell - CloudStorageCell"
customClass=
"VLCCloudStorage
TableViewCell"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"320"
height=
"48"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<tableViewCellContentView
key=
"contentView"
opaque=
"NO"
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"center"
tableViewCell=
"3"
id=
"Tip-yB-5Gh"
>
...
...
Resources/VLCGoogleDriveTableViewCell~ipad.xib
deleted
100644 → 0
View file @
3d4eb5cf
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"4510"
systemVersion=
"12E55"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
>
<dependencies>
<deployment
version=
"1296"
defaultVersion=
"1296"
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"3742"
/>
</dependencies>
<objects>
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
/>
<placeholder
placeholderIdentifier=
"IBFirstResponder"
id=
"-2"
customClass=
"UIResponder"
/>
<tableViewCell
contentMode=
"scaleToFill"
selectionStyle=
"blue"
indentationWidth=
"10"
reuseIdentifier=
"DropboxCell"
rowHeight=
"76"
id=
"3"
customClass=
"VLCGoogleDriveTableViewCell"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"320"
height=
"80"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<tableViewCellContentView
key=
"contentView"
opaque=
"NO"
clipsSubviews=
"YES"
multipleTouchEnabled=
"YES"
contentMode=
"center"
tableViewCell=
"3"
id=
"ymH-cz-dYo"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"320"
height=
"79"
/>
<autoresizingMask
key=
"autoresizingMask"
/>
<subviews>
<imageView
userInteractionEnabled=
"NO"
contentMode=
"scaleToFill"
id=
"4"
>
<rect
key=
"frame"
x=
"5"
y=
"8"
width=
"64"
height=
"64"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
</imageView>
<label
opaque=
"NO"
clipsSubviews=
"YES"
userInteractionEnabled=
"NO"
contentMode=
"left"
text=
"File Title"
lineBreakMode=
"wordWrap"
baselineAdjustment=
"none"
adjustsFontSizeToFit=
"NO"
id=
"6"
>
<rect
key=
"frame"
x=
"83"
y=
"21"
width=
"232"
height=
"21"
/>