Plugin respository now uses table columns again.

This commit is contained in:
Michael Starke
2018-10-12 16:22:52 +02:00
parent 94a36fac36
commit 5be3265c17
16 changed files with 187 additions and 161 deletions

View File

@@ -264,7 +264,6 @@
4CE8246F16E2E93400573141 /* MPOverlayWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8246E16E2E93400573141 /* MPOverlayWindowController.m */; };
4CE8247516E2F2B900573141 /* MPOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE8247416E2F2B900573141 /* MPOverlayView.m */; };
4CE88B9717BA651C0042E078 /* contextTriangleTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4CE88B9617BA651C0042E078 /* contextTriangleTemplate.pdf */; };
4CE97BAA216FA968006BF25D /* MPPluginBrowserTableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE97BA9216FA968006BF25D /* MPPluginBrowserTableCellView.m */; };
4CEE46DD181C301D006BF1E5 /* MPAutotypeDaemon.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEE46DC181C301D006BF1E5 /* MPAutotypeDaemon.m */; };
4CEED1C617D7BD0E007180F1 /* NSError+Messages.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEED1C517D7BD0E007180F1 /* NSError+Messages.m */; };
4CF29BF417879D0000851B60 /* 26_FileSaveTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 4CF29BF317879D0000851B60 /* 26_FileSaveTemplate.pdf */; };
@@ -824,8 +823,6 @@
4CE88B9617BA651C0042E078 /* contextTriangleTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = contextTriangleTemplate.pdf; path = Icons/contextTriangleTemplate.pdf; sourceTree = "<group>"; };
4CE88C2417C163FE00BFD195 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
4CE88C3317C1647400BFD195 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
4CE97BA8216FA968006BF25D /* MPPluginBrowserTableCellView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPPluginBrowserTableCellView.h; sourceTree = "<group>"; };
4CE97BA9216FA968006BF25D /* MPPluginBrowserTableCellView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPPluginBrowserTableCellView.m; sourceTree = "<group>"; };
4CEE46DB181C301D006BF1E5 /* MPAutotypeDaemon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAutotypeDaemon.h; sourceTree = "<group>"; };
4CEE46DC181C301D006BF1E5 /* MPAutotypeDaemon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPAutotypeDaemon.m; sourceTree = "<group>"; };
4CEED1C417D7BD0E007180F1 /* NSError+Messages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSError+Messages.h"; sourceTree = "<group>"; };
@@ -1051,8 +1048,6 @@
4C0F043F2147A6FA000B8568 /* MPCustomFieldTableView.m */,
4C370EFC215B76CB00703AAE /* MPOutlineTableCellView.h */,
4C370EFD215B76CB00703AAE /* MPOutlineTableCellView.m */,
4CE97BA8216FA968006BF25D /* MPPluginBrowserTableCellView.h */,
4CE97BA9216FA968006BF25D /* MPPluginBrowserTableCellView.m */,
);
name = Views;
sourceTree = "<group>";
@@ -1246,6 +1241,9 @@
4C25703C1BF11C2300D39416 /* MPPluginSettingsController.h */,
4C25703D1BF11C2300D39416 /* MPPluginSettingsController.m */,
4C0DBEF71BF508DE00F9B287 /* PluginSettings.xib */,
4CC663E4216F7A7100E33965 /* MPPluginRepositoryBrowserViewController.h */,
4CC663E5216F7A7100E33965 /* MPPluginRepositoryBrowserViewController.m */,
4CC663E6216F7A7100E33965 /* PluginRepositoryBrowserView.xib */,
);
name = Settings;
sourceTree = "<group>";
@@ -1566,9 +1564,6 @@
4C73B6EE215E64A7009787F7 /* MPWelcomeViewController.h */,
4C73B6EF215E64A7009787F7 /* MPWelcomeViewController.m */,
4C7F8B6A1A10B68400CCB83D /* WelcomeView.xib */,
4CC663E4216F7A7100E33965 /* MPPluginRepositoryBrowserViewController.h */,
4CC663E5216F7A7100E33965 /* MPPluginRepositoryBrowserViewController.m */,
4CC663E6216F7A7100E33965 /* PluginRepositoryBrowserView.xib */,
);
name = "View Controller";
sourceTree = "<group>";
@@ -1953,7 +1948,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4CE97BAA216FA968006BF25D /* MPPluginBrowserTableCellView.m in Sources */,
4CD034AC1BFE113B003C002C /* MPPluginHost.m in Sources */,
4C77E37315B84A240093A587 /* main.m in Sources */,
4C0F04402147A6FA000B8568 /* MPCustomFieldTableView.m in Sources */,

