123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- //
- // JZLogginWindowManager.m
- // JIZHANG
- //
- // Created by kuxuan on 2017/12/25.
- // Copyright © 2017年 kuxuan. All rights reserved.
- //
- #import "JZLogginWindowManager.h"
- #import "JZGestureLogginController.h"
- #import "JZTouchIDTool.h"
- #import "JZNavigationViewController.h"
- @interface JZLogginWindowManager ()
- @end
- @implementation JZLogginWindowManager
- + (instancetype)sharedManager{
- static JZLogginWindowManager *manager;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- manager = [[self alloc]init];
- });
- return manager;
- }
- - (instancetype)init{
- if (self = [super init]) {
- self.isShow = NO;
- [self setupWindow];
- [self setupNotification];
- }
- return self;
- }
- - (void)setupWindow{
- self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
- self.window.windowLevel = UIWindowLevelAlert;
- self.window.backgroundColor = [UIColor redColor];
- JZGestureLogginController *loggin = [[JZGestureLogginController alloc]init];
-
- self.window.rootViewController = [[JZNavigationViewController alloc]initWithRootViewController:loggin];
- [self.window makeKeyAndVisible];
- self.window.hidden = YES;
- loggin.windowManager = self;
- }
- - (void)show{
- self.isShow = YES;
- [self showTouchId];
- self.window.hidden = NO;
- }
- - (void)showTouchId{
- if ([JZTouchIDTool isOpenTouchID]) {
- [JZTouchIDTool validateTouchID];
- }
- }
- - (void)hide{
- self.isShow = NO;
- self.window.hidden = YES;
- }
- - (void)setupNotification {
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(actionDidReceiveValidateTouchIDSuccess) name:JZValidateTouchIDSuccess object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(actionDidReceiveValidateTouchIDFailure) name:JZValidateTouchIDFailure object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(actionDidReceiveValidateTouchIDCancel) name:JZValidateTouchIDCancel object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(actionDidReceiveValidateTouchIDUserFallback) name:JZValidateTouchIDUserFallback object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(actionDidReceiveValidatePasscodeNotSet) name:JZValidateTouchIDPasscodeNotSet object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(actionDidReceiveValidateTouchIDNotAvailable) name:JZValidateTouchIDNotAvailable object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(actionDidReceiveValidateTouchIDNotEnrolled) name:JZValidateTouchIDNotEnrolled object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(actionDidReceiveTouchIDLockout) name:JZValidateTouchIDLockout object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(actionDidReceiveTouchIDInvalidContext) name:JZValidateTouchIDInvalidContext object:nil];
- }
- - (void)actionDidReceiveValidateTouchIDSuccess {
- NSLog(@"%s",__func__);
- [self hide];
- }
- - (void)actionDidReceiveValidateTouchIDFailure {
- NSLog(@"%s",__func__);
- }
- - (void)actionDidReceiveValidateTouchIDCancel {
- NSLog(@"%s",__func__);
- }
- - (void)actionDidReceiveValidateTouchIDUserFallback {
- NSLog(@"%s",__func__);
- }
- - (void)actionDidReceiveValidatePasscodeNotSet {
- NSLog(@"%s",__func__);
- }
- - (void)actionDidReceiveValidateTouchIDNotAvailable {
- NSLog(@"%s",__func__);
- }
- - (void)actionDidReceiveValidateTouchIDNotEnrolled {
- NSLog(@"%s",__func__);
- }
- - (void)actionDidReceiveTouchIDLockout {
- NSLog(@"%s",__func__);
- }
- - (void)actionDidReceiveTouchIDInvalidContext {
- NSLog(@"%s",__func__);
- }
- @end
|