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

Open Network Stream View: remember private switch state

parent 290912f3
......@@ -21,6 +21,7 @@
#define kVLCShowRemainingTime @"show-remaining-time"
#define kVLCRecentURLs @"recent-urls"
#define kVLCPrivateWebStreaming @"private-streaming"
#define kSupportedFileExtensions @"\\.(3gp|3gp|3gp2|3gpp|amv|asf|avi|axv|divx|dv|flv|f4v|gvi|gxf|m1v|m2p|m2t|m2ts|m2v|m4v|mks|mkv|moov|mov|mp2v|mp4|mpeg|mpeg1|mpeg2|mpeg4|mpg|mpv|mt2s|mts|mxf|nsv|nuv|oga|ogg|ogm|ogv|ogx|spx|ps|qt|rar|rec|rm|rmvb|tod|ts|tts|vob|vro|webm|wm|wmv|wtv|xesc)$"
#define kSupportedSubtitleFileExtensions @"\\.(cdg|idx|srt|sub|utf|ass|ssa|aqt|jss|psb|rt|smi|txt|smil)$"
......
......@@ -24,7 +24,7 @@
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *appDefaults = @{kVLCRecentURLs : @[]};
NSDictionary *appDefaults = @{kVLCRecentURLs : @[], kVLCPrivateWebStreaming : @(NO)};
[defaults registerDefaults:appDefaults];
}
......@@ -48,11 +48,23 @@
self.urlField.text = [pasteURL absoluteString];
}
_recentURLs = [NSMutableArray arrayWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:kVLCRecentURLs]];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
_recentURLs = [NSMutableArray arrayWithArray:[defaults objectForKey:kVLCRecentURLs]];
self.privateToggleSwitch.on = [defaults boolForKey:kVLCPrivateWebStreaming];
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[NSArray arrayWithArray:_recentURLs] forKey:kVLCRecentURLs];
[defaults setBool:self.privateToggleSwitch.on forKey:kVLCPrivateWebStreaming];
[defaults synchronize];
[super viewWillDisappear:animated];
}
- (CGSize)contentSizeForViewInPopover {
return [self.view sizeThatFits:CGSizeMake(320, 800)];
}
......@@ -129,10 +141,6 @@
#pragma mark - internals
- (void)_openURLStringAndDismiss:(NSString *)url
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[NSArray arrayWithArray:_recentURLs] forKey:kVLCRecentURLs];
[defaults synchronize];
VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
[appDelegate.playlistViewController openMovieFromURL:[NSURL URLWithString:url]];
......
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