Commit 9445e28f authored by Felix Paul Kühne's avatar Felix Paul Kühne

VLCDropboxController: add support for ATV

parent 6da09337
......@@ -10,7 +10,11 @@
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
#if TARGET_OS_IOS
#import <DropboxSDK/DropboxSDK.h>
#else
#import <DropboxTVSDK/DropboxSDK.h>
#endif
#import "VLCCloudStorageController.h"
@interface VLCDropboxController : VLCCloudStorageController <DBRestClientDelegate, DBSessionDelegate, DBNetworkRequestDelegate>
......
......@@ -14,8 +14,12 @@
#import "VLCDropboxController.h"
#import "NSString+SupportedMedia.h"
#import "VLCPlaybackController.h"
#if TARGET_OS_TV
#import "VLCPlayerDisplayController.h"
#else
#import "VLCActivityManager.h"
#import "VLCMediaFileDiscoverer.h"
#endif
@interface VLCDropboxController ()
{
......@@ -163,6 +167,7 @@
- (void)restClient:(DBRestClient*)client loadedFile:(NSString*)localPath
{
#if TARGET_OS_IOS
/* update library now that we got a file */
[[VLCMediaFileDiscoverer sharedInstance] performSelectorOnMainThread:@selector(updateMediaList) withObject:nil waitUntilDone:NO];
......@@ -171,6 +176,7 @@
_downloadInProgress = NO;
[self _triggerNextDownload];
#endif
}
- (void)restClient:(DBRestClient*)client loadFileFailedWithError:(NSError*)error
......@@ -217,21 +223,25 @@
- (void)networkRequestStarted
{
_outstandingNetworkRequests++;
#if TARGET_OS_IOS
if (_outstandingNetworkRequests == 1) {
VLCActivityManager *activityManager = [VLCActivityManager defaultManager];
[activityManager networkActivityStarted];
[activityManager disableIdleTimer];
}
#endif
}
- (void)networkRequestStopped
{
_outstandingNetworkRequests--;
#if TARGET_OS_IOS
if (_outstandingNetworkRequests == 0) {
VLCActivityManager *activityManager = [VLCActivityManager defaultManager];
[activityManager networkActivityStopped];
[activityManager activateIdleTimer];
}
#endif
}
#pragma mark - VLC internal communication and delegate
......@@ -270,12 +280,27 @@
#pragma mark - user feedback
- (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];
#else
UIAlertController *alert = [UIAlertController alertControllerWithTitle:[NSString stringWithFormat:NSLocalizedString(@"ERROR_NUMBER", nil), error.code]
message:error.localizedDescription
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *defaultAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"BUTTON_CANCEL", nil)
style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *action) {
}];
[alert addAction:defaultAction];
[[[VLCPlayerDisplayController sharedInstance] childViewController] presentViewController:alert animated:YES completion:nil];
#endif
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment