mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-18 23:09:21 +00:00
Enabled Time OTP display.
This commit is contained in:
2
Cartfile
2
Cartfile
@@ -1,4 +1,4 @@
|
||||
github "sparkle-project/Sparkle" ~> 1.22
|
||||
github "mattt/TransformerKit" ~> 1.1.1
|
||||
github "MacPass/KeePassKit" "b3e637a95ede748990fef84481ba108d49be7336"
|
||||
github "MacPass/KeePassKit" "defc62b0cb01cf0aafdb7f50cac3cae15b09d289"
|
||||
github "mstarke/HNHUi" ~> 4.0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
github "MacPass/KeePassKit" "b3e637a95ede748990fef84481ba108d49be7336"
|
||||
github "MacPass/KeePassKit" "defc62b0cb01cf0aafdb7f50cac3cae15b09d289"
|
||||
github "mattt/TransformerKit" "1.1.1"
|
||||
github "mstarke/HNHUi" "4.0.2"
|
||||
github "robbiehanson/KissXML" "5.3.2"
|
||||
|
||||
@@ -14,15 +14,13 @@
|
||||
|
||||
@interface MPTOTPViewController ()
|
||||
|
||||
@property (strong) KPKOTPGenerator *otpGenerator;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPTOTPViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
self.otpGenerator = [[KPKOTPGenerator alloc] init];
|
||||
[super viewDidLoad];
|
||||
self.remainingTimeProgressIndicator.minValue = 0;
|
||||
self.remainingTimeProgressIndicator.maxValue = 30;
|
||||
}
|
||||
|
||||
- (void)setRepresentedObject:(id)representedObject {
|
||||
@@ -42,15 +40,22 @@
|
||||
}
|
||||
|
||||
- (void)_didChangeAttribute:(NSNotification *)notification {
|
||||
[self _updateDisplay];
|
||||
}
|
||||
|
||||
- (void)_updateDisplay {
|
||||
KPKEntry *entry = (KPKEntry *)self.representedObject;
|
||||
BOOL showTOTP = entry.hasTOTP;
|
||||
self.view.hidden = !showTOTP;
|
||||
if(showTOTP) {
|
||||
self.remainingTimeProgressIndicator.indeterminate = YES;
|
||||
self.toptValueTextField.stringValue = entry.timeOTP;
|
||||
self.remainingTimeProgressIndicator.doubleValue = 0;
|
||||
[self performSelector:@selector(_updateDisplay) withObject:nil afterDelay:0.5];
|
||||
}
|
||||
else {
|
||||
self.remainingTimeProgressIndicator.indeterminate = NO;
|
||||
self.toptValueTextField.stringValue = @"";
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user