mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 15:12:21 +00:00
Exired entries and groups now get updates at runtime
This commit is contained in:
Submodule KeePassKit updated: fcb5063c78...275e6e3e1b
@@ -680,17 +680,6 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey
|
||||
}
|
||||
[self.trash clear];
|
||||
}
|
||||
# pragma mark Expiration updates
|
||||
- (void)_updateExpirationState {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(60*60*6* NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
/* TODO: find better way to do this! Test for alle entries if expired */
|
||||
[[self.tree allEntries] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
KPKEntry *entry = obj;
|
||||
[entry.timeInfo willChangeValueForKey:NSStringFromSelector(@selector(isExpired))];
|
||||
[entry.timeInfo didChangeValueForKey:NSStringFromSelector(@selector(isExpired))];
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
# pragma mark File Watching
|
||||
- (void) _watchForFileChanges:(BOOL)watch {
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#import "KPKNode+IconImage.h"
|
||||
#import "KPKAttribute.h"
|
||||
#import "KPKTimeInfo.h"
|
||||
#import "KPKMetaData.h"
|
||||
|
||||
#import "HNHTableHeaderCell.h"
|
||||
#import "HNHGradientView.h"
|
||||
@@ -46,6 +47,7 @@
|
||||
#import "NSString+Commands.h"
|
||||
|
||||
#define STATUS_BAR_ANIMATION_TIME 0.15
|
||||
#define EXPIRED_ENTRY_REFRESH_SECONDS 60
|
||||
|
||||
typedef NS_ENUM(NSUInteger,MPOVerlayInfoType) {
|
||||
MPOverlayInfoPassword,
|
||||
@@ -115,6 +117,7 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
|
||||
_dataSource.viewController = self;
|
||||
_menuDelegate = [[MPEntryContextMenuDelegate alloc] init];
|
||||
_contextBarViewController = [[MPContextBarViewController alloc] init];
|
||||
[self _updateExpirationDisplay];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -728,4 +731,12 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
|
||||
break;
|
||||
}
|
||||
}
|
||||
- (void)_updateExpirationDisplay {
|
||||
/* items are all entries */
|
||||
[[self.entryArrayController arrangedObjects] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
[[obj timeInfo] isExpired];
|
||||
}];
|
||||
[self performSelector:@selector(_updateExpirationDisplay) withObject:nil afterDelay:EXPIRED_ENTRY_REFRESH_SECONDS];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -81,18 +81,15 @@
|
||||
[self.titleTextField bind:NSValueBinding toObject:self.group withKeyPath:NSStringFromSelector(@selector(name)) options:nil];
|
||||
[self.expiresCheckButton bind:NSValueBinding toObject:self.group.timeInfo withKeyPath:NSStringFromSelector(@selector(expires)) options:nil];
|
||||
[self.expiresCheckButton bind:NSTitleBinding toObject:self.group.timeInfo withKeyPath:NSStringFromSelector(@selector(expiryTime)) options:@{ NSValueTransformerNameBindingOption:MPExpiryDateValueTransformer }];
|
||||
[self.expireDateSelectButton bind:NSHiddenBinding toObject:self.group.timeInfo withKeyPath:NSStringFromSelector(@selector(expires)) options:@{ NSValueTransformerNameBindingOption : NSNegateBooleanTransformerName }];
|
||||
[self.autotypePopupButton bind:NSSelectedTagBinding toObject:self.group withKeyPath:NSStringFromSelector(@selector(isAutoTypeEnabled)) options:nil];
|
||||
[self.autotypeSequenceTextField bind:NSValueBinding toObject:self.group withKeyPath:NSStringFromSelector(@selector(defaultAutoTypeSequence)) options:nil];
|
||||
[self.searchPopupButton bind:NSSelectedTagBinding toObject:self.group withKeyPath:NSStringFromSelector(@selector(isSearchEnabled)) options:nil];
|
||||
}
|
||||
else {
|
||||
[self.titleTextField unbind:NSValueBinding];
|
||||
|
||||
[self.expiresCheckButton unbind:NSValueBinding];
|
||||
[self.expiresCheckButton unbind:NSTitleBinding];
|
||||
[self.expiresCheckButton setTitle:NSLocalizedString(@"EXPIRES", "")];
|
||||
[self.expireDateSelectButton unbind:NSHiddenBinding];
|
||||
[self.searchPopupButton unbind:NSSelectedTagBinding];
|
||||
[self.autotypePopupButton unbind:NSSelectedTagBinding];
|
||||
[self.autotypeSequenceTextField unbind:NSValueBinding];
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#import "MPOutlineContextMenuDelegate.h"
|
||||
|
||||
#import "KPKTree.h"
|
||||
#import "KPKNode.h"
|
||||
#import "KPKTimeInfo.h"
|
||||
#import "KPKGroup.h"
|
||||
#import "KPKNode+IconImage.h"
|
||||
#import "KPKMetaData.h"
|
||||
@@ -25,6 +27,8 @@
|
||||
|
||||
#import "HNHGradientView.h"
|
||||
|
||||
#define EXPIRED_GROUP_REFRESH_SECONDS 60
|
||||
|
||||
NSString *const MPOutlineViewDidChangeGroupSelection = @"com.macpass.MPOutlineViewDidChangeGroupSelection";
|
||||
|
||||
NSString *const _MPOutlineViewDataViewIdentifier = @"DataCell";
|
||||
@@ -104,6 +108,8 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
[self bind:NSStringFromSelector(@selector(databaseNameWrapper)) toObject:document.tree.metaData withKeyPath:NSStringFromSelector(@selector(databaseName)) options:nil];
|
||||
[_outlineView setDataSource:self.datasource];
|
||||
_bindingEstablished = YES;
|
||||
[self _updateExpirationDisplay];
|
||||
|
||||
}
|
||||
NSTreeNode *node = [_outlineView itemAtRow:0];
|
||||
[self _expandItems:node];
|
||||
@@ -301,4 +307,13 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
return [node isKindOfClass:[KPKTree class]];
|
||||
}
|
||||
|
||||
- (void)_updateExpirationDisplay {
|
||||
MPDocument *document = [[self windowController] document];
|
||||
[document.root.timeInfo isExpired];
|
||||
[[document.tree allGroups] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||
[[obj timeInfo] isExpired];
|
||||
}];
|
||||
[self performSelector:@selector(_updateExpirationDisplay) withObject:nil afterDelay:EXPIRED_GROUP_REFRESH_SECONDS];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user