Blurring app screen in switch mode
Blur app screen and add the Pass icon in the middle.
This commit is contained in:
parent
0f975882ee
commit
62db5da62f
1 changed files with 26 additions and 0 deletions
|
|
@ -15,6 +15,9 @@ import SVProgressHUD
|
||||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
|
|
||||||
var window: UIWindow?
|
var window: UIWindow?
|
||||||
|
enum ViewTag: Int {
|
||||||
|
case blur = 100, appicon
|
||||||
|
}
|
||||||
|
|
||||||
lazy var passcodeLockPresenter: PasscodeLockPresenter = {
|
lazy var passcodeLockPresenter: PasscodeLockPresenter = {
|
||||||
let presenter = PasscodeLockPresenter(mainWindow: self.window, configuration: Globals.passcodeConfiguration)
|
let presenter = PasscodeLockPresenter(mainWindow: self.window, configuration: Globals.passcodeConfiguration)
|
||||||
|
|
@ -50,6 +53,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
func applicationWillResignActive(_ application: UIApplication) {
|
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.
|
// 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.
|
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
|
||||||
|
|
||||||
|
// Display a blur effect view
|
||||||
|
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.light)
|
||||||
|
let blurEffectView = UIVisualEffectView(effect: blurEffect)
|
||||||
|
blurEffectView.frame = (self.window?.frame)!
|
||||||
|
blurEffectView.tag = ViewTag.blur.rawValue
|
||||||
|
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
||||||
|
self.window?.addSubview(blurEffectView)
|
||||||
|
|
||||||
|
// Display the Pass icon in the middle of the screen
|
||||||
|
let iconsDictionary = Bundle.main.infoDictionary?["CFBundleIcons"] as? NSDictionary
|
||||||
|
let primaryIconsDictionary = iconsDictionary?["CFBundlePrimaryIcon"] as? NSDictionary
|
||||||
|
let iconFiles = primaryIconsDictionary!["CFBundleIconFiles"] as! NSArray
|
||||||
|
let appIcon = UIImage(named: iconFiles.lastObject as! String)
|
||||||
|
let appIconView = UIImageView(image: appIcon)
|
||||||
|
appIconView.layer.cornerRadius = (appIcon?.size.height)! / 5
|
||||||
|
appIconView.layer.masksToBounds = true
|
||||||
|
appIconView.center = (self.window?.center)!
|
||||||
|
appIconView.tag = ViewTag.appicon.rawValue
|
||||||
|
self.window?.addSubview(appIconView)
|
||||||
}
|
}
|
||||||
|
|
||||||
func applicationDidEnterBackground(_ application: UIApplication) {
|
func applicationDidEnterBackground(_ application: UIApplication) {
|
||||||
|
|
@ -64,6 +87,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||||
|
|
||||||
func applicationDidBecomeActive(_ application: UIApplication) {
|
func applicationDidBecomeActive(_ application: UIApplication) {
|
||||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||||
|
|
||||||
|
self.window?.viewWithTag(ViewTag.appicon.rawValue)?.removeFromSuperview()
|
||||||
|
self.window?.viewWithTag(ViewTag.blur.rawValue)?.removeFromSuperview()
|
||||||
}
|
}
|
||||||
|
|
||||||
func applicationWillTerminate(_ application: UIApplication) {
|
func applicationWillTerminate(_ application: UIApplication) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue