mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 19:22:25 +00:00
Using correct plugn repository using fake plugin count
This commit is contained in:
@@ -51,6 +51,7 @@ NSString *const MPPluginRepositoryDidUpdateAvailablePluginsNotification = @"com.
|
||||
self = [super init];
|
||||
if(self) {
|
||||
_isInitialized = NO;
|
||||
_lastDataFetchTime = NSDate.distantPast.timeIntervalSinceReferenceDate;
|
||||
[self fetchRepositoryDataCompletionHandler:^(NSArray<MPPluginRepositoryItem *> * _Nonnull availablePlugins) {
|
||||
self.availablePlugins = availablePlugins;
|
||||
self.isInitialized = YES;
|
||||
|
||||
@@ -47,12 +47,12 @@ typedef NS_ENUM(NSUInteger, MPPluginTableColumn) {
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
|
||||
return self.repositoryItems.count > 0 ? 100 : 0;
|
||||
return self.repositoryItems.count;
|
||||
}
|
||||
|
||||
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
|
||||
NSTableCellView *view = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];
|
||||
MPPluginRepositoryItem *item = self.repositoryItems.firstObject;
|
||||
MPPluginRepositoryItem *item = self.repositoryItems[row];
|
||||
|
||||
NSUInteger column = [tableView.tableColumns indexOfObjectIdenticalTo:tableColumn];
|
||||
|
||||
@@ -64,8 +64,8 @@ typedef NS_ENUM(NSUInteger, MPPluginTableColumn) {
|
||||
}
|
||||
else if(column == MPPluginTableColumnStatus) {
|
||||
MPPlugin *plugin = [MPPluginHost.sharedHost pluginWithBundleIdentifier:item.bundleIdentifier];
|
||||
if(!plugin) {
|
||||
switch([plugin.shortVersionString compare:item.currentVersion]) {
|
||||
if(plugin) {
|
||||
switch([MPPluginVersionComparator compareVersion:plugin.shortVersionString toVersion: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;
|
||||
|
||||
@@ -5,12 +5,16 @@
|
||||
// Created by Michael Starke on 05.10.18.
|
||||
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
// Code is based upon SUStandardVersionComparator.h from Sparkle
|
||||
// Changes include:
|
||||
// * wildcard matching
|
||||
// * correct handling of trailing parts (e.g. 3. == 3.0 == 3.0.0)
|
||||
//
|
||||
|
||||
#import "MPPluginVersionComparator.h"
|
||||
|
||||
@implementation MPPluginVersionComparator
|
||||
|
||||
|
||||
+ (MPVersionCharacterType)typeOfCharacter:(NSString *)character {
|
||||
if([character isEqualToString:@"."]) {
|
||||
return kMPVersionCharacterTypeSeparator;
|
||||
@@ -114,7 +118,7 @@
|
||||
longerResult = NSOrderedAscending;
|
||||
|
||||
}
|
||||
/* check if wildcard was last part, then the rest does not matter */
|
||||
/* check if wildcard was last part of shorter version, then the rest does not matter */
|
||||
if(lastShortType == kMPVersionCharacterTypeWildcard) {
|
||||
return NSOrderedSame;
|
||||
}
|
||||
@@ -131,13 +135,12 @@
|
||||
return longerResult;
|
||||
}
|
||||
}
|
||||
// versions are considered the same as long as 0, separators or wildcards follow
|
||||
/* Any separator or widlcard that is in the longer version is skippes since we do not have to match components anymore */
|
||||
}
|
||||
}
|
||||
return NSOrderedSame;
|
||||
}
|
||||
|
||||
|
||||
+ (NSArray<NSString *> *)splitVersionString:(NSString *)versionString {
|
||||
if(versionString.length == 0) {
|
||||
return @[];
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<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"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="599" height="408"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<size key="intercellSpacing" width="3" height="2"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -64,8 +64,8 @@
|
||||
</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">
|
||||
<tableColumn width="88" minWidth="10" maxWidth="3.4028234663852886e+38" id="hFg-AD-SqD">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Latest Version">
|
||||
<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"/>
|
||||
@@ -78,11 +78,11 @@
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView id="AKl-7g-maS">
|
||||
<rect key="frame" x="149" y="1" width="64" height="17"/>
|
||||
<rect key="frame" x="149" y="1" width="88" 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"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="88" 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"/>
|
||||
@@ -97,7 +97,7 @@
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
<tableColumn width="378" minWidth="10" maxWidth="3.4028234663852886e+38" id="g1Q-BS-vCR">
|
||||
<tableColumn width="357" 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"/>
|
||||
@@ -111,11 +111,11 @@
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView id="RMm-PO-UNp">
|
||||
<rect key="frame" x="216" y="1" width="378" height="17"/>
|
||||
<rect key="frame" x="240" y="1" width="357" 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"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="357" 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"/>
|
||||
@@ -141,8 +141,8 @@
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="400" id="gYM-eK-y5v"/>
|
||||
</constraints>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="ajb-Vb-WhY">
|
||||
<rect key="frame" x="1" y="415" width="398" height="16"/>
|
||||
<scroller key="horizontalScroller" verticalHuggingPriority="750" horizontal="YES" id="ajb-Vb-WhY">
|
||||
<rect key="frame" x="1" y="415" width="596" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="3eJ-oK-GNt">
|
||||
@@ -150,7 +150,7 @@
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
<tableHeaderView key="headerView" id="uVe-04-Now">
|
||||
<rect key="frame" x="0.0" y="0.0" width="596" height="23"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="599" height="23"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</tableHeaderView>
|
||||
</scrollView>
|
||||
|
||||
Reference in New Issue
Block a user