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

ATV: add box

parent 15393273
...@@ -169,6 +169,18 @@ ...@@ -169,6 +169,18 @@
#pragma mark - BoxAuthorizationViewControllerDelegate #pragma mark - BoxAuthorizationViewControllerDelegate
- (void)boxApiTokenDidRefresh
{
NSString *token = [BoxSDK sharedSDK].OAuth2Session.refreshToken;
[SSKeychain setPassword:token forService:kVLCBoxService account:kVLCBoxAccount];
NSUbiquitousKeyValueStore *ubiquitousStore = [NSUbiquitousKeyValueStore defaultStore];
[ubiquitousStore setString:token forKey:kVLCStoreBoxCredentials];
[ubiquitousStore synchronize];
self.authorizationInProgress = YES;
[self updateViewAfterSessionChange];
self.authorizationInProgress = NO;
}
#if TARGET_OS_IOS #if TARGET_OS_IOS
- (BOOL)authorizationViewController:(BoxAuthorizationViewController *)authorizationViewController shouldLoadReceivedOAuth2RedirectRequest:(NSURLRequest *)request - (BOOL)authorizationViewController:(BoxAuthorizationViewController *)authorizationViewController shouldLoadReceivedOAuth2RedirectRequest:(NSURLRequest *)request
{ {
...@@ -192,18 +204,6 @@ ...@@ -192,18 +204,6 @@
[self _showLoginPanel]; [self _showLoginPanel];
} }
- (void)boxApiTokenDidRefresh
{
NSString *token = [BoxSDK sharedSDK].OAuth2Session.refreshToken;
[SSKeychain setPassword:token forService:kVLCBoxService account:kVLCBoxAccount];
NSUbiquitousKeyValueStore *ubiquitousStore = [NSUbiquitousKeyValueStore defaultStore];
[ubiquitousStore setString:token forKey:kVLCStoreBoxCredentials];
[ubiquitousStore synchronize];
self.authorizationInProgress = YES;
[self updateViewAfterSessionChange];
self.authorizationInProgress = NO;
}
- (void)boxAPIAuthenticationDidFail - (void)boxAPIAuthenticationDidFail
{ {
//needs to be implemented //needs to be implemented
......
...@@ -15,5 +15,6 @@ ...@@ -15,5 +15,6 @@
- (IBAction)dropbox:(id)sender; - (IBAction)dropbox:(id)sender;
- (IBAction)onedrive:(id)sender; - (IBAction)onedrive:(id)sender;
- (IBAction)box:(id)sender;
@end @end
...@@ -16,11 +16,13 @@ ...@@ -16,11 +16,13 @@
#import "SSKeychain.h" #import "SSKeychain.h"
#import "VLCPlayerDisplayController.h" #import "VLCPlayerDisplayController.h"
#import "VLCOneDriveTableViewController.h" #import "VLCOneDriveTableViewController.h"
#import "VLCBoxTableViewController.h"
@interface VLCCloudServicesTVViewController () @interface VLCCloudServicesTVViewController ()
@property (nonatomic) VLCDropboxTableViewController *dropboxTableViewController; @property (nonatomic) VLCDropboxTableViewController *dropboxTableViewController;
@property (nonatomic) VLCOneDriveTableViewController *oneDriveTableViewController; @property (nonatomic) VLCOneDriveTableViewController *oneDriveTableViewController;
@property (nonatomic) VLCBoxTableViewController *boxTableViewController;
@end @end
...@@ -31,6 +33,7 @@ ...@@ -31,6 +33,7 @@
self.dropboxTableViewController = [[VLCDropboxTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil]; self.dropboxTableViewController = [[VLCDropboxTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil];
self.oneDriveTableViewController = [[VLCOneDriveTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil]; self.oneDriveTableViewController = [[VLCOneDriveTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil];
self.boxTableViewController = [[VLCBoxTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil];
} }
- (NSString *)title - (NSString *)title
...@@ -38,7 +41,7 @@ ...@@ -38,7 +41,7 @@
return @"Cloud Services"; return @"Cloud Services";
} }
- (void)dropbox:(id)sender - (IBAction)dropbox:(id)sender
{ {
if ([[VLCDropboxController sharedInstance] restoreFromSharedCredentials]) { if ([[VLCDropboxController sharedInstance] restoreFromSharedCredentials]) {
[self showDetailViewController:self.dropboxTableViewController sender:self]; [self showDetailViewController:self.dropboxTableViewController sender:self];
...@@ -64,9 +67,14 @@ ...@@ -64,9 +67,14 @@
[self presentViewController:alert animated:YES completion:nil]; [self presentViewController:alert animated:YES completion:nil];
} }
- (void)onedrive:(id)sender - (IBAction)onedrive:(id)sender
{ {
[self showDetailViewController:self.oneDriveTableViewController sender:self]; [self showDetailViewController:self.oneDriveTableViewController sender:self];
} }
- (IBAction)box:(id)sender
{
[self showDetailViewController:self.boxTableViewController sender:self];
}
@end @end
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
<animations/> <animations/>
<inset key="contentEdgeInsets" minX="40" minY="20" maxX="40" maxY="20"/> <inset key="contentEdgeInsets" minX="40" minY="20" maxX="40" maxY="20"/>
<state key="normal" title="Box"/> <state key="normal" title="Box"/>
<connections>
<action selector="box:" destination="-1" eventType="primaryActionTriggered" id="Eww-7q-bAn"/>
</connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gFm-4V-QFs"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gFm-4V-QFs">
<rect key="frame" x="810" y="677" width="301" height="86"/> <rect key="frame" x="810" y="677" width="301" height="86"/>
......
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