Felix Paul Kühne 9 лет назад
Родитель
Сommit
d7c6c1fc3a

+ 12 - 12
Sources/VLCBoxTableViewController.m

@@ -169,6 +169,18 @@
 
 #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
 - (BOOL)authorizationViewController:(BoxAuthorizationViewController *)authorizationViewController shouldLoadReceivedOAuth2RedirectRequest:(NSURLRequest *)request
 {
@@ -192,18 +204,6 @@
     [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
 {
     //needs to be implemented

+ 1 - 0
VLC for Apple TV/VLCCloudServicesTVViewController.h

@@ -15,5 +15,6 @@
 
 - (IBAction)dropbox:(id)sender;
 - (IBAction)onedrive:(id)sender;
+- (IBAction)box:(id)sender;
 
 @end

+ 10 - 2
VLC for Apple TV/VLCCloudServicesTVViewController.m

@@ -16,11 +16,13 @@
 #import "SSKeychain.h"
 #import "VLCPlayerDisplayController.h"
 #import "VLCOneDriveTableViewController.h"
+#import "VLCBoxTableViewController.h"
 
 @interface VLCCloudServicesTVViewController ()
 
 @property (nonatomic) VLCDropboxTableViewController *dropboxTableViewController;
 @property (nonatomic) VLCOneDriveTableViewController *oneDriveTableViewController;
+@property (nonatomic) VLCBoxTableViewController *boxTableViewController;
 
 @end
 
@@ -31,6 +33,7 @@
 
     self.dropboxTableViewController = [[VLCDropboxTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil];
     self.oneDriveTableViewController = [[VLCOneDriveTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil];
+    self.boxTableViewController = [[VLCBoxTableViewController alloc] initWithNibName:@"VLCCloudStorageTableViewController" bundle:nil];
 }
 
 - (NSString *)title
@@ -38,7 +41,7 @@
     return @"Cloud Services";
 }
 
-- (void)dropbox:(id)sender
+- (IBAction)dropbox:(id)sender
 {
     if ([[VLCDropboxController sharedInstance] restoreFromSharedCredentials]) {
         [self showDetailViewController:self.dropboxTableViewController sender:self];
@@ -64,9 +67,14 @@
     [self presentViewController:alert animated:YES completion:nil];
 }
 
-- (void)onedrive:(id)sender
+- (IBAction)onedrive:(id)sender
 {
     [self showDetailViewController:self.oneDriveTableViewController sender:self];
 }
 
+- (IBAction)box:(id)sender
+{
+    [self showDetailViewController:self.boxTableViewController sender:self];
+}
+
 @end

+ 3 - 0
VLC for Apple TV/VLCCloudServicesTVViewController.xib

@@ -41,6 +41,9 @@
                     <animations/>
                     <inset key="contentEdgeInsets" minX="40" minY="20" maxX="40" maxY="20"/>
                     <state key="normal" title="Box"/>
+                    <connections>
+                        <action selector="box:" destination="-1" eventType="primaryActionTriggered" id="Eww-7q-bAn"/>
+                    </connections>
                 </button>
                 <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"/>