Commit 060db6e8 authored by Felix Paul Kühne's avatar Felix Paul Kühne

box controller: add token sharing

parent 393327cb
......@@ -58,6 +58,11 @@
[BoxSDK sharedSDK].OAuth2Session.clientID = kVLCBoxClientID;
[BoxSDK sharedSDK].OAuth2Session.clientSecret = kVLCBoxClientSecret;
NSString *token = [SSKeychain passwordForService:kVLCBoxService account:kVLCBoxAccount];
if (!token) {
NSUbiquitousKeyValueStore *ubiquitousStore = [NSUbiquitousKeyValueStore defaultStore];
[ubiquitousStore synchronize];
token = [ubiquitousStore stringForKey:kVLCStoreBoxCredentials];
}
if (token != nil) {
[BoxSDK sharedSDK].OAuth2Session.refreshToken = token;
}
......@@ -74,6 +79,9 @@
{
[SSKeychain deletePasswordForService:kVLCBoxService account:kVLCBoxAccount];
[[BoxSDK sharedSDK].OAuth2Session logout];
NSUbiquitousKeyValueStore *ubiquitousStore = [NSUbiquitousKeyValueStore defaultStore];
[ubiquitousStore setString:nil forKey:kVLCStoreBoxCredentials];
[ubiquitousStore synchronize];
[self stopSession];
if ([self.delegate respondsToSelector:@selector(mediaListUpdated)])
[self.delegate mediaListUpdated];
......
......@@ -188,6 +188,9 @@
{
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;
......
......@@ -88,6 +88,7 @@
#define kVLCStoredServerList @"kVLCStoredServerList"
#define kVLCStoreDropboxCredentials @"kVLCStoreDropboxCredentials"
#define kVLCStoreOneDriveCredentials @"kVLCStoreOneDriveCredentials"
#define kVLCStoreBoxCredentials @"kVLCStoreBoxCredentials"
#define kVLCUserActivityPlaying @"org.videolan.vlc-ios.playing"
#define kVLCUserActivityLibrarySelection @"org.videolan.vlc-ios.libraryselection"
......
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