From f14c4662cb1bf868c3c58b0ad97a162d954deef6 Mon Sep 17 00:00:00 2001 From: Bob Sun Date: Tue, 7 Feb 2017 20:57:06 +0800 Subject: [PATCH] fix bugs of the passcode function --- pass/AppDelegate.swift | 6 ++++-- pass/Base.lproj/Main.storyboard | 4 ++-- pass/PasscodeLockConfiguration.swift | 3 ++- pass/PasscodeLockRepository.swift | 2 -- pass/PasswordsViewController.swift | 8 ++++++-- pass/SettingsTableViewController.swift | 12 ++++++++---- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/pass/AppDelegate.swift b/pass/AppDelegate.swift index d5ec4bd..ff28f94 100644 --- a/pass/AppDelegate.swift +++ b/pass/AppDelegate.swift @@ -24,13 +24,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func applicationWillResignActive(_ application: UIApplication) { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. - let passcodeEnterViewController = PasscodeLockViewController(state: .enter, configuration: Globals.shared.passcodeConfiguration) - UIApplication.shared.keyWindow?.rootViewController?.present(passcodeEnterViewController, animated: true, completion: nil) } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + if PasscodeLockRepository().hasPasscode { + let passcodeEnterViewController = PasscodeLockViewController(state: .enter, configuration: Globals.shared.passcodeConfiguration) + UIApplication.shared.keyWindow?.rootViewController?.present(passcodeEnterViewController, animated: true, completion: nil) + } } func applicationWillEnterForeground(_ application: UIApplication) { diff --git a/pass/Base.lproj/Main.storyboard b/pass/Base.lproj/Main.storyboard index 7989849..2354951 100644 --- a/pass/Base.lproj/Main.storyboard +++ b/pass/Base.lproj/Main.storyboard @@ -164,8 +164,8 @@ -