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/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) { diff --git a/PLPinViewController/Classes/PLPinViewController.h b/PLPinViewController/Classes/PLPinViewController.h index b92aece..a9ee5ff 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; @@ -36,12 +36,11 @@ typedef NS_ENUM(NSInteger, PLPinViewControllerAction) { @property (weak) id pinDelegate; @property (nonatomic, assign) BOOL enableCancel; @property (nonatomic, assign) NSInteger pinLength; -@property (nonatomic, assign) BOOL enableBiometric; +@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 cd6fd74..da3eae0 100644 --- a/PLPinViewController/Classes/PLPinViewController.m +++ b/PLPinViewController/Classes/PLPinViewController.m @@ -42,7 +42,7 @@ + (void)showControllerWithAction:(PLPinViewControllerAction)action enableCancel: vc.pinDelegate = delegate; vc.enableCancel = enableCancel; vc.pinLength = pinLength; - vc.enableBiometric = biometric; + vc.action = action; switch (action) { case PLPinViewControllerActionCreate: @@ -58,12 +58,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 +77,6 @@ - (void)viewDidLoad { [super viewDidLoad]; self.currentPin = [[NSMutableString alloc] init]; - [self setupBiometric]; [self setupAppearance]; if (self.initialIdentifier) @@ -87,6 +88,11 @@ - (void)viewDidLoad { [self performSegueWithIdentifier:@"showEnterPin" sender:nil]; } +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + + [self.pinDelegate pinViewControllerDidShow:self isBiometricEnabled:!self.biometricButton.hidden]; +} - (UIStatusBarStyle)preferredStatusBarStyle { @@ -133,8 +139,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, *)) {