Skip to content

Commit 6806eeb

Browse files
committed
Added delegate methods for settings view controller
1 parent 84cf1f8 commit 6806eeb

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

TOPasscodeViewController/TOPasscodeSettingsViewController.h

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#import <UIKit/UIKit.h>
1010
#import "TOPasscodeViewControllerConstants.h"
1111

12+
@class TOPasscodeSettingsViewController;
13+
1214
typedef NS_ENUM(NSInteger, TOPasscodeSettingsViewState) {
1315
TOPasscodeSettingsViewStateEnterNewPassword,
1416
TOPasscodeSettingsViewStateConfirmNewPassword,
@@ -17,14 +19,33 @@ typedef NS_ENUM(NSInteger, TOPasscodeSettingsViewState) {
1719

1820
NS_ASSUME_NONNULL_BEGIN
1921

22+
@protocol TOPasscodeSettingsViewControllerDelegate <NSObject>
23+
24+
/** Called when the user was prompted to input their current passcode.
25+
Return YES if passcode was right and NO otherwise.
26+
27+
Returning NO will cause a warning label to appear
28+
*/
29+
- (BOOL)passcodeSettingsViewControllerDidAttemptCurrentPasscode:(NSString *)passcode;
30+
31+
/** Called when the user has successfully set a new passcode. At this point, you should save over
32+
the old passcode with the new one. */
33+
- (void)passcodeSettingsViewControllerDidChangeToNewPasscode:(NSString *)passcode ofType:(TOPasscodeType)type;
34+
35+
@end
36+
37+
// ----------------------------------------------------------------------
38+
2039
@interface TOPasscodeSettingsViewController : UIViewController
2140

22-
/* Set the visual style of the view controller (light or dark) */
41+
/** Set the visual style of the view controller (light or dark) */
2342
@property (nonatomic, assign) TOPasscodeSettingsViewStyle style;
2443

25-
/* Before setting a new passcode, show a UI to validate the existing password. (Default is YES) */
44+
/** Before setting a new passcode, show a UI to validate the existing password. (Default is YES) */
2645
@property (nonatomic, assign) BOOL requireCurrentPasscode;
2746

47+
/** If set, the view controller will disable input until this date time has been reached */
48+
2849
/* Create a new instance with the desird light or dark style */
2950
- (instancetype)initWithStyle:(TOPasscodeSettingsViewStyle)style;
3051

TOPasscodeViewController/TOPasscodeSettingsViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ - (void)viewDidLoad {
111111
self.warningLabel.frame = frame;
112112

113113
// Apply light/dark mode
114-
[self applyThemeForStyle:TOPasscodeSettingsViewStyleDark];
114+
[self applyThemeForStyle:self.style];
115115
}
116116

117117
- (void)viewDidLayoutSubviews

TOPasscodeViewController/Views/TOPasscodeSettingsKeypadView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ - (void)setUpDefaultValuesForStye:(TOPasscodeSettingsViewStyle)style
134134
// Separator lines
135135
UIColor *separatorColor = nil;
136136
if (isDark) {
137-
separatorColor = [UIColor colorWithWhite:0.3f alpha:1.0f];
137+
separatorColor = [UIColor colorWithWhite:0.25f alpha:1.0f];
138138
}
139139
else {
140140
separatorColor = [UIColor colorWithWhite:0.7f alpha:1.0f];

0 commit comments

Comments
 (0)