123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- //
- // VLCSettingsViewController.m
- // VLC for iOS
- //
- // Created by Felix Paul Kühne on 19.05.13.
- // Copyright (c) 2013 VideoLAN. All rights reserved.
- //
- #import "VLCSettingsViewController.h"
- #import "VLCPlaylistViewController.h"
- #import "VLCPasscodeLockViewController.h"
- #import "VLCAppDelegate.h"
- @implementation VLCSettingsViewController
- - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- {
- self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
- return self;
- }
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- self.dismissButton.title = NSLocalizedString(@"BUTTON_DONE", @"");
- self.passcodeLockLabel.text = NSLocalizedString(@"PREF_PASSCODE", @"");
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- self.passcodeLockSwitch.on = [[defaults objectForKey:@"PasscodeProtection"] intValue];
- [super viewWillAppear:animated];
- }
- - (IBAction)togglePasscodeLockSetting:(id)sender
- {
- if (self.passcodeLockSwitch.on) {
- VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
- if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
- CGRect frame = self.view.frame;
- frame.size.height -= 44.;
- appDelegate.playlistViewController.passcodeLockViewController.view.frame = frame;
- }
- [self.view addSubview:appDelegate.playlistViewController.passcodeLockViewController.view];
- [appDelegate.playlistViewController.passcodeLockViewController resetPasscode];
- } else {
- NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- [defaults setObject:@0 forKey:@"PasscodeProtection"];
- [defaults synchronize];
- }
- }
- - (IBAction)dismiss:(id)sender
- {
- VLCAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
- [appDelegate.playlistViewController.navigationController dismissModalViewControllerAnimated:YES];
- }
- @end
|