View File

@@ -15,17 +15,17 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<view id="9Nv-Zl-Z9p">
<rect key="frame" x="0.0" y="0.0" width="528" height="300"/>
<rect key="frame" x="0.0" y="0.0" width="521" height="320"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ITj-5P-sn9">
<rect key="frame" x="20" y="0.0" width="508" height="300"/>
<stackView orientation="horizontal" alignment="centerY" spacing="2" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" translatesAutoresizingMaskIntoConstraints="NO" id="ITj-5P-sn9">
<rect key="frame" x="20" y="0.0" width="501" height="320"/>
<middleViews>
<stackView orientation="vertical" alignment="centerX" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jd3-xw-cZP">
<rect key="frame" x="143" y="0.0" width="222" height="300"/>
<rect key="frame" x="140" y="0.0" width="222" height="320"/>
<middleViews>
<imageView misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VWi-da-LGh">
<rect key="frame" x="47" y="105" width="128" height="128"/>
<rect key="frame" x="47" y="115" width="128" height="128"/>
<constraints>
<constraint firstAttribute="height" constant="128" id="T0d-gp-edr"/>
<constraint firstAttribute="width" constant="128" id="Xdf-jE-D9H"/>
@@ -33,7 +33,7 @@
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="MacPassAppIcon" id="9f2-Co-St2"/>
</imageView>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="EEg-rH-sPx">
<rect key="frame" x="-2" y="68" width="226" height="29"/>
<rect key="frame" x="-2" y="78" width="226" height="29"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Welcome to MacPass" id="zdv-z8-khG">
<font key="font" metaFont="system" size="24"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -82,19 +82,19 @@
</middleViews>
<endViews>
<scrollView misplaced="YES" autohidesScrollers="YES" horizontalLineScroll="40" horizontalPageScroll="10" verticalLineScroll="40" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eUA-6g-T1O">
<rect key="frame" x="373" y="0.0" width="135" height="300"/>
<rect key="frame" x="364" y="0.0" width="137" height="320"/>
<clipView key="contentView" id="0Kf-Fq-by2">
<rect key="frame" x="1" y="1" width="133" height="298"/>
<rect key="frame" x="1" y="1" width="135" height="318"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="38" rowSizeStyle="automatic" viewBased="YES" id="51b-Ql-3gM">
<rect key="frame" x="0.0" y="0.0" width="133" height="298"/>
<rect key="frame" x="0.0" y="0.0" width="135" height="318"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn width="130" minWidth="40" maxWidth="1000" id="oLj-wZ-syY">
<tableColumn width="132" minWidth="40" maxWidth="1000" id="oLj-wZ-syY">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -108,7 +108,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="6UF-Gr-4nf">
<rect key="frame" x="1" y="1" width="130" height="38"/>
<rect key="frame" x="1" y="1" width="132" height="38"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Kko-1G-JNn">
@@ -120,15 +120,12 @@
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSActionTemplate" id="9TF-9t-7gd"/>
</imageView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Kso-jb-pRH">
<rect key="frame" x="39" y="3" width="91" height="32"/>
<rect key="frame" x="39" y="3" width="93" height="32"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="vzM-ly-CYn">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="6UF-Gr-4nf" name="value" keyPath="objectValue" id="xQO-gD-dYm"/>
</connections>
</textField>
</subviews>
<constraints>
@@ -159,7 +156,7 @@
<constraint firstAttribute="width" constant="200" id="R0Z-La-Y3C"/>
</constraints>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="bRy-ef-e76">
<rect key="frame" x="1" y="283" width="133" height="16"/>
<rect key="frame" x="1" y="303" width="135" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="2e9-uR-dY7">
@@ -191,7 +188,7 @@
<constraint firstItem="ITj-5P-sn9" firstAttribute="leading" secondItem="9Nv-Zl-Z9p" secondAttribute="leading" constant="20" id="oWL-PJ-VCT"/>
<constraint firstAttribute="bottom" secondItem="ITj-5P-sn9" secondAttribute="bottom" id="syW-TO-uwv"/>
</constraints>
<point key="canvasLocation" x="-21" y="-483"/>
<point key="canvasLocation" x="-278" y="-511"/>
</view>
</objects>
<resources>

