Commit bcb8a9bb authored by Gleb Pinigin's avatar Gleb Pinigin

Use boolean literals for settings options

parent 51658bd1
......@@ -24,7 +24,7 @@
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *appDefaults = @{kVLCSettingPasscodeKey : @"", kVLCSettingPasscodeOnKey : @0, kVLCSettingContinueAudioInBackgroundKey : @1, kVLCSettingStretchAudio : kVLCSettingStretchAudioDefaultValue, kVLCSettingVerboseOutput : kVLCSettingVerboseOutputDefaultValue, kVLCSettingTextEncoding : kVLCSettingTextEncodingDefaultValue};
NSDictionary *appDefaults = @{kVLCSettingPasscodeKey : @"", kVLCSettingPasscodeOnKey : @(NO), kVLCSettingContinueAudioInBackgroundKey : @(YES), kVLCSettingStretchAudio : kVLCSettingStretchAudioDefaultValue, kVLCSettingVerboseOutput : kVLCSettingVerboseOutputDefaultValue, kVLCSettingTextEncoding : kVLCSettingTextEncodingDefaultValue};
[defaults registerDefaults:appDefaults];
}
......
......@@ -540,7 +540,7 @@
if (self.mediaItem)
self.mediaItem.lastPosition = @([_mediaPlayer position]);
if (![[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingContinueAudioInBackgroundKey] intValue]) {
if (![[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingContinueAudioInBackgroundKey] boolValue]) {
[_mediaPlayer pause];
_shouldResumePlaying = YES;
} else
......
......@@ -48,8 +48,8 @@
- (void)viewWillAppear:(BOOL)animated
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
self.passcodeLockSwitch.on = [[defaults objectForKey:kVLCSettingPasscodeOnKey] intValue];
self.audioPlaybackInBackgroundSwitch.on = [[defaults objectForKey:kVLCSettingContinueAudioInBackgroundKey] intValue];
self.passcodeLockSwitch.on = [[defaults objectForKey:kVLCSettingPasscodeOnKey] boolValue];
self.audioPlaybackInBackgroundSwitch.on = [[defaults objectForKey:kVLCSettingContinueAudioInBackgroundKey] boolValue];
self.audioStretchingSwitch.on = ![[defaults objectForKey:kVLCSettingStretchAudio] isEqualToString:kVLCSettingStretchAudioDefaultValue];
self.debugOutputSwitch.on = [[defaults objectForKey:kVLCSettingVerboseOutput] isEqualToString:kVLCSettingVerboseOutputDefaultValue];
......@@ -71,7 +71,7 @@
passcodeLockController.delegate = self;
[self presentModalViewController:passcodeLockController animated:YES];
} else {
[defaults setObject:@0 forKey:kVLCSettingPasscodeOnKey];
[defaults setObject:@(NO) forKey:kVLCSettingPasscodeOnKey];
}
} else if (sender == self.audioPlaybackInBackgroundSwitch) {
[defaults setObject:@(self.audioPlaybackInBackgroundSwitch.on) forKey:kVLCSettingContinueAudioInBackgroundKey];
......@@ -131,7 +131,7 @@
- (void)PAPasscodeViewControllerDidSetPasscode:(PAPasscodeViewController *)controller
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:@(1) forKey:kVLCSettingPasscodeOnKey];
[defaults setObject:@(YES) forKey:kVLCSettingPasscodeOnKey];
[defaults setObject:controller.passcode forKey:kVLCSettingPasscodeKey];
[defaults synchronize];
VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
......
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