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

dropbox controller: added support to share credentials

parent 367a6699
......@@ -86,6 +86,7 @@
#endif
#define kVLCStoredServerList @"kVLCStoredServerList"
#define kVLCStoreDropboxCredentials @"kVLCStoreDropboxCredentials"
#define kVLCUserActivityPlaying @"org.videolan.vlc-ios.playing"
#define kVLCUserActivityLibrarySelection @"org.videolan.vlc-ios.libraryselection"
......
......@@ -23,6 +23,9 @@
+ (instancetype)sharedInstance;
- (void)shareCredentials;
- (BOOL)restoreFromSharedCredentials;
- (void)downloadFileToDocumentFolder:(DBMetadata *)file;
- (void)streamFile:(DBMetadata *)file;
......
......@@ -20,6 +20,7 @@
#import "VLCActivityManager.h"
#import "VLCMediaFileDiscoverer.h"
#endif
#import "DBKeychain.h"
@interface VLCDropboxController ()
{
......@@ -50,11 +51,36 @@
dispatch_once(&pred, ^{
sharedInstance = [VLCDropboxController new];
[sharedInstance shareCredentials];
});
return sharedInstance;
}
- (void)shareCredentials
{
/* share our credentials */
NSDictionary *credentials = [DBKeychain credentials];
if (credentials == nil)
return;
NSUbiquitousKeyValueStore *ubiquitousStore = [NSUbiquitousKeyValueStore defaultStore];
[ubiquitousStore setDictionary:credentials forKey:kVLCStoreDropboxCredentials];
[ubiquitousStore synchronize];
}
- (BOOL)restoreFromSharedCredentials
{
NSUbiquitousKeyValueStore *ubiquitousStore = [NSUbiquitousKeyValueStore defaultStore];
[ubiquitousStore synchronize];
NSDictionary *credentials = [ubiquitousStore dictionaryForKey:kVLCStoreDropboxCredentials];
if (!credentials)
return NO;
[DBKeychain setCredentials:credentials];
return YES;
}
- (void)startSession
{
[[DBSession sharedSession] isLinked];
......@@ -139,7 +165,8 @@
return NO;
}
- (void)restClient:(DBRestClient *)client loadedMetadata:(DBMetadata *)metadata {
- (void)restClient:(DBRestClient *)client loadedMetadata:(DBMetadata *)metadata
{
NSMutableArray *listOfGoodFilesAndFolders = [[NSMutableArray alloc] init];
if (metadata.isDirectory) {
......
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