|
@@ -30,6 +30,8 @@
|
|
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
|
_passcode = [defaults objectForKey:@"Passcode"];
|
|
|
|
|
|
+ self.enterPasscodeLabel.text = NSLocalizedString(@"ENTER_PASSCODE", @"");
|
|
|
+
|
|
|
[self.navigationController setNavigationBarHidden:YES animated:NO];
|
|
|
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
|
|
|
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;
|
|
@@ -48,8 +50,24 @@
|
|
|
- (IBAction)textFieldValueChanged:(id)sender
|
|
|
{
|
|
|
if (self.enterCodeField.text.length == 4) {
|
|
|
- if ([self.enterCodeField.text isEqualToString:_passcode]) {
|
|
|
- VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
|
|
|
+ VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
|
|
|
+ if (_resetStage == 1) {
|
|
|
+ _tmpPasscode = self.enterCodeField.text;
|
|
|
+ self.enterCodeField.text = @"";
|
|
|
+ self.enterPasscodeLabel.text = NSLocalizedString(@"REENTER_PASSCODE", @"");
|
|
|
+ _resetStage = 2;
|
|
|
+ } else if (_resetStage == 2) {
|
|
|
+ if ([self.enterCodeField.text isEqualToString:_tmpPasscode]) {
|
|
|
+ NSUserDefaults *defaults;
|
|
|
+ [defaults setObject:@1 forKey:@"PasscodeProtection"];
|
|
|
+ [defaults setObject:_tmpPasscode forKey:@"Passcode"];
|
|
|
+ _passcode = _tmpPasscode;
|
|
|
+ _resetStage = 0;
|
|
|
+ appDelegate.playlistViewController.nextPasscodeCheckDate = [NSDate dateWithTimeIntervalSinceNow:300]; // five min
|
|
|
+ appDelegate.playlistViewController.passcodeValidated = YES;
|
|
|
+ [self.view removeFromSuperview];
|
|
|
+ }
|
|
|
+ } else if ([self.enterCodeField.text isEqualToString:_passcode]) {
|
|
|
appDelegate.playlistViewController.nextPasscodeCheckDate = [NSDate dateWithTimeIntervalSinceNow:300]; // five min
|
|
|
appDelegate.playlistViewController.passcodeValidated = YES;
|
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|
@@ -59,7 +77,7 @@
|
|
|
|
|
|
- (void)resetPasscode
|
|
|
{
|
|
|
-
|
|
|
+ _resetStage = 1;
|
|
|
}
|
|
|
|
|
|
@end
|