From 9712c2994b0f13d4ba9fe232de827105cf09c24f Mon Sep 17 00:00:00 2001 From: Roman Slysh Date: Thu, 18 Oct 2018 18:06:19 +0300 Subject: [PATCH 1/4] Fix bug showing biometric button in PIN change flow. --- Example/PLPinViewController.xcodeproj/project.pbxproj | 4 ++-- PLPinViewController/Classes/PLPinViewController.h | 1 - PLPinViewController/Classes/PLPinViewController.m | 11 +++++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Example/PLPinViewController.xcodeproj/project.pbxproj b/Example/PLPinViewController.xcodeproj/project.pbxproj index a0fc369..39b330d 100644 --- a/Example/PLPinViewController.xcodeproj/project.pbxproj +++ b/Example/PLPinViewController.xcodeproj/project.pbxproj @@ -550,7 +550,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = UN3QZ52HAF; + DEVELOPMENT_TEAM = 7969TG2NRZ; GCC_PRECOMPILE_PREFIX_HEADER = YES; INFOPLIST_FILE = "PLPinViewController/PLPinViewController-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; @@ -571,7 +571,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_ENABLE_MODULES = YES; - DEVELOPMENT_TEAM = UN3QZ52HAF; + DEVELOPMENT_TEAM = 7969TG2NRZ; GCC_PRECOMPILE_PREFIX_HEADER = YES; INFOPLIST_FILE = "PLPinViewController/PLPinViewController-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 9.0; diff --git a/PLPinViewController/Classes/PLPinViewController.h b/PLPinViewController/Classes/PLPinViewController.h index b92aece..05d6f09 100644 --- a/PLPinViewController/Classes/PLPinViewController.h +++ b/PLPinViewController/Classes/PLPinViewController.h @@ -36,7 +36,6 @@ typedef NS_ENUM(NSInteger, PLPinViewControllerAction) { @property (weak) id pinDelegate; @property (nonatomic, assign) BOOL enableCancel; @property (nonatomic, assign) NSInteger pinLength; -@property (nonatomic, assign) BOOL enableBiometric; + (void)showControllerWithAction:(PLPinViewControllerAction)action enableCancel:(BOOL)enableCancel pinLength:(NSInteger)pinLength delegate:(id)delegate animated:(BOOL)animated biometric:(BOOL)biometric; diff --git a/PLPinViewController/Classes/PLPinViewController.m b/PLPinViewController/Classes/PLPinViewController.m index cd6fd74..ed3a352 100644 --- a/PLPinViewController/Classes/PLPinViewController.m +++ b/PLPinViewController/Classes/PLPinViewController.m @@ -42,7 +42,6 @@ + (void)showControllerWithAction:(PLPinViewControllerAction)action enableCancel: vc.pinDelegate = delegate; vc.enableCancel = enableCancel; vc.pinLength = pinLength; - vc.enableBiometric = biometric; switch (action) { case PLPinViewControllerActionCreate: @@ -58,12 +57,14 @@ + (void)showControllerWithAction:(PLPinViewControllerAction)action enableCancel: default: break; } - + if (vc.initialIdentifier && [vc isViewLoaded] && vc.view.window) { [vc performSegueWithIdentifier:vc.initialIdentifier sender:nil]; } [[PLPinWindow defaultInstance] showAnimated:animated]; + + [vc setupBiometric:biometric]; } +(void)dismiss @@ -75,7 +76,6 @@ - (void)viewDidLoad { [super viewDidLoad]; self.currentPin = [[NSMutableString alloc] init]; - [self setupBiometric]; [self setupAppearance]; if (self.initialIdentifier) @@ -87,7 +87,6 @@ - (void)viewDidLoad { [self performSegueWithIdentifier:@"showEnterPin" sender:nil]; } - - (UIStatusBarStyle)preferredStatusBarStyle { return [[PLPinWindow defaultInstance].pinAppearance statusBarStyle]; @@ -133,8 +132,8 @@ -(void)setupAppearance [self.biometricButton setTintColor:appearance.biometricButtonColor]; } --(void)setupBiometric { - if (self.enableBiometric) { +-(void)setupBiometric:(Boolean)enabled { + if (enabled) { LAContext *context = [[LAContext alloc] init]; if ([context canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil]) { if (@available(iOS 11.0, *)) { From 00b15068cc9fb570fd126689f601d6507af19317 Mon Sep 17 00:00:00 2001 From: Roman Slysh Date: Fri, 19 Oct 2018 11:07:36 +0300 Subject: [PATCH 2/4] Add missed Cancel title in Alert. --- PLPinViewController/Classes/PLEnterPinViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PLPinViewController/Classes/PLEnterPinViewController.m b/PLPinViewController/Classes/PLEnterPinViewController.m index 0cee091..c614a36 100644 --- a/PLPinViewController/Classes/PLEnterPinViewController.m +++ b/PLPinViewController/Classes/PLEnterPinViewController.m @@ -140,7 +140,7 @@ - (IBAction)logoutPressed:(id)sender { preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *cancelAction = [UIAlertAction - actionWithTitle:NSLocalizedString(@"", @"Cancel action") + actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel action") style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { From 7ddd0133cd26879608e38df22e3c766d7517f939 Mon Sep 17 00:00:00 2001 From: Roman Slysh Date: Fri, 2 Nov 2018 14:27:47 +0200 Subject: [PATCH 3/4] pinViewControllerDidShow added to the protocol. --- PLPinViewController/Classes/PLPinViewController.h | 2 +- PLPinViewController/Classes/PLPinViewController.m | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/PLPinViewController/Classes/PLPinViewController.h b/PLPinViewController/Classes/PLPinViewController.h index 05d6f09..81d3505 100644 --- a/PLPinViewController/Classes/PLPinViewController.h +++ b/PLPinViewController/Classes/PLPinViewController.h @@ -20,7 +20,7 @@ typedef NS_ENUM(NSInteger, PLPinViewControllerAction) { @protocol PLPinViewControllerDelegate @optional - +- (void)pinViewControllerDidShow:(PLPinViewController *)controller isBiometricEnabled:(BOOL)enabled; - (void)pinViewControllerDidCancel:(PLPinViewController *)controller; - (void)pinViewControllerDidLogout:(PLPinViewController *)controller; - (void)pinViewController:(PLPinViewController *)controller didChangePin:(NSString*)pin; diff --git a/PLPinViewController/Classes/PLPinViewController.m b/PLPinViewController/Classes/PLPinViewController.m index ed3a352..ac7697c 100644 --- a/PLPinViewController/Classes/PLPinViewController.m +++ b/PLPinViewController/Classes/PLPinViewController.m @@ -87,6 +87,12 @@ - (void)viewDidLoad { [self performSegueWithIdentifier:@"showEnterPin" sender:nil]; } +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + + [self.pinDelegate pinViewControllerDidShow:self isBiometricEnabled:!self.biometricButton.hidden]; +} + - (UIStatusBarStyle)preferredStatusBarStyle { return [[PLPinWindow defaultInstance].pinAppearance statusBarStyle]; From de4520ce9275e8b323c0c65529b766ea8872bd84 Mon Sep 17 00:00:00 2001 From: Roman Slysh Date: Tue, 6 Nov 2018 17:29:22 +0200 Subject: [PATCH 4/4] add public action property. --- PLPinViewController/Classes/PLPinViewController.h | 2 +- PLPinViewController/Classes/PLPinViewController.m | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/PLPinViewController/Classes/PLPinViewController.h b/PLPinViewController/Classes/PLPinViewController.h index 81d3505..a9ee5ff 100644 --- a/PLPinViewController/Classes/PLPinViewController.h +++ b/PLPinViewController/Classes/PLPinViewController.h @@ -36,11 +36,11 @@ typedef NS_ENUM(NSInteger, PLPinViewControllerAction) { @property (weak) id pinDelegate; @property (nonatomic, assign) BOOL enableCancel; @property (nonatomic, assign) NSInteger pinLength; +@property (nonatomic, assign) PLPinViewControllerAction action; + (void)showControllerWithAction:(PLPinViewControllerAction)action enableCancel:(BOOL)enableCancel pinLength:(NSInteger)pinLength delegate:(id)delegate animated:(BOOL)animated biometric:(BOOL)biometric; - +(void)dismiss; diff --git a/PLPinViewController/Classes/PLPinViewController.m b/PLPinViewController/Classes/PLPinViewController.m index ac7697c..da3eae0 100644 --- a/PLPinViewController/Classes/PLPinViewController.m +++ b/PLPinViewController/Classes/PLPinViewController.m @@ -42,6 +42,7 @@ + (void)showControllerWithAction:(PLPinViewControllerAction)action enableCancel: vc.pinDelegate = delegate; vc.enableCancel = enableCancel; vc.pinLength = pinLength; + vc.action = action; switch (action) { case PLPinViewControllerActionCreate: