Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC-iOS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
311
Issues
311
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
VLC-iOS
Commits
c993c025
Commit
c993c025
authored
Jan 18, 2015
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clouds: check for available space left on device prior to downloading anything (refs #11474)
parent
e64d31ce
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
17 deletions
+60
-17
Resources/en.lproj/Localizable.strings
Resources/en.lproj/Localizable.strings
+0
-0
Sources/UIDevice+SpeedCategory.h
Sources/UIDevice+SpeedCategory.h
+2
-1
Sources/UIDevice+SpeedCategory.m
Sources/UIDevice+SpeedCategory.m
+19
-1
Sources/VLCBoxTableViewController.m
Sources/VLCBoxTableViewController.m
+10
-5
Sources/VLCDropboxTableViewController.m
Sources/VLCDropboxTableViewController.m
+10
-4
Sources/VLCGoogleDriveTableViewController.m
Sources/VLCGoogleDriveTableViewController.m
+10
-4
Sources/VLCOneDriveTableViewController.m
Sources/VLCOneDriveTableViewController.m
+9
-2
No files found.
Resources/en.lproj/Localizable.strings
View file @
c993c025
B
"CHOOSE_AUDIO_TRACK"="Choose Audio Track";
...
...
Sources/UIDevice+SpeedCategory.h
View file @
c993c025
...
...
@@ -2,7 +2,7 @@
* UIDevice+SpeedCategory.h
* VLC for iOS
*****************************************************************************
* Copyright (c) 2013 VideoLAN. All rights reserved.
* Copyright (c) 2013
-2015
VideoLAN. All rights reserved.
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan.org>
...
...
@@ -15,5 +15,6 @@
@interface
UIDevice
(
SpeedCategory
)
-
(
int
)
speedCategory
;
-
(
NSNumber
*
)
freeDiskspace
;
@end
Sources/UIDevice+SpeedCategory.m
View file @
c993c025
...
...
@@ -2,7 +2,7 @@
* UIDevice+SpeedCategory.m
* VLC for iOS
*****************************************************************************
* Copyright (c) 2013 VideoLAN. All rights reserved.
* Copyright (c) 2013
-2015
VideoLAN. All rights reserved.
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan.org>
...
...
@@ -45,4 +45,22 @@
}
}
-
(
NSNumber
*
)
freeDiskspace
{
NSNumber
*
totalSpace
;
NSNumber
*
totalFreeSpace
;
NSError
*
error
=
nil
;
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
NSDictionary
*
dictionary
=
[[
NSFileManager
defaultManager
]
attributesOfFileSystemForPath
:[
paths
lastObject
]
error
:
&
error
];
if
(
!
error
)
{
totalSpace
=
[
dictionary
objectForKey
:
NSFileSystemSize
];
totalFreeSpace
=
[
dictionary
objectForKey
:
NSFileSystemFreeSize
];
APLog
(
@"Memory Capacity of %llu MiB with %llu MiB Free memory available."
,
(([
totalSpace
unsignedLongLongValue
]
/
1024ll
)
/
1024ll
),
(([
totalFreeSpace
unsignedLongLongValue
]
/
1024ll
)
/
1024ll
));
}
else
APLog
(
@"Error Obtaining System Memory Info: Domain = %@, Code = %i"
,
[
error
domain
],
[
error
code
]);
return
totalFreeSpace
;
}
@end
Sources/VLCBoxTableViewController.m
View file @
c993c025
...
...
@@ -2,7 +2,7 @@
* VLCBoxTableViewController.m
* VLC for iOS
*****************************************************************************
* Copyright (c) 2014 VideoLAN. All rights reserved.
* Copyright (c) 2014
-2015
VideoLAN. All rights reserved.
* $Id$
*
* Authors: Carola Nitz <nitz.carola # googlemail.com>
...
...
@@ -14,6 +14,7 @@
#import "VLCBoxController.h"
#import "VLCAppDelegate.h"
#import <SSKeychain/SSKeychain.h>
#import "UIDevice+SpeedCategory.h"
@interface
VLCBoxTableViewController
()
<
VLCCloudStorageTableViewCell
,
BoxAuthorizationViewControllerDelegate
>
{
...
...
@@ -134,12 +135,16 @@
{
_selectedFile
=
_boxController
.
currentListFiles
[[
self
.
tableView
indexPathForCell
:
cell
].
row
];
/* selected item is a proper file, ask the user if s/he wants to download it */
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"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
];
if
(
_selectedFile
.
size
.
longLongValue
<
[[
UIDevice
currentDevice
]
freeDiskspace
].
longLongValue
)
{
/* 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
];
[
alert
show
];
}
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
];
[
alert
show
];
}
}
-
(
void
)
alertView
:(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:(
NSInteger
)
buttonIndex
{
if
(
buttonIndex
==
1
)
...
...
Sources/VLCDropboxTableViewController.m
View file @
c993c025
...
...
@@ -2,7 +2,7 @@
* VLCDropboxTableViewController.m
* VLC for iOS
*****************************************************************************
* Copyright (c) 2013 VideoLAN. All rights reserved.
* Copyright (c) 2013
-2015
VideoLAN. All rights reserved.
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne # videolan.org>
...
...
@@ -18,6 +18,7 @@
#import "VLCDropboxController.h"
#import "VLCAppDelegate.h"
#import "VLCDropboxConstants.h"
#import "UIDevice+SpeedCategory.h"
@interface
VLCDropboxTableViewController
()
<
VLCCloudStorageTableViewCell
>
{
...
...
@@ -123,9 +124,14 @@
{
_selectedFile
=
_dropboxController
.
currentListFiles
[[
self
.
tableView
indexPathForCell
:
cell
].
row
];
/* selected item is a proper file, ask the user if s/he wants to download it */
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"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
];
if
(
_selectedFile
.
totalBytes
<
[[
UIDevice
currentDevice
]
freeDiskspace
].
longLongValue
)
{
/* 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
];
[
alert
show
];
}
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
];
[
alert
show
];
}
}
@end
Sources/VLCGoogleDriveTableViewController.m
View file @
c993c025
...
...
@@ -2,7 +2,7 @@
* VLCGoogleDriveTableViewController.m
* VLC for iOS
*****************************************************************************
* Copyright (c) 2013 VideoLAN. All rights reserved.
* Copyright (c) 2013
-2015
VideoLAN. All rights reserved.
* $Id$
*
* Authors: Carola Nitz <nitz.carola # googlemail.com>
...
...
@@ -15,6 +15,7 @@
#import "VLCAppDelegate.h"
#import "GTMOAuth2ViewControllerTouch.h"
#import "VLCGoogleDriveController.h"
#import "UIDevice+SpeedCategory.h"
@interface
VLCGoogleDriveTableViewController
()
<
VLCCloudStorageTableViewCell
>
{
...
...
@@ -132,9 +133,14 @@
{
_selectedFile
=
_googleDriveController
.
currentListFiles
[[
self
.
tableView
indexPathForCell
:
cell
].
row
];
/* selected item is a proper file, ask the user if s/he wants to download it */
UIAlertView
*
alert
=
[[
UIAlertView
alloc
]
initWithTitle
:
NSLocalizedString
(
@"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
];
if
(
_selectedFile
.
fileSize
.
longLongValue
<
[[
UIDevice
currentDevice
]
freeDiskspace
].
longLongValue
)
{
/* 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
];
[
alert
show
];
}
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
];
[
alert
show
];
}
}
-
(
void
)
alertView
:(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:(
NSInteger
)
buttonIndex
...
...
Sources/VLCOneDriveTableViewController.m
View file @
c993c025
...
...
@@ -17,6 +17,7 @@
#import "VLCAppDelegate.h"
#import "VLCOneDriveController.h"
#import "VLCProgressView.h"
#import "UIDevice+SpeedCategory.h"
@interface
VLCOneDriveTableViewController
()
{
...
...
@@ -132,8 +133,14 @@
NSIndexPath
*
indexPath
=
[
self
.
tableView
indexPathForCell
:
cell
];
_selectedFile
=
_oneDriveController
.
currentFolder
.
items
[
indexPath
.
row
];
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
];
[
alert
show
];
if
(
_selectedFile
.
size
.
longLongValue
<
[[
UIDevice
currentDevice
]
freeDiskspace
].
longLongValue
)
{
/* 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
];
[
alert
show
];
}
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
];
[
alert
show
];
}
}
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment