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
310
Issues
310
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
b2d273ca
Commit
b2d273ca
authored
May 15, 2018
by
Quentin Richard
Committed by
Carola Nitz
May 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update AlertView to AlertViewController
parent
bf436a6f
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
315 additions
and
211 deletions
+315
-211
SharedSources/ServerBrowsing/UIViewController+VLCAlert.m
SharedSources/ServerBrowsing/UIViewController+VLCAlert.m
+9
-7
Sources/LocalNetworkConnectivity/VLCNetworkLoginViewController.m
.../LocalNetworkConnectivity/VLCNetworkLoginViewController.m
+15
-8
Sources/VLC for iOS-Prefix.pch
Sources/VLC for iOS-Prefix.pch
+0
-1
Sources/VLCBoxController.m
Sources/VLCBoxController.m
+9
-6
Sources/VLCBoxTableViewController.m
Sources/VLCBoxTableViewController.m
+23
-10
Sources/VLCBugreporter.m
Sources/VLCBugreporter.m
+16
-14
Sources/VLCDownloadViewController.m
Sources/VLCDownloadViewController.m
+16
-25
Sources/VLCDropboxController.m
Sources/VLCDropboxController.m
+9
-6
Sources/VLCDropboxTableViewController.m
Sources/VLCDropboxTableViewController.m
+24
-20
Sources/VLCGoogleDriveController.m
Sources/VLCGoogleDriveController.m
+9
-6
Sources/VLCGoogleDriveTableViewController.m
Sources/VLCGoogleDriveTableViewController.m
+24
-20
Sources/VLCHTTPConnection.m
Sources/VLCHTTPConnection.m
+12
-9
Sources/VLCHTTPFileDownloader.m
Sources/VLCHTTPFileDownloader.m
+9
-6
Sources/VLCOneDriveTableViewController.m
Sources/VLCOneDriveTableViewController.m
+23
-20
Sources/VLCOpenInActivity.m
Sources/VLCOpenInActivity.m
+18
-13
Sources/VLCOpenNetworkStreamViewController.m
Sources/VLCOpenNetworkStreamViewController.m
+12
-16
Sources/VLCPlaybackController.m
Sources/VLCPlaybackController.m
+14
-11
Sources/VLCPlayerDisplayController.m
Sources/VLCPlayerDisplayController.m
+9
-7
VLC.xcodeproj/project.pbxproj
VLC.xcodeproj/project.pbxproj
+4
-6
VLCAlertViewController.swift
VLCAlertViewController.swift
+60
-0
No files found.
SharedSources/ServerBrowsing/UIViewController+VLCAlert.m
View file @
b2d273ca
...
...
@@ -10,7 +10,7 @@
*****************************************************************************/
#import "UIViewController+VLCAlert.h"
#import "VLC_iOS-Swift.h"
@implementation
UIViewController
(
UIViewController_VLCAlert
)
#if TARGET_OS_TV
-
(
void
)
vlc_showAlertWithTitle
:(
NSString
*
)
title
message
:(
NSString
*
)
message
buttonTitle
:(
NSString
*
)
buttonTitle
...
...
@@ -22,12 +22,14 @@
#else
-
(
void
)
vlc_showAlertWithTitle
:(
NSString
*
)
title
message
:(
NSString
*
)
message
buttonTitle
:(
NSString
*
)
buttonTitle
{
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
title
message:
message
delegate:
self
cancelButtonTitle:
buttonTitle
otherButtonTitles:
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
buttonTitle
buttonAction:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
title
errorMessage:
message
viewController:
self
buttonsAction:
buttonsAction
];
}
#endif
@end
Sources/LocalNetworkConnectivity/VLCNetworkLoginViewController.m
View file @
b2d273ca
...
...
@@ -20,6 +20,7 @@
#import "VLCNetworkLoginDataSourceLogin.h"
#import "VLCNetworkLoginDataSourceSavedLogins.h"
#import "VLCNetworkServerLoginInformation.h"
#import "VLC_iOS-Swift.h"
// for protocol identifier
...
...
@@ -171,9 +172,11 @@
self
.
loginInformation
=
login
;
NSError
*
error
=
nil
;
if
(
!
[
self
.
savedLoginsDataSource
saveLogin
:
login
error
:
&
error
])
{
[[[
VLCAlertView
alloc
]
initWithTitle
:
error
.
localizedDescription
message:
error
.
localizedFailureReason
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
otherButtonTitles
:
nil
]
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
buttonAction
:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
error
.
localizedDescription
errorMessage
:
error
.
localizedFailureReason
viewController
:
self
buttonsAction
:
buttonsAction
];
}
[
self
.
tableView
deselectRowAtIndexPath
:
self
.
tableView
.
indexPathForSelectedRow
animated
:
YES
];
...
...
@@ -195,11 +198,15 @@
-
(
BOOL
)
protocolSelected
{
if
(
self
.
protocolDataSource
.
protocol
==
VLCServerProtocolUndefined
)
{
VLCAlertView
*
alertView
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"PROTOCOL_NOT_SELECTED"
,
nil
)
message:
NSLocalizedString
(
@"PROTOCOL_NOT_SELECTED"
,
nil
)
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
otherButtonTitles:
nil
];
[
alertView
performSelectorOnMainThread
:
@selector
(
show
)
withObject
:
nil
waitUntilDone
:
NO
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"PROTOCOL_NOT_SELECTED"
,
nil
)
errorMessage:
NSLocalizedString
(
@"PROTOCOL_NOT_SELECTED"
,
nil
)
viewController:
self
buttonsAction:
buttonsAction
];
[
self
.
tableView
deselectRowAtIndexPath
:
self
.
tableView
.
indexPathForSelectedRow
animated
:
YES
];
return
NO
;
}
...
...
Sources/VLC for iOS-Prefix.pch
View file @
b2d273ca
...
...
@@ -23,7 +23,6 @@
#import "VLCConstants.h"
#import "UIColor+Presets.h"
#import "UIBarButtonItem+Theme.h"
#import "VLCAlertView.h"
#import "UIViewController+VLCAlert.h"
#ifndef NDEBUG
...
...
Sources/VLCBoxController.m
View file @
b2d273ca
...
...
@@ -15,6 +15,7 @@
#import "VLCPlaybackController.h"
#import "VLCMediaFileDiscoverer.h"
#import <XKKeychain/XKKeychainGenericPasswordItem.h>
#import "VLC_iOS-Swift.h"
@interface
VLCBoxController
()
{
...
...
@@ -269,12 +270,14 @@
-
(
void
)
showAlert
:(
NSString
*
)
title
message
:(
NSString
*
)
message
{
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
title
message:
message
delegate:
nil
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
otherButtonTitles:
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
okAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
okAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
title
errorMessage:
message
viewController:
self
.
delegate
buttonsAction:
buttonsAction
];
}
-
(
void
)
calculateRemainingTime
:(
CGFloat
)
receivedDataSize
expectedDownloadSize
:(
CGFloat
)
expectedDownloadSize
...
...
Sources/VLCBoxTableViewController.m
View file @
b2d273ca
...
...
@@ -16,6 +16,7 @@
#import <XKKeychain/XKKeychainGenericPasswordItem.h>
#import "UIDevice+VLC.h"
#import "VLCPlaybackController.h"
#import "VLC_iOS-Swift.h"
#if TARGET_OS_IOS
@interface
VLCBoxTableViewController
()
<
VLCCloudStorageTableViewCell
,
BoxAuthorizationViewControllerDelegate
,
VLCCloudStorageDelegate
,
NSURLConnectionDataDelegate
>
...
...
@@ -231,20 +232,32 @@
if
(
_selectedFile
.
size
.
longLongValue
<
[[
UIDevice
currentDevice
]
VLCFreeDiskSpace
].
longLongValue
)
{
/* selected item is a proper file, ask the user if s/he wants to download it */
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"DROPBOX_DOWNLOAD"
,
nil
)
message
:[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DROPBOX_DL_LONG"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
delegate
:
self
cancelButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
otherButtonTitles
:
NSLocalizedString
(
@"BUTTON_DOWNLOAD"
,
nil
),
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
ButtonAction
*
downloadAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_DOWNLOAD"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){
[
_boxController
downloadFileToDocumentFolder
:
_selectedFile
];
_selectedFile
=
nil
;
}];
[
buttonsAction
addObject
:
cancelAction
];
[
buttonsAction
addObject
:
downloadAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"DROPBOX_DOWNLOAD"
,
nil
)
errorMessage:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DROPBOX_DL_LONG"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
viewController:
self
buttonsAction:
buttonsAction
];
}
else
{
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"DISK_FULL"
,
nil
)
message
:[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DISK_FULL_FORMAT"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
delegate
:
self
cancelButtonTitle
:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
otherButtonTitles
:
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"DISK_FULL"
,
nil
)
errorMessage:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DISK_FULL_FORMAT"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
viewController:
self
buttonsAction:
buttonsAction
];;
}
}
-
(
void
)
alertView
:(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:(
NSInteger
)
buttonIndex
{
if
(
buttonIndex
==
1
)
[
_boxController
downloadFileToDocumentFolder
:
_selectedFile
];
_selectedFile
=
nil
;
}
#endif
#pragma mark - box controller delegate
...
...
Sources/VLCBugreporter.m
View file @
b2d273ca
...
...
@@ -14,6 +14,8 @@
#import "VLCBugreporter.h"
#import "VLC_iOS-Swift.h"
@implementation
VLCBugreporter
#pragma mark - Initialization
...
...
@@ -33,19 +35,19 @@
-
(
void
)
handleBugreportRequest
{
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"BUG_REPORT_TITLE"
,
nil
)
message:
NSLocalizedString
(
@"BUG_REPORT_MESSAGE"
,
nil
)
delegate
:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
otherButtonTitles:
NSLocalizedString
(
@"BUG_REPORT_BUTTON"
,
nil
),
nil
];;
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
ButtonAction
*
reportAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUG_REPORT_BUTTON"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){
NSURL
*
url
=
[
NSURL
URLWithString
:
@"https://trac.videolan.org/vlc/newticket"
];
[[
UIApplication
sharedApplication
]
openURL
:
url
];
}];
[
buttonsAction
addObject
:
cancelAction
];
[
buttonsAction
addObject
:
reportAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"BUG_REPORT_TITLE"
,
nil
)
errorMessage:
NSLocalizedString
(
@"BUG_REPORT_MESSAGE"
,
nil
)
viewController:
[
UIApplication
sharedApplication
].
keyWindow
.
rootViewController
buttonsAction:
buttonsAction
];
}
-
(
void
)
alertView
:(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:(
NSInteger
)
buttonIndex
{
if
(
buttonIndex
==
1
)
{
NSURL
*
url
=
[
NSURL
URLWithString
:
@"https://trac.videolan.org/vlc/newticket"
];
[[
UIApplication
sharedApplication
]
openURL
:
url
];
}
}
@end
Sources/VLCDownloadViewController.m
View file @
b2d273ca
...
...
@@ -139,21 +139,17 @@ typedef NS_ENUM(NSUInteger, VLCDownloadScheme) {
if
([
self
.
urlField
.
text
length
]
>
0
)
{
NSURL
*
URLtoSave
=
[
NSURL
URLWithString
:
self
.
urlField
.
text
];
if
(
!
[
URLtoSave
.
lastPathComponent
isSupportedFormat
]
&&
!
[
URLtoSave
.
lastPathComponent
.
pathExtension
isEqualToString
:
@""
])
{
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"FILE_NOT_SUPPORTED"
,
nil
)
message:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"FILE_NOT_SUPPORTED_LONG"
,
nil
),
URLtoSave
.
lastPathComponent
]
delegate:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
otherButtonTitles:
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
buttonAction
:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"FILE_NOT_SUPPORTED"
,
nil
)
errorMessage
:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"FILE_NOT_SUPPORTED_LONG"
,
nil
),
URLtoSave
.
lastPathComponent
]
viewController
:
self
buttonsAction
:
buttonsAction
];
return
;
}
if
(
!
[
URLtoSave
.
scheme
isEqualToString
:
@"http"
]
&
!
[
URLtoSave
.
scheme
isEqualToString
:
@"https"
]
&&
!
[
URLtoSave
.
scheme
isEqualToString
:
@"ftp"
])
{
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"SCHEME_NOT_SUPPORTED"
,
nil
)
message:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"SCHEME_NOT_SUPPORTED_LONG"
,
nil
),
URLtoSave
.
scheme
]
delegate:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
otherButtonTitles:
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
buttonAction
:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"SCHEME_NOT_SUPPORTED"
,
nil
)
errorMessage
:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"SCHEME_NOT_SUPPORTED_LONG"
,
nil
),
URLtoSave
.
scheme
]
viewController
:
self
buttonsAction
:
buttonsAction
];
return
;
}
...
...
@@ -317,12 +313,10 @@ typedef NS_ENUM(NSUInteger, VLCDownloadScheme) {
-
(
void
)
downloadFailedWithErrorDescription
:(
NSString
*
)
description
{
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"DOWNLOAD_FAILED"
,
nil
)
message:
description
delegate:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
otherButtonTitles:
nil
];
[
alert
performSelectorOnMainThread
:
@selector
(
show
)
withObject
:
nil
waitUntilDone
:
NO
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
buttonAction
:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"SCHEME_NOT_SUPPORTED"
,
nil
)
errorMessage
:
description
viewController
:
self
buttonsAction
:
buttonsAction
];
}
-
(
void
)
progressUpdatedTo
:(
CGFloat
)
percentage
receivedDataSize
:(
CGFloat
)
receivedDataSize
expectedDownloadSize
:(
CGFloat
)
expectedDownloadSize
...
...
@@ -395,13 +389,10 @@ typedef NS_ENUM(NSUInteger, VLCDownloadScheme) {
{
_FTPDownloadRequest
=
nil
;
[
self
downloadEnded
];
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:[
NSString
stringWithFormat
:
NSLocalizedString
(
@"ERROR_NUMBER"
,
nil
),
request
.
error
.
errorCode
]
message:
request
.
error
.
message
delegate:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
otherButtonTitles:
nil
];
[
alert
performSelectorOnMainThread
:
@selector
(
show
)
withObject
:
nil
waitUntilDone
:
NO
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
buttonAction
:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:[
NSString
stringWithFormat
:
NSLocalizedString
(
@"ERROR_NUMBER"
,
nil
),
request
.
error
.
errorCode
]
errorMessage
:
request
.
error
.
message
viewController
:
self
buttonsAction
:
buttonsAction
];
}
#pragma mark - table view data source
...
...
Sources/VLCDropboxController.m
View file @
b2d273ca
...
...
@@ -17,6 +17,7 @@
#import "VLCActivityManager.h"
#import "VLCMediaFileDiscoverer.h"
#import "VLCDropboxConstants.h"
#import "VLC_iOS-Swift.h"
@interface
VLCDropboxController
()
{
...
...
@@ -325,12 +326,14 @@
-
(
void
)
_handleError
:(
NSError
*
)
error
{
#if TARGET_OS_IOS
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:[
NSString
stringWithFormat
:
NSLocalizedString
(
@"ERROR_NUMBER"
,
nil
),
error
.
code
]
message:
error
.
localizedDescription
delegate:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
otherButtonTitles:
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:[
NSString
stringWithFormat
:
NSLocalizedString
(
@"ERROR_NUMBER"
,
nil
),
error
.
code
]
errorMessage:
error
.
localizedDescription
viewController:
self
.
delegate
buttonsAction:
buttonsAction
];
#else
UIAlertController
*
alert
=
[
UIAlertController
alertControllerWithTitle
:[
NSString
stringWithFormat
:
NSLocalizedString
(
@"ERROR_NUMBER"
,
nil
),
error
.
code
]
message:
error
.
localizedDescription
...
...
Sources/VLCDropboxTableViewController.m
View file @
b2d273ca
...
...
@@ -19,6 +19,7 @@
#import "VLCCloudStorageTableViewCell.h"
#import "UIDevice+VLC.h"
#import "VLCAppDelegate.h"
#import "VLC_iOS-Swift.h"
@interface
VLCDropboxTableViewController
()
<
VLCCloudStorageTableViewCell
,
VLCCloudStorageDelegate
>
{
...
...
@@ -168,30 +169,33 @@
if
(((
DBFILESFileMetadata
*
)
_selectedFile
).
size
.
longLongValue
<
[[
UIDevice
currentDevice
]
VLCFreeDiskSpace
].
longLongValue
)
{
/* selected item is a proper file, ask the user if s/he wants to download it */
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"DROPBOX_DOWNLOAD"
,
nil
)
message:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DROPBOX_DL_LONG"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
delegate:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
otherButtonTitles:
NSLocalizedString
(
@"BUTTON_DOWNLOAD"
,
nil
),
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
ButtonAction
*
downloadAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_DOWNLOAD"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){
[
_dropboxController
downloadFileToDocumentFolder
:
_selectedFile
];
_selectedFile
=
nil
;
}];
[
buttonsAction
addObject
:
cancelAction
];
[
buttonsAction
addObject
:
downloadAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"DROPBOX_DOWNLOAD"
,
nil
)
errorMessage:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DROPBOX_DL_LONG"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
viewController:
self
buttonsAction:
buttonsAction
];
}
else
{
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"DISK_FULL"
,
nil
)
message:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DISK_FULL_FORMAT"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
delegate:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
otherButtonTitles:
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"DISK_FULL"
,
nil
)
errorMessage:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DISK_FULL_FORMAT"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
viewController:
self
buttonsAction:
buttonsAction
];
}
}
-
(
void
)
alertView
:(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:(
NSInteger
)
buttonIndex
{
if
(
buttonIndex
==
1
)
[
_dropboxController
downloadFileToDocumentFolder
:
_selectedFile
];
_selectedFile
=
nil
;
}
#endif
@end
Sources/VLCGoogleDriveController.m
View file @
b2d273ca
...
...
@@ -16,6 +16,7 @@
#import "NSString+SupportedMedia.h"
#import "VLCPlaybackController.h"
#import "VLCMediaFileDiscoverer.h"
#import "VLC_iOS-Swift.h"
#import <XKKeychain/XKKeychain.h>
#import <AppAuth/AppAuth.h>
...
...
@@ -128,12 +129,14 @@
-
(
void
)
showAlert
:(
NSString
*
)
title
message
:(
NSString
*
)
message
{
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
title
message:
message
delegate:
nil
cancelButtonTitle:
@"OK"
otherButtonTitles:
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
title
errorMessage:
message
viewController:
[
UIApplication
sharedApplication
].
keyWindow
.
rootViewController
buttonsAction:
buttonsAction
];
}
#pragma mark - file management
...
...
Sources/VLCGoogleDriveTableViewController.m
View file @
b2d273ca
...
...
@@ -17,6 +17,7 @@
#import "VLCGoogleDriveController.h"
#import "UIDevice+VLC.h"
#import "VLCCloudStorageTableViewCell.h"
#import "VLC_iOS-Swift.h"
#import <AppAuth/AppAuth.h>
#import <GTMAppAuth/GTMAppAuth.h>
...
...
@@ -127,29 +128,32 @@
if
(
_selectedFile
.
size
.
longLongValue
<
[[
UIDevice
currentDevice
]
VLCFreeDiskSpace
].
longLongValue
)
{
/* selected item is a proper file, ask the user if s/he wants to download it */
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"DROPBOX_DOWNLOAD"
,
nil
)
message:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DROPBOX_DL_LONG"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
delegate:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
otherButtonTitles:
NSLocalizedString
(
@"BUTTON_DOWNLOAD"
,
nil
),
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
ButtonAction
*
downloadAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_DOWNLOAD"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){
[
_googleDriveController
downloadFileToDocumentFolder
:
_selectedFile
];
_selectedFile
=
nil
;
}];
[
buttonsAction
addObject
:
cancelAction
];
[
buttonsAction
addObject
:
downloadAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"DROPBOX_DOWNLOAD"
,
nil
)
errorMessage:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DROPBOX_DL_LONG"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
viewController:
self
buttonsAction:
buttonsAction
];
}
else
{
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"DISK_FULL"
,
nil
)
message:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DISK_FULL_FORMAT"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
delegate:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
otherButtonTitles:
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"DISK_FULL"
,
nil
)
errorMessage:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DISK_FULL_FORMAT"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
viewController:
self
buttonsAction:
buttonsAction
];
}
}
-
(
void
)
alertView
:(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:(
NSInteger
)
buttonIndex
{
if
(
buttonIndex
==
1
)
[
_googleDriveController
downloadFileToDocumentFolder
:
_selectedFile
];
_selectedFile
=
nil
;
}
#pragma mark - login dialog
-
(
IBAction
)
loginAction
:(
id
)
sender
...
...
Sources/VLCHTTPConnection.m
View file @
b2d273ca
...
...
@@ -26,6 +26,7 @@
#import "UIDevice+VLC.h"
#import "VLCHTTPUploaderController.h"
#import "VLCMetaData.h"
#import "VLC_iOS-Swift.h"
#if TARGET_OS_IOS
#import "VLCThumbnailsCache.h"
...
...
@@ -722,15 +723,17 @@
-
(
void
)
notifyUserAboutEndOfFreeStorage
:(
NSString
*
)
filename
{
#if TARGET_OS_IOS
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"DISK_FULL"
,
nil
)
message:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DISK_FULL_FORMAT"
,
nil
),
filename
,
[[
UIDevice
currentDevice
]
model
]]
delegate:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
otherButtonTitles:
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
okAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
okAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"DISK_FULL"
,
nil
)
errorMessage:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DISK_FULL_FORMAT"
,
nil
),
filename
,
[[
UIDevice
currentDevice
]
model
]]
viewController:
[
UIApplication
sharedApplication
].
keyWindow
.
rootViewController
buttonsAction:
buttonsAction
];
#else
UIAlertController
*
alertController
=
[
UIAlertController
alertControllerWithTitle
:
NSLocalizedString
(
@"DISK_FULL"
,
nil
)
message:
[
NSString
stringWithFormat
:
...
...
Sources/VLCHTTPFileDownloader.m
View file @
b2d273ca
...
...
@@ -16,6 +16,7 @@
#import "VLCActivityManager.h"
#import "UIDevice+VLC.h"
#import "VLCMediaFileDiscoverer.h"
#import "VLC_iOS-Swift.h"
@interface
VLCHTTPFileDownloader
()
<
NSURLSessionDelegate
>
{
...
...
@@ -111,12 +112,14 @@
_expectedDownloadSize
=
[
response
expectedContentLength
];
APLog
(
@"expected download size: %lli"
,
_expectedDownloadSize
);
if
(
_expectedDownloadSize
>
[[
UIDevice
currentDevice
]
VLCFreeDiskSpace
].
longLongValue
)
{
//handle too big a download
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"DISK_FULL"
,
nil
)
message:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DISK_FULL_FORMAT"
,
nil
),
_fileName
,
[[
UIDevice
currentDevice
]
model
]]
delegate:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
otherButtonTitles:
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
okAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
okAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"DISK_FULL"
,
nil
)
errorMessage:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DISK_FULL_FORMAT"
,
nil
),
_fileName
,
[[
UIDevice
currentDevice
]
model
]]
viewController:
self
.
delegate
buttonsAction:
buttonsAction
];
[
_sessionTask
cancel
];
[
self
_downloadEnded
];
return
;
...
...
Sources/VLCOneDriveTableViewController.m
View file @
b2d273ca
...
...
@@ -19,6 +19,7 @@
#import "UIDevice+VLC.h"
#import "NSString+SupportedMedia.h"
#import "VLCConstants.h"
#import "VLC_iOS-Swift.h"
@interface
VLCOneDriveTableViewController
()
<
VLCCloudStorageDelegate
>
{
...
...
@@ -197,29 +198,31 @@
if
(
_selectedFile
.
size
.
longLongValue
<
[[
UIDevice
currentDevice
]
VLCFreeDiskSpace
].
longLongValue
)
{
/* selected item is a proper file, ask the user if s/he wants to download it */
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"DROPBOX_DOWNLOAD"
,
nil
)
message:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DROPBOX_DL_LONG"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
delegate:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
otherButtonTitles:
NSLocalizedString
(
@"BUTTON_DOWNLOAD"
,
nil
),
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_CANCEL"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
ButtonAction
*
downloadAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_DOWNLOAD"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){
[
_oneDriveController
downloadObject
:
_selectedFile
];
_selectedFile
=
nil
;
}];
[
buttonsAction
addObject
:
cancelAction
];
[
buttonsAction
addObject
:
downloadAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"DROPBOX_DOWNLOAD"
,
nil
)
errorMessage:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DROPBOX_DL_LONG"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
viewController:
self
buttonsAction:
buttonsAction
];
}
else
{
VLCAlertView
*
alert
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"DISK_FULL"
,
nil
)
message:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DISK_FULL_FORMAT"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
delegate:
self
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
otherButtonTitles:
nil
];
[
alert
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"DISK_FULL"
,
nil
)
errorMessage:
[
NSString
stringWithFormat
:
NSLocalizedString
(
@"DISK_FULL_FORMAT"
,
nil
),
_selectedFile
.
name
,
[[
UIDevice
currentDevice
]
model
]]
viewController:
self
buttonsAction:
buttonsAction
];
}
}
-
(
void
)
alertView
:(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:(
NSInteger
)
buttonIndex
{
if
(
buttonIndex
==
1
)
[
_oneDriveController
downloadObject
:
_selectedFile
];
_selectedFile
=
nil
;
}
#endif
@end
Sources/VLCOpenInActivity.m
View file @
b2d273ca
...
...
@@ -15,6 +15,8 @@
#import <MobileCoreServices/MobileCoreServices.h>
#import "VLC_iOS-Swift.h"
@interface
VLCOpenInActivity
()
<
UIDocumentInteractionControllerDelegate
>
@end
...
...
@@ -83,13 +85,14 @@
}
else
if
(
count
==
1
)
{
[
self
presentDocumentInteractionControllerWithFileURL
:[
_fileURLs
firstObject
]];
}
else
{
VLCAlertView
*
alertView
=
[[
VLCAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"SHARING_ERROR_NO_FILES"
,
nil
)
message:
nil
delegate:
nil
cancelButtonTitle:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
otherButtonTitles:
nil
];
[
alertView
show
];
NSMutableArray
<
ButtonAction
*>
*
buttonsAction
=
[[
NSMutableArray
alloc
]
init
];
ButtonAction
*
cancelAction
=
[[
ButtonAction
alloc
]
initWithButtonTitle
:
NSLocalizedString
(
@"BUTTON_OK"
,
nil
)
buttonAction:
^
(
UIAlertAction
*
action
){}];
[
buttonsAction
addObject
:
cancelAction
];
[
VLCAlertViewController
alertViewManagerWithTitle
:
NSLocalizedString
(
@"SHARING_ERROR_NO_FILES"
,
nil
)
errorMessage:
nil