Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Example/PLPinViewController.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion PLPinViewController/Classes/PLEnterPinViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
5 changes: 2 additions & 3 deletions PLPinViewController/Classes/PLPinViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ typedef NS_ENUM(NSInteger, PLPinViewControllerAction) {
@protocol PLPinViewControllerDelegate <NSObject>

@optional

- (void)pinViewControllerDidShow:(PLPinViewController *)controller isBiometricEnabled:(BOOL)enabled;
- (void)pinViewControllerDidCancel:(PLPinViewController *)controller;
- (void)pinViewControllerDidLogout:(PLPinViewController *)controller;
- (void)pinViewController:(PLPinViewController *)controller didChangePin:(NSString*)pin;
Expand All @@ -36,12 +36,11 @@ typedef NS_ENUM(NSInteger, PLPinViewControllerAction) {
@property (weak) id<PLPinViewControllerDelegate> 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<PLPinViewControllerDelegate>)delegate animated:(BOOL)animated biometric:(BOOL)biometric;



+(void)dismiss;


Expand Down
16 changes: 11 additions & 5 deletions PLPinViewController/Classes/PLPinViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -75,7 +77,6 @@ - (void)viewDidLoad {
[super viewDidLoad];

self.currentPin = [[NSMutableString alloc] init];
[self setupBiometric];
[self setupAppearance];

if (self.initialIdentifier)
Expand All @@ -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
{
Expand Down Expand Up @@ -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, *)) {
Expand Down