View File

@@ -284,7 +284,7 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi
#if defined(DEBUG) || defined(NO_SPARKLE)
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = NSLocalizedString(@"ALERT_UPDATES_DISABLED_MESSAGE_TEXT", @"Message text for disabled updates alert!");
alert.informativeText = [NSString stringWithFormat:@"ALERT_UPDATED_DISABLED_INFORMATIVE_TEXT_%@!", NSApp.applicationName];
alert.informativeText = [NSString stringWithFormat:NSLocalizedString(@"ALERT_UPDATES_DISABLED_INFORMATIVE_TEXT_%@!", @"Infromative text of the disabled updates alert!"), NSApp.applicationName];
[alert addButtonWithTitle:NSLocalizedString(@"OK", @"Ok Button to dismiss disabled updates alert")];
[alert runModal];
#else

View File

@@ -28,6 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
@class KPKEntry;
@class KPKAttribute;
@class KPKTree;
@class MPPluginVersion;
FOUNDATION_EXPORT NSString *const MPPluginUnkownVersion;
@@ -36,6 +37,7 @@ FOUNDATION_EXPORT NSString *const MPPluginUnkownVersion;
@property (copy, readonly) NSString *identifier;
@property (copy, readonly) NSString *name;
@property (nonatomic, copy, readonly, nullable) NSString *humanVersionString;
@property (nonatomic, copy, readonly, nullable) MPPluginVersion *version;
@property (nonatomic, copy, readonly) NSString *versionString;
@property (nonatomic, strong, readonly) NSBundle *bundle;

View File

