Commit ce7be37c authored by Felix Paul Kühne's avatar Felix Paul Kühne

generally cancel any alert view when app resigns from the active state like it's 2009

(cherry picked from commit 15c7907c)
parent 986796de
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#import "VLCConstants.h" #import "VLCConstants.h"
#import "UIColor+Presets.h" #import "UIColor+Presets.h"
#import "UIBarButtonItem+Theme.h" #import "UIBarButtonItem+Theme.h"
#import "VLCAlertView.h"
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
* Refer to the COPYING file of the official project for license. * Refer to the COPYING file of the official project for license.
*****************************************************************************/ *****************************************************************************/
#import "VLCAlertView.h"
@interface VLCAlertView () <UIAlertViewDelegate> @interface VLCAlertView () <UIAlertViewDelegate>
@end @end
...@@ -20,11 +18,20 @@ ...@@ -20,11 +18,20 @@
@implementation VLCAlertView @implementation VLCAlertView
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (id)initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles { - (id)initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSArray *)otherButtonTitles {
self = [self initWithTitle:title message:message delegate:self cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil]; self = [self initWithTitle:title message:message delegate:self cancelButtonTitle:cancelButtonTitle otherButtonTitles:nil];
if (self) { if (self) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(appWillResignActive:)
name:UIApplicationWillResignActiveNotification
object:nil];
for (NSString *buttonTitle in otherButtonTitles) { for (NSString *buttonTitle in otherButtonTitles) {
[self addButtonWithTitle:buttonTitle]; [self addButtonWithTitle:buttonTitle];
} }
...@@ -32,6 +39,11 @@ ...@@ -32,6 +39,11 @@
return self; return self;
} }
- (void)appWillResignActive:(NSNotification *)aNotification
{
[self dismissWithClickedButtonIndex:self.cancelButtonIndex animated:NO];
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
if (self.completion) { if (self.completion) {
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#import "VLCHTTPUploaderController.h" #import "VLCHTTPUploaderController.h"
#import "VLCMenuTableViewController.h" #import "VLCMenuTableViewController.h"
#import "VLCMigrationViewController.h" #import "VLCMigrationViewController.h"
#import "VLCAlertView.h"
#import <BoxSDK/BoxSDK.h> #import <BoxSDK/BoxSDK.h>
#import "VLCNotificationRelay.h" #import "VLCNotificationRelay.h"
#import "VLCPlaybackController.h" #import "VLCPlaybackController.h"
......
...@@ -85,12 +85,11 @@ ...@@ -85,12 +85,11 @@
- (void)showAlert:(NSString *)title message:(NSString *)message - (void)showAlert:(NSString *)title message:(NSString *)message
{ {
UIAlertView *alert; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:title
alert = [[UIAlertView alloc] initWithTitle: title message:message
message: message delegate:nil
delegate: nil cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
cancelButtonTitle: NSLocalizedString(@"BUTTON_OK", nil) otherButtonTitles:nil];
otherButtonTitles: nil];
[alert show]; [alert show];
} }
......
...@@ -139,10 +139,10 @@ ...@@ -139,10 +139,10 @@
if (_selectedFile.size.longLongValue < [[UIDevice currentDevice] freeDiskspace].longLongValue) { if (_selectedFile.size.longLongValue < [[UIDevice currentDevice] freeDiskspace].longLongValue) {
/* selected item is a proper file, ask the user if s/he wants to download it */ /* selected item is a proper file, ask the user if s/he wants to download it */
UIAlertView *alert = [[UIAlertView 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]; 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]; [alert show];
} else { } else {
UIAlertView *alert = [[UIAlertView 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]; 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]; [alert show];
} }
} }
......
...@@ -33,11 +33,10 @@ ...@@ -33,11 +33,10 @@
- (void)handleBugreportRequest - (void)handleBugreportRequest
{ {
UIAlertView *alert = [[UIAlertView alloc] VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"BUG_REPORT_TITLE", nil)
initWithTitle:NSLocalizedString(@"BUG_REPORT_TITLE", nil) message:NSLocalizedString(@"BUG_REPORT_MESSAGE", nil) delegate:self
message:NSLocalizedString(@"BUG_REPORT_MESSAGE", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil) otherButtonTitles:NSLocalizedString(@"BUG_REPORT_BUTTON", nil), nil];;
otherButtonTitles:NSLocalizedString(@"BUG_REPORT_BUTTON", nil), nil];;
[alert show]; [alert show];
} }
......
...@@ -111,11 +111,19 @@ ...@@ -111,11 +111,19 @@
[self.downloadsTable reloadData]; [self.downloadsTable reloadData];
[self _triggerNextDownload]; [self _triggerNextDownload];
} else { } else {
UIAlertView * alert = [[UIAlertView 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]; 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]; [alert show];
} }
} else { } else {
UIAlertView * alert = [[UIAlertView 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]; 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]; [alert show];
} }
} }
...@@ -249,7 +257,11 @@ ...@@ -249,7 +257,11 @@
- (void)downloadFailedWithErrorDescription:(NSString *)description - (void)downloadFailedWithErrorDescription:(NSString *)description
{ {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DOWNLOAD_FAILED", nil) message:description delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil) otherButtonTitles:nil]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DOWNLOAD_FAILED", nil)
message:description
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
otherButtonTitles:nil];
[alert show]; [alert show];
} }
...@@ -324,7 +336,11 @@ ...@@ -324,7 +336,11 @@
_FTPDownloadRequest = nil; _FTPDownloadRequest = nil;
[self downloadEnded]; [self downloadEnded];
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@"ERROR_NUMBER", nil), request.error.errorCode] message:request.error.message delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil) otherButtonTitles:nil]; 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 show]; [alert show];
} }
......
...@@ -254,7 +254,11 @@ ...@@ -254,7 +254,11 @@
#pragma mark - user feedback #pragma mark - user feedback
- (void)_handleError:(NSError *)error - (void)_handleError:(NSError *)error
{ {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@"ERROR_NUMBER", nil), error.code] message:error.localizedDescription delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil) otherButtonTitles:nil]; 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]; [alert show];
} }
......
...@@ -127,10 +127,18 @@ ...@@ -127,10 +127,18 @@
if (_selectedFile.totalBytes < [[UIDevice currentDevice] freeDiskspace].longLongValue) { if (_selectedFile.totalBytes < [[UIDevice currentDevice] freeDiskspace].longLongValue) {
/* selected item is a proper file, ask the user if s/he wants to download it */ /* selected item is a proper file, ask the user if s/he wants to download it */
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DROPBOX_DOWNLOAD", nil) message:[NSString stringWithFormat:NSLocalizedString(@"DROPBOX_DL_LONG", nil), _selectedFile.filename, [[UIDevice currentDevice] model]] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil) otherButtonTitles:NSLocalizedString(@"BUTTON_DOWNLOAD", nil), nil]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DROPBOX_DOWNLOAD", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"DROPBOX_DL_LONG", nil), _selectedFile.filename, [[UIDevice currentDevice] model]]
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
otherButtonTitles:NSLocalizedString(@"BUTTON_DOWNLOAD", nil), nil];
[alert show]; [alert show];
} else { } else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil) message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), _selectedFile.filename, [[UIDevice currentDevice] model]] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil) otherButtonTitles:nil]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), _selectedFile.filename, [[UIDevice currentDevice] model]]
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
otherButtonTitles:nil];
[alert show]; [alert show];
} }
} }
......
...@@ -83,12 +83,11 @@ ...@@ -83,12 +83,11 @@
- (void)showAlert:(NSString *)title message:(NSString *)message - (void)showAlert:(NSString *)title message:(NSString *)message
{ {
UIAlertView *alert; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle: title
alert = [[UIAlertView alloc] initWithTitle: title message: message
message: message delegate: nil
delegate: nil cancelButtonTitle: @"OK"
cancelButtonTitle: @"OK" otherButtonTitles: nil];
otherButtonTitles: nil];
[alert show]; [alert show];
} }
......
...@@ -140,10 +140,18 @@ ...@@ -140,10 +140,18 @@
if (_selectedFile.fileSize.longLongValue < [[UIDevice currentDevice] freeDiskspace].longLongValue) { if (_selectedFile.fileSize.longLongValue < [[UIDevice currentDevice] freeDiskspace].longLongValue) {
/* selected item is a proper file, ask the user if s/he wants to download it */ /* selected item is a proper file, ask the user if s/he wants to download it */
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DROPBOX_DOWNLOAD", nil) message:[NSString stringWithFormat:NSLocalizedString(@"DROPBOX_DL_LONG", nil), _selectedFile.title, [[UIDevice currentDevice] model]] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil) otherButtonTitles:NSLocalizedString(@"BUTTON_DOWNLOAD", nil), nil]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DROPBOX_DOWNLOAD", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"DROPBOX_DL_LONG", nil), _selectedFile.title, [[UIDevice currentDevice] model]]
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
otherButtonTitles:NSLocalizedString(@"BUTTON_DOWNLOAD", nil), nil];
[alert show]; [alert show];
} else { } else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil) message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), _selectedFile.title, [[UIDevice currentDevice] model]] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil) otherButtonTitles:nil]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), _selectedFile.title, [[UIDevice currentDevice] model]]
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
otherButtonTitles:nil];
[alert show]; [alert show];
} }
} }
......
...@@ -446,14 +446,14 @@ ...@@ -446,14 +446,14 @@
- (void)notifyUserAboutEndOfFreeStorage:(NSString *)filename - (void)notifyUserAboutEndOfFreeStorage:(NSString *)filename
{ {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil) VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil)
message:[NSString stringWithFormat: message:[NSString stringWithFormat:
NSLocalizedString(@"DISK_FULL_FORMAT", nil), NSLocalizedString(@"DISK_FULL_FORMAT", nil),
filename, filename,
[[UIDevice currentDevice] model]] [[UIDevice currentDevice] model]]
delegate:self delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil) cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
otherButtonTitles:nil]; otherButtonTitles:nil];
[alert show]; [alert show];
} }
......
...@@ -97,7 +97,11 @@ ...@@ -97,7 +97,11 @@
_statusCode = [response statusCode]; _statusCode = [response statusCode];
if (_statusCode == 200) { if (_statusCode == 200) {
if (![[response suggestedFilename] isSupportedFormat]) { if (![[response suggestedFilename] isSupportedFormat]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", nil) message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED_LONG", nil), [response suggestedFilename]] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil) otherButtonTitles:nil]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED_LONG", nil), [response suggestedFilename]]
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
otherButtonTitles:nil];
[alert show]; [alert show];
[_urlConnection cancel]; [_urlConnection cancel];
...@@ -112,7 +116,11 @@ ...@@ -112,7 +116,11 @@
else { else {
[_urlConnection cancel]; [_urlConnection cancel];
[self _downloadEnded]; [self _downloadEnded];
UIAlertView *alert = [[UIAlertView 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]; 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]; [alert show];
} }
APLog(@"expected download size: %lu", (unsigned long)_expectedDownloadSize); APLog(@"expected download size: %lu", (unsigned long)_expectedDownloadSize);
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#import "VLCDownloadViewController.h" #import "VLCDownloadViewController.h"
#import "NSString+SupportedMedia.h" #import "NSString+SupportedMedia.h"
#import "VLCStatusLabel.h" #import "VLCStatusLabel.h"
#import "VLCAlertView.h"
#import "UIDevice+VLC.h" #import "UIDevice+VLC.h"
@interface VLCLocalPlexFolderListViewController () <UITableViewDataSource, UITableViewDelegate, VLCLocalNetworkListCell, UISearchBarDelegate, UISearchDisplayDelegate> @interface VLCLocalPlexFolderListViewController () <UITableViewDataSource, UITableViewDelegate, VLCLocalNetworkListCell, UISearchBarDelegate, UISearchDisplayDelegate>
...@@ -328,7 +327,11 @@ ...@@ -328,7 +327,11 @@
NSURL *itemURL = [NSURL URLWithString:[[mutableMediaObject objectAtIndex:0] objectForKey:@"keyMedia"]]; NSURL *itemURL = [NSURL URLWithString:[[mutableMediaObject objectAtIndex:0] objectForKey:@"keyMedia"]];
if (![[itemURL absoluteString] isSupportedFormat]) { if (![[itemURL absoluteString] isSupportedFormat]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", nil) message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED_LONG", nil), [itemURL absoluteString]] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil) otherButtonTitles:nil]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED_LONG", nil), [itemURL absoluteString]]
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
otherButtonTitles:nil];
[alert show]; [alert show];
} else if (itemURL) { } else if (itemURL) {
NSString *fileName = [[mutableMediaObject objectAtIndex:0] objectForKey:@"namefile"]; NSString *fileName = [[mutableMediaObject objectAtIndex:0] objectForKey:@"namefile"];
...@@ -401,7 +404,11 @@ ...@@ -401,7 +404,11 @@
[self _downloadFileFromMediaItem:ObjList]; [self _downloadFileFromMediaItem:ObjList];
[cell.statusLabel showStatusMessage:NSLocalizedString(@"DOWNLOADING", nil)]; [cell.statusLabel showStatusMessage:NSLocalizedString(@"DOWNLOADING", nil)];
} else { } else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil) message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), [[ObjList objectAtIndex:0] objectForKey:@"title"], [[UIDevice currentDevice] model]] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil) otherButtonTitles:nil]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), [[ObjList objectAtIndex:0] objectForKey:@"title"], [[UIDevice currentDevice] model]]
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
otherButtonTitles:nil];
[alert show]; [alert show];
} }
} }
......
...@@ -399,7 +399,11 @@ ...@@ -399,7 +399,11 @@
NSData *flippedData = [rawObjectName dataUsingEncoding:[[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingFTPTextEncoding] intValue] allowLossyConversion:YES]; NSData *flippedData = [rawObjectName dataUsingEncoding:[[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingFTPTextEncoding] intValue] allowLossyConversion:YES];
NSString *properObjectName = [[NSString alloc] initWithData:flippedData encoding:NSUTF8StringEncoding]; NSString *properObjectName = [[NSString alloc] initWithData:flippedData encoding:NSUTF8StringEncoding];
if (![properObjectName isSupportedFormat]) { if (![properObjectName isSupportedFormat]) {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", nil) message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED_LONG", nil), properObjectName] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil) otherButtonTitles:nil]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED_LONG", nil), properObjectName]
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
otherButtonTitles:nil];
[alert show]; [alert show];
} else } else
[self _streamFTPFile:properObjectName]; [self _streamFTPFile:properObjectName];
...@@ -650,7 +654,11 @@ ...@@ -650,7 +654,11 @@
- (void)requestFailed:(WRRequest *)request - (void)requestFailed:(WRRequest *)request
{ {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"LOCAL_SERVER_CONNECTION_FAILED_TITLE", nil) message:NSLocalizedString(@"LOCAL_SERVER_CONNECTION_FAILED_MESSAGE", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil) otherButtonTitles:nil]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"LOCAL_SERVER_CONNECTION_FAILED_TITLE", nil)
message:NSLocalizedString(@"LOCAL_SERVER_CONNECTION_FAILED_MESSAGE", nil)
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
otherButtonTitles:nil];
[alert show]; [alert show];
APLog(@"request %@ failed with error %i", request, request.error.errorCode); APLog(@"request %@ failed with error %i", request, request.error.errorCode);
...@@ -687,14 +695,22 @@ ...@@ -687,14 +695,22 @@
NSData *flippedData = [rawObjectName dataUsingEncoding:[[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingFTPTextEncoding] intValue] allowLossyConversion:YES]; NSData *flippedData = [rawObjectName dataUsingEncoding:[[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingFTPTextEncoding] intValue] allowLossyConversion:YES];
NSString *properObjectName = [[NSString alloc] initWithData:flippedData encoding:NSUTF8StringEncoding]; NSString *properObjectName = [[NSString alloc] initWithData:flippedData encoding:NSUTF8StringEncoding];
if (![properObjectName isSupportedFormat]) { if (![properObjectName isSupportedFormat]) {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", nil) message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED_LONG", nil), properObjectName] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil) otherButtonTitles:nil]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED_LONG", nil), properObjectName]
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
otherButtonTitles:nil];
[alert show]; [alert show];
} else { } else {
if (size < [[UIDevice currentDevice] freeDiskspace].longLongValue) { if (size < [[UIDevice currentDevice] freeDiskspace].longLongValue) {
[self _downloadFTPFile:properObjectName]; [self _downloadFTPFile:properObjectName];
[cell.statusLabel showStatusMessage:NSLocalizedString(@"DOWNLOADING", nil)]; [cell.statusLabel showStatusMessage:NSLocalizedString(@"DOWNLOADING", nil)];
} else { } else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil) message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), properObjectName, [[UIDevice currentDevice] model]] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil) otherButtonTitles:nil]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), properObjectName, [[UIDevice currentDevice] model]]
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
otherButtonTitles:nil];
[alert show]; [alert show];
} }
} }
...@@ -758,7 +774,11 @@ ...@@ -758,7 +774,11 @@
} }
[receivedSub writeToFile:FileSubtitlePath atomically:YES]; [receivedSub writeToFile:FileSubtitlePath atomically:YES];
} else { } else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil) message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), [fileName lastPathComponent], [[UIDevice currentDevice] model]] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil) otherButtonTitles:nil]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil)
message:[NSString stringWithFormat:NSLocalizedString(@"DISK_FULL_FORMAT", nil), [fileName lastPathComponent], [[UIDevice currentDevice] model]]
delegate:self
cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
otherButtonTitles:nil];
[alert show]; [alert show];
} }
......
...@@ -146,10 +146,18 @@ ...@@ -146,10 +146,18 @@
if (_selectedFile.size.longLongValue < [[UIDevice currentDevice] freeDiskspace].longLongValue) { if (_selectedFile.size.longLongValue < [[UIDevice currentDevice] freeDiskspace].longLongValue) {
/* selected item is a proper file, ask the user if s/he wants to download it */ /* selected item is a proper file, ask the user if s/he wants to download it */
UIAlertView * alert = [[UIAlertView 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]; 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]; [alert show];
} else { } else {
UIAlertView *alert = [[UIAlertView 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]; 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]; [alert show];
} }
} }
......
...@@ -87,11 +87,11 @@ ...@@ -87,11 +87,11 @@
} else if (count == 1) { } else if (count == 1) {
[self presentDocumentInteractionControllerWithFileURL:[_fileURLs firstObject]]; [self presentDocumentInteractionControllerWithFileURL:[_fileURLs firstObject]];
} else { } else {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"SHARING_ERROR_NO_FILES", nil) VLCAlertView *alertView = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"SHARING_ERROR_NO_FILES", nil)
message:nil message:nil
delegate:nil delegate:nil
cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil) cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
otherButtonTitles:nil]; otherButtonTitles:nil];
[alertView show]; [alertView show];
[self activityDidFinish:NO]; [self activityDidFinish:NO];
...@@ -130,11 +130,11 @@ ...@@ -130,11 +130,11 @@
controllerWasPresentedSuccessfully = [_documentInteractionController presentOpenInMenuFromBarButtonItem:self.presentingBarButtonItem animated:YES]; controllerWasPresentedSuccessfully = [_documentInteractionController presentOpenInMenuFromBarButtonItem:self.presentingBarButtonItem animated:YES];
if (!controllerWasPresentedSuccessfully) { if (!controllerWasPresentedSuccessfully) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"SHARING_ERROR_NO_APPLICATIONS", nil) VLCAlertView *alertView = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"SHARING_ERROR_NO_APPLICATIONS", nil)
message:nil message:nil
delegate:nil delegate:nil
cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil) cancelButtonTitle:NSLocalizedString(@"BUTTON_OK", nil)
otherButtonTitles:nil]; otherButtonTitles:nil];
[alertView show]; [alertView show];
[self activityDidFinish:NO]; [self activityDidFinish:NO];
......
...@@ -300,7 +300,11 @@ forRowAtIndexPath:(NSIndexPath *)indexPath ...@@ -300,7 +300,11 @@ forRowAtIndexPath:(NSIndexPath *)indexPath
} }
[receivedSub writeToFile:FileSubtitlePath atomically:YES]; [receivedSub writeToFile:FileSubtitlePath atomically:YES];
} else { } else {
UIAlertView *alert = [[UIAlertView 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]; VLCAlertView *alert = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"DISK_FULL", nil)