Sfoglia il codice sorgente

Use boolean literals for settings options

Gleb Pinigin 12 anni fa
parent
commit
bcb8a9bbe8

+ 1 - 1
AspenProject/VLCAppDelegate.m

@@ -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];
 }

+ 1 - 1
AspenProject/VLCMovieViewController.m

@@ -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

+ 4 - 4
AspenProject/VLCSettingsViewController.m

@@ -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;