Commit b2d273ca authored by Quentin Richard's avatar Quentin Richard Committed by Carola Nitz

Update AlertView to AlertViewController

parent bf436a6f
......@@ -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
......@@ -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;
}
......
......@@ -23,7 +23,6 @@
#import "VLCConstants.h"
#import "UIColor+Presets.h"
#import "UIBarButtonItem+Theme.h"
#import "VLCAlertView.h"
#import "UIViewController+VLCAlert.h"
#ifndef NDEBUG
......
......@@ -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
......
......@@ -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
......
......@@ -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
......@@ -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
......
......@@ -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
......
......@@ -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
......@@ -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
......
......@@ -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
......
......@@ -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:
......
......@@ -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;
......
......@@ -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
......@@ -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
viewController:self.activityViewController
buttonsAction:buttonsAction];
[self activityDidFinish:NO];
}
}
......@@ -126,13 +129,15 @@
controllerWasPresentedSuccessfully = [self->_documentInteractionController presentOpenInMenuFromBarButtonItem:self.presentingBarButtonItem animated:YES];
if (!controllerWasPresentedSuccessfully) {
VLCAlertView *alertView = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"SHARING_ERROR_NO_APPLICATIONS", 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_APPLICATIONS", nil)
errorMessage:nil
viewController:self.activityViewController
buttonsAction:buttonsAction];
[self activityDidFinish:NO];
}
};
......
......@@ -203,16 +203,14 @@
- (IBAction)openButtonAction:(id)sender
{
if ([self.urlField.text length] <= 0 || [NSURL URLWithString:self.urlField.text] == nil) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"URL_NOT_SUPPORTED", nil)
message:nil
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"BUTTON_OK", nil)
style:UIAlertActionStyleCancel
handler:nil];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
NSMutableArray<ButtonAction *> *buttonsAction = [[NSMutableArray alloc] init];
ButtonAction *cancelAction = [[ButtonAction alloc] initWithButtonTitle: NSLocalizedString(@"BUTTON_OK", nil)
buttonAction: ^(UIAlertAction* action){}];
[buttonsAction addObject: cancelAction];
[VLCAlertViewController alertViewManagerWithTitle:NSLocalizedString(@"URL_NOT_SUPPORTED", nil)
errorMessage: NSLocalizedString(@"PROTOCOL_NOT_SELECTED", nil)
viewController:self
buttonsAction:buttonsAction];
return;
}
if (!self.privateToggleSwitch.on) {
......@@ -426,12 +424,10 @@ forRowAtIndexPath:(NSIndexPath *)indexPath
}
[receivedSub writeToFile:fileSubtitlePath atomically:YES];
} else {
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 performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:NO];
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 buttonsAction:buttonsAction];
}
return fileSubtitlePath;
......
......@@ -23,6 +23,7 @@
#import "VLCConstants.h"
#import "VLCRemoteControlService.h"
#import "VLCMetadata.h"
#import "VLC_iOS-Swift.h"
NSString *const VLCPlaybackControllerPlaybackDidStart = @"VLCPlaybackControllerPlaybackDidStart";