@@ -25,12 +25,14 @@
#import "MPPluginHost.h"
#import "MPSettingsHelper.h"
#import "MPPluginConstants.h"
#import "MPPluginVersion.h"
NSString *const MPPluginUnkownVersion = @"unkown.plugin.version";
@implementation MPPlugin
@synthesize bundle = _bundle;
@synthesize version = _version;
- (instancetype)initWithPluginHost:(MPPluginHost *)host {
self = [super init];
@@ -72,6 +74,14 @@ NSString *const MPPluginUnkownVersion = @"unkown.plugin.version";
return self.bundle.infoDictionary[@"CFBundleShortVersionString"];
}
- (MPPluginVersion *)version {
if(!_versionInitialized) {
_version = [MPPluginVersion versionWithVersionString:self.humanVersionString];
_versionInitialized = YES;
}
return _version;
}
- (NSString *)versionString {
if(self.bundle) {
NSString *humanVersion = self.humanVersionString;

View File

@@ -1,19 +0,0 @@
//
// MPPluginBrowserTableCellView.h
// MacPass
//
// Created by Michael Starke on 11.10.18.
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface MPPluginBrowserTableCellView : NSTableCellView
@property (strong) IBOutlet NSTextField *statusTextField;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,27 +0,0 @@
//
// MPPluginBrowserTableCellView.m
// MacPass
//
// Created by Michael Starke on 11.10.18.
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
//
#import "MPPluginBrowserTableCellView.h"
@implementation MPPluginBrowserTableCellView
- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle {
super.backgroundStyle = backgroundStyle;
switch(backgroundStyle) {
case NSBackgroundStyleNormal:
case NSBackgroundStyleLowered:
self.statusTextField.textColor = NSColor.controlTextColor;
break;
case NSBackgroundStyleRaised:
case NSBackgroundStyleEmphasized:
self.statusTextField.textColor = NSColor.selectedControlTextColor;
break;
}
}
@end

View File

@@ -31,13 +31,14 @@ FOUNDATION_EXPORT NSString *const MPPluginHostPluginBundleIdentifiyerKey;
@class MPPlugin;
@class KPKEntry;
@class MPPluginVersion;
@interface MPPluginHost : NSObject
/* List of all plugins known to the plugin manager. Disabled plugins are also present! */
@property (readonly, copy) NSArray <MPPlugin __kindof*> *plugins;
@property (nonatomic, readonly) BOOL loadUnsecurePlugins;
@property (readonly, copy) NSString *version;
@property (readonly, copy) MPPluginVersion *version;
+ (instancetype)sharedHost;

View File

@@ -28,6 +28,7 @@
#import "MPPluginEntryActionContext.h"
#import "MPPluginRepository.h"
#import "MPPluginRepositoryItem.h"
#import "MPPluginVersion.h"
#import "NSApplication+MPAdditions.h"
#import "MPSettingsHelper.h"
@@ -80,6 +81,7 @@ NSString *const MPPluginHostPluginBundleIdentifiyerKey = @"MPPluginHostPluginBun
_loadUnsecurePlugins = [NSUserDefaults.standardUserDefaults boolForKey:kMPSettingsKeyLoadUnsecurePlugins];
_entryActionPluginIdentifiers = [[NSMutableArray alloc] init];
_customAttributePluginIdentifiers = [[NSMutableArray alloc] init];
_version = [[MPPluginVersion alloc] initWithVersionString:NSBundle.mainBundle.infoDictionary[@"CFBundleShortVersionString"]];
[self bind:NSStringFromSelector(@selector(loadUnsecurePlugins))
toObject:NSUserDefaultsController.sharedUserDefaultsController
@@ -93,11 +95,6 @@ NSString *const MPPluginHostPluginBundleIdentifiyerKey = @"MPPluginHostPluginBun
return self;
}
- (NSString *)version {
NSString *version = NSBundle.mainBundle.infoDictionary[@"CFBundleShortVersionString"];
return version;
}
- (NSArray<MPPlugin *> *)plugins {
return [self.mutablePlugins copy];
}
@@ -273,8 +270,8 @@ NSString *const MPPluginHostPluginBundleIdentifiyerKey = @"MPPluginHostPluginBun
repoItem = item;
}
}
NSString *shortVersion = bundle.infoDictionary[@"CFBundleShortVersionString"];
return [repoItem isPluginVersion:shortVersion compatibleWithHost:self];
MPPluginVersion *version = [MPPluginVersion versionWithVersionString:bundle.infoDictionary[@"CFBundleShortVersionString"]];
return [repoItem isPluginVersionCompatibleWithHost:version];
}
- (BOOL)_isValidPluginURL:(NSURL *)url {

View File

@@ -24,13 +24,8 @@
#import "MPConstants.h"
#import "MPPluginRepositoryItem.h"
const NSTimeInterval MPPluginRepositoryCacheTimeOut = 60*3; // 1 Minute cache time
@interface MPPluginRepository ()
@property NSTimeInterval lastPluginCheckTime;
@property BOOL didLoadData;
@end
@implementation MPPluginRepository
@@ -44,13 +39,6 @@ const NSTimeInterval MPPluginRepositoryCacheTimeOut = 60*3; // 1 Minute cache ti
return instance;
}
- (instancetype)init {
self = [super init];
if(self) {
self.lastPluginCheckTime = NSDate.distantPast.timeIntervalSinceReferenceDate;
}
return self;
}
- (void)fetchRepositoryDataCompletionHandler:(void (^)(NSArray<MPPluginRepositoryItem *> * _Nonnull))completionHandler {
NSString *urlString = NSBundle.mainBundle.infoDictionary[MPBundlePluginRepositoryURLKey];

View File

@@ -11,7 +11,14 @@
#import "MPPluginHost.h"
#import "MPPluginRepository.h"
#import "MPPluginRepositoryItem.h"
#import "MPPluginBrowserTableCellView.h"
#import "MPPluginVersion.h"
typedef NS_ENUM(NSUInteger, MPPluginTableColumn) {
MPPluginTableColumnName,
MPPluginTableColumnCurrentVersion,
MPPluginTableColumnStatus
};
@interface MPPluginRepositoryBrowserViewController () <NSTableViewDelegate, NSTableViewDataSource>
@@ -44,21 +51,38 @@
}
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
MPPluginBrowserTableCellView *view = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];
NSTableCellView *view = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];
MPPluginRepositoryItem *item = self.repositoryItems.firstObject;
view.textField.stringValue = item.name;
NSUInteger column = [tableView.tableColumns indexOfObjectIdenticalTo:tableColumn];
if(column == MPPluginTableColumnName) {
view.textField.stringValue = item.name;
}
else if(column == MPPluginTableColumnCurrentVersion) {
view.textField.stringValue = item.currentVersion.versionString;
}
else if(column == MPPluginTableColumnStatus) {
MPPlugin *plugin = [MPPluginHost.sharedHost pluginWithBundleIdentifier:item.bundleIdentifier];
if(plugin) {
if([plugin.humanVersionString isEqualToString:item.currentVersion]) {
view.statusTextField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"INSTALLED_VERSION_%@_(UP_TO_DATE)", "Info displayed when an installed plugin is up to date"), plugin.humanVersionString];
}
else {
view.statusTextField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"CURRENT_VERSION_%@_(INSTALLED_VERSION_%@)", "Info displayed when a plugin is loaded and "), item.currentVersion, plugin.humanVersionString];
if(!plugin) {
switch([plugin.version compare:item.currentVersion]) {
case NSOrderedSame:
view.textField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"PLUGIN_BROWSER_LATEST_VERSION_INSTALLED", "Status for an up-to-date plugin in the plugin browser")];
break;
case NSOrderedAscending:
view.textField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"PLUGIN_BROWSER_NEWER_VERSION_%@_AVAILABLE", "Status for an outdated plugin version in the plugin browser"), item.currentVersion.versionString];
break;
case NSOrderedDescending:
view.textField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"PLUGIN_BROWSER_UNKNOWN_PLUGIN_VERSION", "Status for an unkonw plugin version in the plugin browser")];
break;
}
}
else {
view.statusTextField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"CURRENT_VERSION_%@_(NOT_INSTALLED)", "Info displayed when an plugin is not installed"), plugin.humanVersionString];
view.textField.stringValue = [NSString stringWithFormat:NSLocalizedString(@"PLUGIN_BROWSER_PLUGIN_NOT_INSTALLED", "Status for an uninstalled plugin in the plugin browser")];
}
}
else {
view.textField.stringValue = @"-";
}
return view;

