Browse Source

Correctly activate Passcode lock after time-out (close #9252)

Felix Paul Kühne 12 years ago
parent
commit
2041f52b5f
1 changed files with 5 additions and 6 deletions
  1. 5 6
      AspenProject/VLCAppDelegate.m

+ 5 - 6
AspenProject/VLCAppDelegate.m

@@ -20,6 +20,8 @@
 #import "VLCHTTPUploaderController.h"
 #import "VLCMenuTableViewController.h"
 
+#define PASSCODE_CHECK_INTERVAL 300
+
 @interface VLCAppDelegate () <PAPasscodeViewControllerDelegate, VLCMediaFileDiscovererDelegate> {
     PAPasscodeViewController *_passcodeLockController;
     VLCDropboxTableViewController *_dropboxTableViewController;
@@ -140,10 +142,12 @@
 - (void)applicationWillEnterForeground:(UIApplication *)application
 {
     [[MLMediaLibrary sharedMediaLibrary] applicationWillStart];
+    [self validatePasscode];
 }
 
 - (void)applicationWillResignActive:(UIApplication *)application
 {
+    self.nextPasscodeCheckDate = [NSDate dateWithTimeIntervalSinceNow:PASSCODE_CHECK_INTERVAL];
     [[MLMediaLibrary sharedMediaLibrary] applicationWillExit];
 }
 
@@ -153,11 +157,6 @@
     [self updateMediaList];
 }
 
-- (void)applicationDidEnterBackground:(UIApplication *)application
-{
-    [self validatePasscode]; // Lock library when going to background
-}
-
 - (void)applicationWillTerminate:(UIApplication *)application
 {
     [[NSUserDefaults standardUserDefaults] synchronize];
@@ -264,7 +263,7 @@
 - (void)PAPasscodeViewControllerDidEnterPasscode:(PAPasscodeViewController *)controller
 {
     // TODO add transition animation, i.e. fade
-    self.nextPasscodeCheckDate = [NSDate dateWithTimeIntervalSinceNow:300];
+    self.nextPasscodeCheckDate = [NSDate dateWithTimeIntervalSinceNow:PASSCODE_CHECK_INTERVAL];
     self.window.rootViewController = self.revealController;
 }