VLCCloudServicesTVViewController.m 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*****************************************************************************
  2. * VLC for iOS
  3. *****************************************************************************
  4. * Copyright (c) 2015 VideoLAN. All rights reserved.
  5. * $Id$
  6. *
  7. * Authors: Felix Paul Kühne <fkuehne # videolan.org>
  8. *
  9. * Refer to the COPYING file of the official project for license.
  10. *****************************************************************************/
  11. #import "VLCCloudServicesTVViewController.h"
  12. #import <DropboxTVSDK/DropboxSDK.h>
  13. #import "VLCDropboxController.h"
  14. #import "VLCDropboxTableViewController.h"
  15. #import "SSKeychain.h"
  16. #import "VLCPlayerDisplayController.h"
  17. #import "VLCOneDriveController.h"
  18. #import "VLCOneDriveTableViewController2.h"
  19. #import "VLCBoxTableViewController.h"
  20. #import "VLCBoxController.h"
  21. @interface VLCCloudServicesTVViewController ()
  22. {
  23. VLCOneDriveController *_oneDriveController;
  24. VLCBoxController *_boxController;
  25. }
  26. @end
  27. @implementation VLCCloudServicesTVViewController
  28. - (void)viewDidLoad {
  29. [super viewDidLoad];
  30. self.helpLabel.textColor = [UIColor VLCLightTextColor];
  31. self.helpLabel.shadowColor = [UIColor VLCDarkTextShadowColor];
  32. self.helpLabel.text = NSLocalizedString(@"CLOUD_LOGIN_LONG", nil);
  33. [self.helpLabel sizeToFit];
  34. NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
  35. [center addObserver:self selector:@selector(oneDriveSessionUpdated:) name:VLCOneDriveControllerSessionUpdated object:nil];
  36. [center addObserver:self selector:@selector(boxSessionUpdated:) name:VLCBoxControllerSessionUpdated object:nil];
  37. _oneDriveController = [VLCOneDriveController sharedInstance];
  38. _boxController = [VLCBoxController sharedInstance];
  39. [_boxController startSession];
  40. self.dropboxButton.enabled = self.gDriveButton.enabled = NO;
  41. [self oneDriveSessionUpdated:nil];
  42. [self boxSessionUpdated:nil];
  43. [self performSelector:@selector(updateDropbox) withObject:nil afterDelay:0.1];
  44. }
  45. - (void)dealloc
  46. {
  47. [[NSNotificationCenter defaultCenter] removeObserver:self];
  48. }
  49. - (NSString *)title
  50. {
  51. return NSLocalizedString(@"CLOUD_SERVICES", nil);
  52. }
  53. - (IBAction)dropbox:(id)sender
  54. {
  55. VLCDropboxTableViewController *targetViewController = [[VLCDropboxTableViewController alloc] initWithPath:nil];
  56. [self.navigationController pushViewController:targetViewController animated:YES];
  57. }
  58. - (void)updateDropbox
  59. {
  60. self.dropboxButton.enabled = [[VLCDropboxController sharedInstance] restoreFromSharedCredentials];
  61. }
  62. - (void)oneDriveSessionUpdated:(NSNotification *)aNotification
  63. {
  64. self.oneDriveButton.enabled = _oneDriveController.activeSession;
  65. }
  66. - (void)boxSessionUpdated:(NSNotification *)aNotification
  67. {
  68. self.boxButton.enabled = YES;
  69. }
  70. - (IBAction)onedrive:(id)sender
  71. {
  72. VLCOneDriveTableViewController2 *newKid = [[VLCOneDriveTableViewController2 alloc] initWithOneDriveObject:nil];
  73. [self.navigationController pushViewController:newKid animated:YES];
  74. }
  75. - (IBAction)box:(id)sender
  76. {
  77. VLCBoxTableViewController *targetViewController = [[VLCBoxTableViewController alloc] initWithPath:@""];
  78. [self.navigationController pushViewController:targetViewController animated:YES];
  79. }
  80. - (IBAction)gdrive:(id)sender
  81. {
  82. // TODO
  83. }
  84. @end