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