Skip to content

Commit 96f3cfb

Browse files
authored
Merge pull request #183 from javitrujillo/master
Added method to reset passcode, useful when using app extensions
2 parents 7b84d69 + ffe41d1 commit 96f3cfb

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 3.8.10
2+
* Added new method to reset passcode `- (void)resetPasscode`, useful when using app extensions.
3+
14
# 3.8.9
25
* Added support for iOS App Extensions: defining `LTH_IS_APP_EXTENSION` for an extension target will fix `LTHPasscodeViewController` crashing.
36
* Added new method: `- (void)showLockScreenOver:(UIView *)superview withAnimation:(BOOL)animated withLogout:(BOOL)hasLogout andLogoutTitle:(NSString *)logoutTitle`. Used to provide a view in which the lock is going to be presented, sized to and centered in.
@@ -199,4 +202,4 @@ Renamed `SFHFKeychainUtils` to `LTHKeychainUtils` due to the possibility of conf
199202

200203
Please swap the deprecated methods with the suggested ones; I will remove them in the next release.
201204

202-
#### Thanks to everyone for the help and all the suggestions that found their way into this library!
205+
#### Thanks to everyone for the help and all the suggestions that found their way into this library!

LTHPasscodeViewController/LTHPasscodeViewController.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,5 +416,9 @@
416416
@brief Returns the shared instance of the passcode view controller.
417417
*/
418418
+ (instancetype)sharedUser;
419+
/**
420+
@brief Resets the passcode.
421+
*/
422+
- (void)resetPasscode;
419423

420424
@end

LTHPasscodeViewController/LTHPasscodeViewController.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,15 @@ - (NSString *)_passcode {
320320
error:nil];
321321
}
322322

323+
324+
- (void)resetPasscode {
325+
if ([self _doesPasscodeExist]) {
326+
NSString *passcode = [self _passcode];
327+
[self _deletePasscode];
328+
[self _savePasscode:passcode];
329+
}
330+
}
331+
323332
#if !(TARGET_IPHONE_SIMULATOR)
324333
- (void)_handleTouchIDFailureAndDisableTouchID:(BOOL)disableTouchID {
325334
dispatch_async(dispatch_get_main_queue(), ^{

0 commit comments

Comments
 (0)