-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathViewController.m
executable file
·76 lines (60 loc) · 2.08 KB
/
ViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// ViewController.m
//
// Created by Tenfay on 2017/7/21.
// Copyright © 2017 Tenfay. All rights reserved.
//
#import "ViewController.h"
#import "DYFAppLock.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @"App Lock";
self.view.backgroundColor = [UIColor whiteColor];
}
- (IBAction)settingsAction:(id)sender {
static BOOL pushOrPresent = YES;
DYFAuthIDAndGestureLockSettingsController *vc = [[DYFAuthIDAndGestureLockSettingsController alloc] init];
if (pushOrPresent) {
[self.navigationController pushViewController:vc animated:YES];
} else {
// When presents view controller, please add navigation controller.
UINavigationController *nc = [[UINavigationController alloc] initWithRootViewController:vc];
[self presentViewController:nc animated:YES completion:NULL];
}
pushOrPresent = !pushOrPresent;
}
- (IBAction)validationAction:(UIButton *)sender {
[self executeAuthentication];
}
- (void)executeAuthentication {
BOOL isAuthIDOpen = [DYFSecurityHelper authIDOpen];
BOOL isGestureCodeOpen = [DYFSecurityHelper gestureCodeOpen];
if (!isAuthIDOpen && !isGestureCodeOpen) {
return;
}
DYFAuthenticationType type = DYFAuthenticationTypeGesture;
if (isAuthIDOpen) {
type = DYFAuthenticationTypeAuthID;
}
DYFAuthenticationView *authView = [[DYFAuthenticationView alloc] initWithFrame:[UIScreen mainScreen].bounds authenticationType:type];
authView.avatarImage = [UIImage imageNamed:@"cat49334.jpg"];
[authView show];
[authView authenticateWithCompletion:^(BOOL success) {
if (success) {
// 进行相应的操作
NSLog(@"验证成功");
}
}];
[authView loginOtherAccountWithCompletion:^{
// 进行其他账户登录操作
NSLog(@"登录其他账户");
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end