1- #import " ../../modules/JGProgressHUD/JGProgressHUD.h"
2- #import " ../InstagramHeaders.h"
31#import " SecurityViewController.h"
42
53@implementation SCISecurityViewController
64
7- - (void )viewDidLoad {
8- [super viewDidLoad ];
9-
5+ - (id )init {
6+ self = [super init ];
7+ if (!self) return nil ;
8+
9+ [[NSNotificationCenter defaultCenter ] addObserver: self
10+ selector: @selector (authenticate )
11+ name: UIApplicationWillEnterForegroundNotification
12+ object: [UIApplication sharedApplication ]
13+ ];
14+
15+ return self;
16+ }
17+ - (void )dealloc {
18+ [[NSNotificationCenter defaultCenter ] removeObserver: self ];
19+ }
20+
21+ - (void )viewDidLoad {
1022 UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle: UIBlurEffectStyleDark];
1123 UIVisualEffectView *blurView = [[UIVisualEffectView alloc ] initWithEffect: blurEffect];
1224 blurView.frame = self.view .bounds ;
@@ -15,16 +27,12 @@ - (void)viewDidLoad {
1527 UIButton *authenticateButton = [[UIButton alloc ] initWithFrame: CGRectMake (20 , 20 , 200 , 60 )];
1628 [authenticateButton setTitle: @" Click to unlock app" forState: UIControlStateNormal];
1729 authenticateButton.center = self.view .center ;
18- [authenticateButton addTarget: self action: @selector (authenticateButtonTapped: ) forControlEvents: UIControlEventTouchUpInside];
30+ [authenticateButton addTarget: self action: @selector (authenticate ) forControlEvents: UIControlEventTouchUpInside];
1931 [self .view addSubview: authenticateButton];
2032
2133 [self authenticate ];
2234}
2335
24- - (void )authenticateButtonTapped : (id )sender {
25- [self authenticate ];
26- }
27-
2836- (void )authenticate {
2937 LAContext *context = [[LAContext alloc ] init ];
3038 NSError *error = nil ;
@@ -39,6 +47,8 @@ - (void)authenticate {
3947 if (success) {
4048 [self dismissViewControllerAnimated: YES completion: nil ];
4149
50+ isAuthenticationBeingShown = NO ;
51+
4252 NSLog (@" [SCInsta] Padlock authentication: Unlock success" );
4353 }
4454 else {
0 commit comments