Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLC-iOS
Commits
d378ffc6
Commit
d378ffc6
authored
Oct 22, 2015
by
Felix Paul Kühne
Browse files
onedrive controller: implement credentials sharing
parent
01315ddf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Sources/VLCConstants.h
View file @
d378ffc6
...
...
@@ -87,6 +87,7 @@
#define kVLCStoredServerList @"kVLCStoredServerList"
#define kVLCStoreDropboxCredentials @"kVLCStoreDropboxCredentials"
#define kVLCStoreOneDriveCredentials @"kVLCStoreOneDriveCredentials"
#define kVLCUserActivityPlaying @"org.videolan.vlc-ios.playing"
#define kVLCUserActivityLibrarySelection @"org.videolan.vlc-ios.libraryselection"
...
...
Sources/VLCOneDriveController.m
View file @
d378ffc6
...
...
@@ -19,6 +19,7 @@
/* include private API headers */
#import "LiveApiHelper.h"
#import "LiveAuthStorage.h"
@interface
VLCOneDriveController
()
<
LiveAuthDelegate
,
VLCOneDriveObjectDelegate
,
VLCOneDriveObjectDownloadDelegate
>
{
...
...
@@ -60,6 +61,8 @@
if
(
!
self
)
return
self
;
[
self
restoreFromSharedCredentials
];
_liveScopes
=
@[
@"wl.signin"
,
@"wl.offline_access"
,
@"wl.skydrive"
];
_liveClient
=
[[
LiveConnectClient
alloc
]
initWithClientId
:
kVLCOneDriveClientID
...
...
@@ -128,6 +131,8 @@
[
self
.
delegate
performSelector
:
@selector
(
sessionWasUpdated
)];
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
VLCOneDriveControllerSessionUpdated
object
:
self
];
[
self
shareCredentials
];
}
-
(
void
)
authFailed
:(
NSError
*
)
error
userState
:(
id
)
userState
...
...
@@ -144,6 +149,32 @@
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
VLCOneDriveControllerSessionUpdated
object
:
self
];
}
-
(
void
)
shareCredentials
{
/* share our credentials */
LiveAuthStorage
*
authStorage
=
[[
LiveAuthStorage
alloc
]
initWithClientId
:
kVLCOneDriveClientID
];
NSString
*
credentials
=
[
authStorage
refreshToken
];
if
(
credentials
==
nil
)
return
;
NSUbiquitousKeyValueStore
*
ubiquitousStore
=
[
NSUbiquitousKeyValueStore
defaultStore
];
[
ubiquitousStore
setString
:
credentials
forKey
:
kVLCStoreOneDriveCredentials
];
[
ubiquitousStore
synchronize
];
}
-
(
BOOL
)
restoreFromSharedCredentials
{
LiveAuthStorage
*
authStorage
=
[[
LiveAuthStorage
alloc
]
initWithClientId
:
kVLCOneDriveClientID
];
NSUbiquitousKeyValueStore
*
ubiquitousStore
=
[
NSUbiquitousKeyValueStore
defaultStore
];
[
ubiquitousStore
synchronize
];
NSString
*
credentials
=
[
ubiquitousStore
stringForKey
:
kVLCStoreOneDriveCredentials
];
if
(
!
credentials
)
return
NO
;
[
authStorage
setRefreshToken
:
credentials
];
return
YES
;
}
-
(
void
)
liveOperationSucceeded
:(
LiveDownloadOperation
*
)
operation
{
APLog
(
@"ODC: liveOperationSucceeded (%@)"
,
operation
.
userState
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment