Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLC-iOS
Commits
59b5684c
Commit
59b5684c
authored
Dec 09, 2015
by
Felix Paul Kühne
Browse files
web socket: add received URLs to ubiquitous key store
parent
244ac26b
Changes
1
Hide whitespace changes
Inline
Side-by-side
SharedSources/VLCPlayerControlWebSocket.m
View file @
59b5684c
...
...
@@ -324,7 +324,7 @@
"url": "https://vimeo.com/74370512"
}
*/
BOOL
needsMediaList
;
BOOL
needsMediaList
=
NO
;
VLCPlaybackController
*
vpc
=
[
VLCPlaybackController
sharedInstance
];
VLCMediaList
*
mediaList
=
vpc
.
mediaList
;
...
...
@@ -333,7 +333,29 @@
mediaList
=
[[
VLCMediaList
alloc
]
init
];
}
[
mediaList
addMedia
:[
VLCMedia
mediaWithURL
:[
NSURL
URLWithString
:
dictionary
[
@"url"
]]]];
NSString
*
urlString
=
dictionary
[
@"url"
];
if
(
urlString
==
nil
||
urlString
.
length
==
0
)
return
;
/* force store update */
NSUbiquitousKeyValueStore
*
ubiquitousKeyValueStore
=
[
NSUbiquitousKeyValueStore
defaultStore
];
[
ubiquitousKeyValueStore
synchronize
];
/* fetch data from cloud */
NSMutableArray
*
recentURLs
=
[
NSMutableArray
arrayWithArray
:[
ubiquitousKeyValueStore
arrayForKey
:
kVLCRecentURLs
]];
/* re-order array and add item */
if
([
recentURLs
indexOfObject
:
urlString
]
!=
NSNotFound
)
[
recentURLs
removeObject
:
urlString
];
if
(
recentURLs
.
count
>=
100
)
[
recentURLs
removeLastObject
];
[
recentURLs
addObject
:
urlString
];
/* sync back */
[
ubiquitousKeyValueStore
setArray
:
recentURLs
forKey
:
kVLCRecentURLs
];
[
mediaList
addMedia
:[
VLCMedia
mediaWithURL
:[
NSURL
URLWithString
:
urlString
]]];
if
(
needsMediaList
)
{
[
vpc
playMediaList
:
mediaList
firstIndex
:
0
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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