From e9563f3f67963e99a2fbe9f70c04e611a4fe9b64 Mon Sep 17 00:00:00 2001 From: michael starke Date: Fri, 2 Dec 2016 15:43:24 +0100 Subject: [PATCH] adoptin new KeePassKit API --- Cartfile | 2 +- Cartfile.resolved | 2 +- MacPass/KPKFormat+MPUTIDetection.m | 4 ++-- MacPass/MPDocument.h | 2 +- MacPass/MPDocument.m | 6 +++--- MacPass/MPDocumentWindowController.m | 2 +- MacPass/MPPasswordEditWindowController.m | 2 +- MacPass/MPSavePanelAccessoryViewController.m | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cartfile b/Cartfile index 3dd70d0e..97f2c184 100644 --- a/Cartfile +++ b/Cartfile @@ -1,3 +1,3 @@ github "sparkle-project/Sparkle" ~> 1.13.1 -github "mstarke/KeePassKit" "aedf5d2c119a710b9e1a1e4323fe43fc6cc542cd" +github "mstarke/KeePassKit" "ea4d8cd82bc388787d66866e578645693971d453" github "mstarke/HNHUi" ~> 1.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index f0395196..9f1819fe 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,3 +1,3 @@ github "mstarke/HNHUi" "1.1" -github "mstarke/KeePassKit" "aedf5d2c119a710b9e1a1e4323fe43fc6cc542cd" +github "mstarke/KeePassKit" "ea4d8cd82bc388787d66866e578645693971d453" github "sparkle-project/Sparkle" "1.14.0" diff --git a/MacPass/KPKFormat+MPUTIDetection.m b/MacPass/KPKFormat+MPUTIDetection.m index 835d0003..c64a19bb 100644 --- a/MacPass/KPKFormat+MPUTIDetection.m +++ b/MacPass/KPKFormat+MPUTIDetection.m @@ -25,8 +25,8 @@ } - (NSString *)typeForData:(NSData *)data { - KPKFileInfo fileInfo = [self fileInfoForData:data]; - return [self _typeToUTIdictionary][@(fileInfo.format)]; + KPKFileVersion fileVersion = [self fileVersionForData:data]; + return [self _typeToUTIdictionary][@(fileVersion.format)]; } - (NSString *)typeForContentOfURL:(NSURL *)url { diff --git a/MacPass/MPDocument.h b/MacPass/MPDocument.h index f7f04373..a544445c 100644 --- a/MacPass/MPDocument.h +++ b/MacPass/MPDocument.h @@ -78,7 +78,7 @@ FOUNDATION_EXPORT NSString *const MPDocumentGroupKey; @property (nonatomic, strong, readonly) KPKCompositeKey *compositeKey; @property (assign, readonly, getter = isReadOnly) BOOL readOnly; -@property (nonatomic, readonly, assign) KPKDatabaseFormat versionForFileType; +@property (nonatomic, readonly, assign) KPKDatabaseFormat formatForFileType; /* State (active group/entry) diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index 1a01edb2..a89c8658 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -89,7 +89,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou return [NSSet setWithObject:NSStringFromSelector(@selector(tree))]; } -+ (KPKDatabaseFormat)versionForFileType:(NSString *)fileType { ++ (KPKDatabaseFormat)formatForFileType:(NSString *)fileType { if( NSOrderedSame == [fileType compare:MPKdbDocumentUTI options:NSCaseInsensitiveSearch]) { return KPKDatabaseFormatKdb; } @@ -408,8 +408,8 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou } #pragma mark Properties -- (KPKDatabaseFormat)versionForFileType { - return [[self class] versionForFileType:self.fileType]; +- (KPKDatabaseFormat)formatForFileType { + return [self.class versionForFileType:self.fileType]; } - (BOOL)encrypted { diff --git a/MacPass/MPDocumentWindowController.m b/MacPass/MPDocumentWindowController.m index 0e093a1a..a1208002 100644 --- a/MacPass/MPDocumentWindowController.m +++ b/MacPass/MPDocumentWindowController.m @@ -199,7 +199,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword); NSString *fileType = document.fileType; /* we did open as legacy */ if([fileType isEqualToString:MPKdbDocumentUTI]) { - if(document.tree.minimumFormat != KPKDatabaseFormatKdb) { + if(document.tree.minimumVersion.format != KPKDatabaseFormatKdb) { NSAlert *alert = [[NSAlert alloc] init]; alert.alertStyle = NSWarningAlertStyle; alert.messageText = NSLocalizedString(@"WARNING_ON_LOSSY_SAVE", ""); diff --git a/MacPass/MPPasswordEditWindowController.m b/MacPass/MPPasswordEditWindowController.m index 9ef4d6fe..333f687d 100644 --- a/MacPass/MPPasswordEditWindowController.m +++ b/MacPass/MPPasswordEditWindowController.m @@ -117,7 +117,7 @@ - (IBAction)generateKey:(id)sender { MPDocument *document = self.document; - NSData *data = [NSData generateKeyfiledataForVersion:document.tree.minimumFormat]; + NSData *data = [NSData generateKeyfiledataForFormat:document.tree.minimumVersion.format]; if(data) { NSSavePanel *savePanel = [NSSavePanel savePanel]; savePanel.allowedFileTypes = @[@"key", @"xml"]; diff --git a/MacPass/MPSavePanelAccessoryViewController.m b/MacPass/MPSavePanelAccessoryViewController.m index cbe8e604..2b4ed000 100644 --- a/MacPass/MPSavePanelAccessoryViewController.m +++ b/MacPass/MPSavePanelAccessoryViewController.m @@ -65,7 +65,7 @@ */ NSView *view = self.view; NSAssert(view != nil, @"View has to be loaded at this point"); - switch(self.document.versionForFileType) { + switch(self.document.formatForFileType) { case KPKDatabaseFormatKdb: [self.fileTypePopupButton selectItemAtIndex:1]; break; @@ -82,7 +82,7 @@ - (void)_updateNote { NSString *uti = self.fileTypePopupButton.selectedItem.representedObject; - BOOL showInfoText = (self.document.tree.minimumFormat == KPKDatabaseFormatKdbx && [uti isEqualToString:MPKdbDocumentUTI]); + BOOL showInfoText = (self.document.tree.minimumVersion.format == KPKDatabaseFormatKdbx && [uti isEqualToString:MPKdbDocumentUTI]); self.infoTextField.hidden = !showInfoText; }