View File

@@ -24,13 +24,12 @@
NS_ASSUME_NONNULL_BEGIN
@class MPPluginHost;
@class MPPluginVersion;
@interface MPPluginRepositoryItem : NSObject
@property (copy,readonly, nullable) NSString *name;
@property (copy,readonly, nullable) NSString *currentVersion;
@property (copy,readonly, nullable) MPPluginVersion *currentVersion;
@property (copy,readonly, nullable) NSString *descriptionText;
@property (copy,readonly, nullable) NSURL *sourceURL;
@property (copy,readonly, nullable) NSURL *downloadURL;
@@ -40,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (instancetype)pluginItemFromDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (BOOL)isPluginVersion:(NSString * _Nullable )pluginVersionString compatibleWithHost:(MPPluginHost *)host;
- (BOOL)isPluginVersionCompatibleWithHost:(MPPluginVersion *)pluginVersion;
@end

View File

@@ -24,7 +24,6 @@
#import "MPPluginRepositoryItemVersionInfo.h"
#import "MPPluginVersion.h"
#import "MPPluginHost.h"
#import "MPPlugin.h"
#import "NSError+Messages.h"
@@ -39,7 +38,7 @@ NSString *const MPPluginItemCompatibiltyKey = @"compatibilty";
@interface MPPluginRepositoryItem ()
@property (copy) NSString *name;
@property (copy) NSString *currentVersion;
@property (copy) MPPluginVersion *currentVersion;
@property (copy) NSString *descriptionText;
@property (copy) NSURL *sourceURL;
@property (copy) NSURL *downloadURL;
@@ -64,7 +63,7 @@ NSString *const MPPluginItemCompatibiltyKey = @"compatibilty";
self.descriptionText = dict[MPPluginItemDescriptionKey];
self.downloadURL = [NSURL URLWithString:dict[MPPluginItemDownloadURLKey]];
self.sourceURL = [NSURL URLWithString:dict[MPPluginItemSourceURLKey]];
self.currentVersion = dict[MPPluginItemCurrentVersionKey];
self.currentVersion = [MPPluginVersion versionWithVersionString:dict[MPPluginItemCurrentVersionKey]];
self.bundleIdentifier = dict[MPPluginItemBundleIdentifierKey];
[self _buildVersionInfos:dict[MPPluginItemCompatibiltyKey]];
@@ -77,19 +76,12 @@ NSString *const MPPluginItemCompatibiltyKey = @"compatibilty";
return (self.name.length > 0 && self.downloadURL);
}
- (BOOL)isPluginVersion:(NSString *)pluginVersionString compatibleWithHost:(MPPluginHost *)host {
if(pluginVersionString.length == 0) {
return NO;
}
MPPluginVersion *pluginVersion = [MPPluginVersion versionWithVersionString:pluginVersionString];
- (BOOL)isPluginVersionCompatibleWithHost:(MPPluginVersion *)pluginVersion {
if(!pluginVersion) {
return NO;
}
if(host.version.length == 0) {
return NO;
}
MPPluginVersion *hostVersion = [MPPluginVersion versionWithVersionString:host.version];
MPPluginVersion *hostVersion = MPPluginHost.sharedHost.version;
if(!hostVersion) {
return NO;
}

View File

@@ -22,7 +22,9 @@
#import "MPPlugin.h"
@interface MPPlugin ()
@interface MPPlugin () {
BOOL _versionInitialized;
}
@property (nonatomic, strong) NSBundle *bundle;
@property (copy) NSString *errorMessage;

View File

@@ -15,68 +15,117 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="440" height="513"/>
<rect key="frame" x="0.0" y="0.0" width="638" height="513"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<scrollView autohidesScrollers="YES" horizontalLineScroll="41" horizontalPageScroll="10" verticalLineScroll="41" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V1g-KK-vjw">
<rect key="frame" x="20" y="61" width="400" height="432"/>
<scrollView autohidesScrollers="YES" horizontalLineScroll="26" horizontalPageScroll="10" verticalLineScroll="26" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V1g-KK-vjw">
<rect key="frame" x="20" y="61" width="598" height="432"/>
<clipView key="contentView" id="Sqy-VI-iH4">
<rect key="frame" x="1" y="0.0" width="398" height="431"/>
<rect key="frame" x="1" y="0.0" width="596" height="431"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="39" rowSizeStyle="automatic" headerView="uVe-04-Now" viewBased="YES" id="gDR-Fx-c0h">
<rect key="frame" x="0.0" y="0.0" width="398" height="408"/>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="sequential" alternatingRowBackgroundColors="YES" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" rowSizeStyle="systemDefault" headerView="uVe-04-Now" viewBased="YES" id="gDR-Fx-c0h">
<rect key="frame" x="0.0" y="0.0" width="596" height="408"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn width="395" minWidth="40" maxWidth="1000" id="qP8-eW-n9j">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Name">
<tableColumn width="145" minWidth="10" maxWidth="3.4028234663852886e+38" id="Nzo-rR-Hfx">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Plugin">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="cg1-Wr-3Ue">
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="cFE-KE-Xjx">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="67K-DS-g25" customClass="MPPluginBrowserTableCellView">
<rect key="frame" x="1" y="1" width="146" height="39"/>
<tableCellView id="Uuc-Kh-oDl">
<rect key="frame" x="1" y="1" width="145" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="h6O-OE-fLL">
<rect key="frame" x="0.0" y="22" width="146" height="17"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Name" id="PUE-Ry-tVv">
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6fB-f9-l44">
<rect key="frame" x="0.0" y="0.0" width="145" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="DRt-Gz-DUm">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="gCh-ar-0UC">
<rect key="frame" x="0.0" y="0.0" width="146" height="14"/>
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" title="Status" id="x8t-gZ-784">
</subviews>
<connections>
<outlet property="textField" destination="6fB-f9-l44" id="gS0-YM-TI7"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn width="64" minWidth="10" maxWidth="3.4028234663852886e+38" id="hFg-AD-SqD">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Installed Version">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="QPj-W1-su1">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="AKl-7g-maS">
<rect key="frame" x="149" y="1" width="64" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gZz-x5-KVH">
<rect key="frame" x="0.0" y="0.0" width="64" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="nc9-mo-2e5">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="gCh-ar-0UC" secondAttribute="bottom" id="55S-5j-iht"/>
<constraint firstItem="h6O-OE-fLL" firstAttribute="top" secondItem="67K-DS-g25" secondAttribute="top" id="Agb-MB-rhd"/>
<constraint firstItem="gCh-ar-0UC" firstAttribute="top" secondItem="h6O-OE-fLL" secondAttribute="bottom" constant="8" symbolic="YES" id="Ger-4c-w32"/>
<constraint firstItem="gCh-ar-0UC" firstAttribute="trailing" secondItem="h6O-OE-fLL" secondAttribute="trailing" id="InW-1F-uHj"/>
<constraint firstAttribute="trailing" secondItem="h6O-OE-fLL" secondAttribute="trailing" constant="2" id="V6g-nx-J5c"/>
<constraint firstItem="h6O-OE-fLL" firstAttribute="leading" secondItem="67K-DS-g25" secondAttribute="leading" constant="2" id="gGk-kh-DJE"/>
<constraint firstItem="gCh-ar-0UC" firstAttribute="leading" secondItem="h6O-OE-fLL" secondAttribute="leading" id="uW4-3v-OJB"/>
</constraints>
<connections>
<outlet property="statusTextField" destination="gCh-ar-0UC" id="SsZ-8C-G5H"/>
<outlet property="textField" destination="h6O-OE-fLL" id="aWF-6i-YlN"/>
<outlet property="textField" destination="gZz-x5-KVH" id="1HS-lu-tZv"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn width="378" minWidth="10" maxWidth="3.4028234663852886e+38" id="g1Q-BS-vCR">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Status">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="Pl1-4o-5uY">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="RMm-PO-UNp">
<rect key="frame" x="216" y="1" width="378" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="RBa-0B-xVt">
<rect key="frame" x="0.0" y="0.0" width="378" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="ZIf-CU-gh7">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="RBa-0B-xVt" id="d6i-pV-UrO"/>
</connections>
</tableCellView>
</prototypeCellViews>
@@ -101,7 +150,7 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
<tableHeaderView key="headerView" id="uVe-04-Now">
<rect key="frame" x="0.0" y="0.0" width="398" height="23"/>
<rect key="frame" x="0.0" y="0.0" width="596" height="23"/>
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
</scrollView>
@@ -116,7 +165,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Pkh-la-7FU">
<rect key="frame" x="354" y="13" width="72" height="32"/>
<rect key="frame" x="552" y="13" width="72" height="32"/>
<buttonCell key="cell" type="push" title="Done" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="j9a-fn-Pye">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -138,7 +187,7 @@
<constraint firstItem="Pkh-la-7FU" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="bGv-Zc-Vrk" secondAttribute="trailing" constant="12" symbolic="YES" id="lUQ-jf-KWR"/>
<constraint firstItem="bGv-Zc-Vrk" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="tk3-kF-k22"/>
</constraints>
<point key="canvasLocation" x="-377" y="109.5"/>
<point key="canvasLocation" x="-476" y="109.5"/>
</customView>
</objects>
</document>

View File

@@ -44,8 +44,7 @@
"ALERT_MERGE_CONTINUE" = "Merge files!";
/* Informative text displayed when merging KDB files */
"ALERT_MERGE_KDB_FILE_INFO_TEXT" = "KDB databases do not contain enough information for a seamless merge. Entries will get merged and no data is lost. But due to groups only being matched by name unexpected changes might occur. Moved entries might get moved back to their old group, or renamed groups will not get merged. Also deleted entries might reappear due to no information regarding deleted objects being stored. Are you sure you want to proceed?
";
"ALERT_MERGE_KDB_FILE_INFO_TEXT" = "KDB databases do not contain enough information for a seamless merge. Entries will get merged and no data is lost. But due to groups only being matched by name unexpected changes might occur. Moved entries might get moved back to their old group, or renamed groups will not get merged. Also deleted entries might reappear due to no information regarding deleted objects being stored. Are you sure you want to proceed?";
/* Alert message warning user about KDB file merge */
"ALERT_MERGE_KDB_FILE_MESSAGE" = "You are merging a KDB database";
@@ -56,6 +55,12 @@
/* Alert message text to ask the user if he really want to uninstall the plugin. Include %@ placeholder for plugin name */
"ALERT_MESSAGE_TEXT_REALLY_UNINSTALL_PLUGIN_%@" = "Should the Plugin %@ really be uninstalled?";
/* Infromative text of the disabled updates alert! */
"ALERT_UPDATES_DISABLED_INFORMATIVE_TEXT_%@!" = "Updates for this build of %@ are disabled!";
/* Message text for disabled updates alert! */
"ALERT_UPDATES_DISABLED_MESSAGE_TEXT" = "Updates are Disabled!";
/* Attachments column title (shows counts)
Menu item to toggle display of attachment count column in entry table */
"ATTACHMENTS" = "Attachments";
@@ -367,7 +372,7 @@
Notes reference item */
"NOTES" = "Notes";
/* Ok button */
/* Ok Button to dismiss disabled updates alert */
"OK" = "OK";
/* preset to expire after one montch from now */
@@ -441,6 +446,21 @@
/* Window displayed to the user to pick an amout of characters */
"PICKFIELD_WINDOW_TITLE" = "Field Picker";
/* Status for an up-to-date plugin in the plugin browser */
"PLUGIN_BROWSER_LATEST_VERSION_INSTALLED" = "Latest version installed";
/* Status for an outdated plugin version in the plugin browser */
"PLUGIN_BROWSER_NEWER_VERSION_%@_AVAILABLE" = "Newer version(%@) available.";
/* Status for an uninstalled plugin in the plugin browser */
"PLUGIN_BROWSER_PLUGIN_NOT_INSTALLED" = "Not installed";
/* Status for an unkonw plugin version in the plugin browser */
"PLUGIN_BROWSER_UNKNOWN_PLUGIN_VERSION_%@" = "Unknown version installed";
/* Plugin is not with this version of MacPass */
"PLUGIN_ERROR_HOST_VERSION_NOT_SUPPORTED" = "The plugin is not compatible with this version of MacPass";
/* The plugin could not be initalized */
"PLUGIN_ERROR_INTILIZATION_FAILED" = "Plugin could not be initalized";
@@ -572,9 +592,6 @@
/* Update Settings Label */
"UPDATE_SETTINGS" = "Updates";
/* Message text for disabled updates alert! */
"Updates are disabled!" = "Updates are disabled!";
/* Menu item to toggle display of url column in entry table
Submenu with options what to do with the URL of an entry
Url column title