mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Merge branch '2.x' into channels
This commit is contained in:
commit
c329319b0c
16 files changed
+165
-40
No files matched your search
@@ -6,32 +6,39 @@
|
||||
<language>en</language>
|
||||
<item>
|
||||
<title>Version 2.0 (2 bugs fixed; 3 new features)</title>
|
||||
<link>http://sparkle-project.org</link>
|
||||
<sparkle:version>2.0</sparkle:version>
|
||||
<sparkle:releaseNotesLink>
|
||||
http://you.com/app/2.0.html
|
||||
</sparkle:releaseNotesLink>
|
||||
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
|
||||
<enclosure url="http://you.com/app/Your%20Great%20App%202.0.zip" sparkle:version="2.0" length="1623481" type="application/octet-stream" sparkle:edSignature="WVyVJpOx+a5+vNWJVY79TRjFKveNk+VhGJf2iti4CZtJsJewIUGvh/1AKKEAFbH1qUwx+vro1ECuzOsMmumoBA==" />
|
||||
<enclosure url="http://you.com/app/Your%20Great%20App%202.0.zip" length="1623481" type="application/octet-stream" sparkle:edSignature="WVyVJpOx+a5+vNWJVY79TRjFKveNk+VhGJf2iti4CZtJsJewIUGvh/1AKKEAFbH1qUwx+vro1ECuzOsMmumoBA==" />
|
||||
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Version 1.5 (8 bugs fixed; 2 new features)</title>
|
||||
<link>http://sparkle-project.org</link>
|
||||
<sparkle:version>1.5</sparkle:version>
|
||||
<sparkle:releaseNotesLink>
|
||||
http://you.com/app/1.5.html
|
||||
</sparkle:releaseNotesLink>
|
||||
<pubDate>Wed, 01 Jan 2006 12:20:11 +0000</pubDate>
|
||||
<enclosure url="http://you.com/app/Your%20Great%20App%201.5.zip" sparkle:version="1.5" length="1472893" type="application/octet-stream" sparkle:edSignature="pNFd7KbcQSu+Mq7UYrbQXTPq82luht2ACXm/r2utp1u/Uv/5hWqctdT2jwQgMejW7DRoeV/hVr6J4VdZYdwWDw==" />
|
||||
<enclosure url="http://you.com/app/Your%20Great%20App%201.5.zip" length="1472893" type="application/octet-stream" sparkle:edSignature="pNFd7KbcQSu+Mq7UYrbQXTPq82luht2ACXm/r2utp1u/Uv/5hWqctdT2jwQgMejW7DRoeV/hVr6J4VdZYdwWDw==" />
|
||||
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
|
||||
<!-- Now here's an example of a version with a weird internal version number (like an SVN revision) but a human-readable external one. -->
|
||||
<item>
|
||||
<title>Version 1.4 (5 bugs fixed; 2 new features)</title>
|
||||
<link>http://sparkle-project.org</link>
|
||||
<sparkle:releaseNotesLink>
|
||||
http://you.com/app/1.4.html
|
||||
</sparkle:releaseNotesLink>
|
||||
<sparkle:version>241</sparkle:version>
|
||||
<sparkle:shortVersionString>1.4</sparkle:shortVersionString>
|
||||
<pubDate>Wed, 25 Dec 2005 12:20:11 +0000</pubDate>
|
||||
<enclosure url="http://you.com/app/Your%20Great%20App%201.4.zip" sparkle:version="241" sparkle:shortVersionString="1.4" sparkle:edSignature="Ody3D/ybSMH4T+P/oNj3LN4F0SA8RJGLEr1TI4UemrBAiJ9aEcDnYV3u58P75AbcFjI13jPYmHDUHXMSTFQbDw==" length="1472349" type="application/octet-stream" />
|
||||
<enclosure url="http://you.com/app/Your%20Great%20App%201.4.zip" sparkle:edSignature="Ody3D/ybSMH4T+P/oNj3LN4F0SA8RJGLEr1TI4UemrBAiJ9aEcDnYV3u58P75AbcFjI13jPYmHDUHXMSTFQbDw==" length="1472349" type="application/octet-stream" />
|
||||
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
</channel>
|
||||
|
||||
Vendored
+3
@@ -143,6 +143,9 @@
|
||||
|
||||
"%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@." = "%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@.";
|
||||
|
||||
/* Used when a new update is not found */
|
||||
"Version History" = "Version History";
|
||||
|
||||
/* Authorization message shown when app wants permission to update itself. */
|
||||
"%1$@ wants permission to update." = "%1$@ wants permission to update.";
|
||||
|
||||
|
||||
Vendored
+26
-6
@@ -171,6 +171,7 @@
|
||||
NSString *recoverySuggestion;
|
||||
NSString *recoveryOption;
|
||||
|
||||
SPUNoUpdateFoundReason reason;
|
||||
if (latestAppcastItem != nil) {
|
||||
switch (hostToLatestAppcastItemComparisonResult) {
|
||||
case NSOrderedDescending:
|
||||
@@ -178,12 +179,16 @@
|
||||
localizedDescription = SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
|
||||
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.\n(You are currently running version %@.)", nil), [self.host name], latestAppcastItem.displayVersionString, [self.host displayVersion]];
|
||||
|
||||
reason = SPUNoUpdateFoundReasonOnNewerThanLatestVersion;
|
||||
break;
|
||||
case NSOrderedSame:
|
||||
// No new update is available and we're on the latest
|
||||
localizedDescription = SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
|
||||
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
|
||||
|
||||
reason = SPUNoUpdateFoundReasonOnLatestVersion;
|
||||
break;
|
||||
case NSOrderedAscending:
|
||||
// This means a new update doesn't match the OS requirements
|
||||
@@ -191,15 +196,21 @@
|
||||
localizedDescription = SULocalizedString(@"Your macOS version is too old", nil);
|
||||
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required.", nil), [self.host name], latestAppcastItem.versionString, latestAppcastItem.minimumSystemVersion];
|
||||
|
||||
reason = SPUNoUpdateFoundReasonSystemIsTooOld;
|
||||
} else if (!latestAppcastItem.maximumOperatingSystemVersionIsOK) {
|
||||
localizedDescription = SULocalizedString(@"Your macOS version is too new", nil);
|
||||
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@.", nil), [self.host name], latestAppcastItem.versionString, latestAppcastItem.maximumSystemVersion];
|
||||
|
||||
reason = SPUNoUpdateFoundReasonSystemIsTooNew;
|
||||
} else {
|
||||
// We shouldn't realistically get here
|
||||
localizedDescription = SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
|
||||
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
|
||||
|
||||
reason = SPUNoUpdateFoundReasonUnknown;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -210,6 +221,20 @@
|
||||
// There could be update items on channels the updater is not subscribed to for example. But we can't tell the user about them.
|
||||
localizedDescription = SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
|
||||
|
||||
reason = SPUNoUpdateFoundReasonUnknown;
|
||||
}
|
||||
|
||||
NSMutableDictionary *userInfo =
|
||||
[NSMutableDictionary dictionaryWithDictionary:@{
|
||||
NSLocalizedDescriptionKey: localizedDescription,
|
||||
NSLocalizedRecoverySuggestionErrorKey: recoverySuggestion,
|
||||
NSLocalizedRecoveryOptionsErrorKey: @[recoveryOption],
|
||||
SPUNoUpdateFoundReasonKey: @(reason),
|
||||
}];
|
||||
|
||||
if (latestAppcastItem != nil) {
|
||||
userInfo[SPULatestAppcastItemFoundKey] = latestAppcastItem;
|
||||
}
|
||||
|
||||
recoveryOption = SULocalizedString(@"OK", nil);
|
||||
@@ -218,12 +243,7 @@
|
||||
[NSError
|
||||
errorWithDomain:SUSparkleErrorDomain
|
||||
code:SUNoUpdateError
|
||||
userInfo:@{
|
||||
NSLocalizedDescriptionKey: localizedDescription,
|
||||
NSLocalizedRecoverySuggestionErrorKey: recoverySuggestion,
|
||||
NSLocalizedRecoveryOptionsErrorKey: @[recoveryOption]
|
||||
}
|
||||
];
|
||||
userInfo:[userInfo copy]];
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:notFoundError];
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+47
-5
@@ -20,6 +20,7 @@
|
||||
#import "SUApplicationInfo.h"
|
||||
#import "SUOperatingSystem.h"
|
||||
#import "SPUUserUpdateState.h"
|
||||
#import "SUErrors.h"
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
@@ -250,7 +251,7 @@
|
||||
alert.messageText = SULocalizedString(@"Update Error!", nil);
|
||||
alert.informativeText = [NSString stringWithFormat:@"%@", [error localizedDescription]];
|
||||
[alert addButtonWithTitle:SULocalizedString(@"Cancel Update", nil)];
|
||||
[self showAlert:alert];
|
||||
[self showAlert:alert secondaryAction:nil];
|
||||
|
||||
acknowledgement();
|
||||
}
|
||||
@@ -263,12 +264,49 @@
|
||||
|
||||
NSAlert *alert = [NSAlert alertWithError:error];
|
||||
alert.alertStyle = NSAlertStyleInformational;
|
||||
[self showAlert:alert];
|
||||
|
||||
// Can we give more information to the user?
|
||||
SPUNoUpdateFoundReason reason = (SPUNoUpdateFoundReason)[(NSNumber *)error.userInfo[SPUNoUpdateFoundReasonKey] integerValue];
|
||||
|
||||
void (^secondaryAction)(void) = nil;
|
||||
SUAppcastItem *latestAppcastItem = error.userInfo[SPULatestAppcastItemFoundKey];
|
||||
if (latestAppcastItem != nil) {
|
||||
switch (reason) {
|
||||
case SPUNoUpdateFoundReasonOnLatestVersion:
|
||||
case SPUNoUpdateFoundReasonOnNewerThanLatestVersion: {
|
||||
if (latestAppcastItem.releaseNotesURL != nil) {
|
||||
// Show the user the past version history if available
|
||||
[alert addButtonWithTitle:SULocalizedString(@"Version History", nil)];
|
||||
|
||||
secondaryAction = ^{
|
||||
[[NSWorkspace sharedWorkspace] openURL:(NSURL * _Nonnull)latestAppcastItem.releaseNotesURL];
|
||||
};
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SPUNoUpdateFoundReasonSystemIsTooOld:
|
||||
case SPUNoUpdateFoundReasonSystemIsTooNew:
|
||||
if (latestAppcastItem.infoURL != nil) {
|
||||
// Show the user the product's link if available
|
||||
[alert addButtonWithTitle:SULocalizedString(@"Learn More...", nil)];
|
||||
|
||||
secondaryAction = ^{
|
||||
[[NSWorkspace sharedWorkspace] openURL:(NSURL * _Nonnull)latestAppcastItem.infoURL];
|
||||
};
|
||||
}
|
||||
break;
|
||||
case SPUNoUpdateFoundReasonUnknown:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[self showAlert:alert secondaryAction:secondaryAction];
|
||||
|
||||
acknowledgement();
|
||||
}
|
||||
|
||||
- (void)showAlert:(NSAlert *)alert
|
||||
- (void)showAlert:(NSAlert *)alert secondaryAction:(void (^ _Nullable)(void))secondaryAction
|
||||
{
|
||||
id <SPUStandardUserDriverDelegate> delegate = self.delegate;
|
||||
|
||||
@@ -281,7 +319,11 @@
|
||||
if ([SUApplicationInfo isBackgroundApplication:[NSApplication sharedApplication]]) { [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; }
|
||||
|
||||
[alert setIcon:[SUApplicationInfo bestIconForHost:self.host]];
|
||||
[alert runModal];
|
||||
|
||||
NSModalResponse response = [alert runModal];
|
||||
if (response == NSAlertSecondButtonReturn && secondaryAction != nil) {
|
||||
secondaryAction();
|
||||
}
|
||||
|
||||
if ([delegate respondsToSelector:@selector(standardUserDriverDidShowModalAlert)]) {
|
||||
[delegate standardUserDriverDidShowModalAlert];
|
||||
@@ -435,7 +477,7 @@
|
||||
} else {
|
||||
alert.informativeText = [NSString stringWithFormat:SULocalizedString(@"%@ is now updated!", nil), hostName];
|
||||
}
|
||||
[self showAlert:alert];
|
||||
[self showAlert:alert secondaryAction:nil];
|
||||
}
|
||||
|
||||
acknowledgement();
|
||||
|
||||
Vendored
+8
@@ -116,6 +116,14 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* Before this point, -showUserInitiatedUpdateCheckWithCancellation: may be called.
|
||||
*
|
||||
* @param error The error associated with why a new update was not found.
|
||||
* There are various reasons a new update is unavailable and can't be installed.
|
||||
* This error object is populated with recovery and suggestion strings suitable to be shown in an alert.
|
||||
*
|
||||
* The userInfo dictionary is also populated with two keys:
|
||||
* SPULatestAppcastItemFoundKey: if available, this may provide the latest SUAppcastItem that was found.
|
||||
* SPUNoUpdateFoundReasonKey: if available, this will provide the SUNoUpdateFoundReason. For example the reason could be because
|
||||
* the latest version in the feed requires a newer OS version or could be because the user is already on the latest version.
|
||||
*
|
||||
* @param acknowledgement Acknowledge to the updater that no update found error was shown.
|
||||
*/
|
||||
- (void)showUpdateNotFoundWithError:(NSError *)error acknowledgement:(void (^)(void))acknowledgement;
|
||||
|
||||
Vendored
+11
-7
@@ -319,23 +319,28 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_title = [(NSString *)[dict objectForKey:SURSSElementTitle] copy];
|
||||
|
||||
NSDictionary *enclosure = [dict objectForKey:SURSSElementEnclosure];
|
||||
|
||||
// Try to find a version string.
|
||||
// Finding the new version number from the RSS feed is a little bit hacky. There are two ways:
|
||||
// Finding the new version number from the RSS feed is a little bit hacky. There are a few ways:
|
||||
// 1. A "sparkle:version" attribute on the enclosure tag, an extension from the RSS spec.
|
||||
// 2. If there isn't a version attribute, Sparkle will parse the path in the enclosure, expecting
|
||||
// 2. If there isn't a version attribute, see if there is a version element (this is now the recommended path).
|
||||
// 3. If there isn't a version element, Sparkle will parse the path in the enclosure, expecting
|
||||
// that it will look like this: http://something.com/YourApp_0.5.zip. It'll read whatever's between the last
|
||||
// underscore and the last period as the version number. So name your packages like this: APPNAME_VERSION.extension.
|
||||
// The big caveat with this is that you can't have underscores in your version strings, as that'll confuse Sparkle.
|
||||
// Feel free to change the separator string to a hyphen or something more suited to your needs if you like.
|
||||
NSString *newVersion = [enclosure objectForKey:SUAppcastAttributeVersion];
|
||||
if (newVersion == nil) {
|
||||
newVersion = [dict objectForKey:SUAppcastAttributeVersion]; // Get version from the item, in case it's a download-less item (i.e. paid upgrade).
|
||||
// Get version from the item
|
||||
newVersion = [dict objectForKey:SUAppcastElementVersion];
|
||||
}
|
||||
if (newVersion == nil) // no sparkle:version attribute anywhere?
|
||||
if (newVersion == nil)
|
||||
{
|
||||
SULog(SULogLevelError, @"warning: <%@> for URL '%@' is missing %@ attribute. Version comparison may be unreliable. Please always specify %@", SURSSElementEnclosure, [enclosure objectForKey:SURSSAttributeURL], SUAppcastAttributeVersion, SUAppcastAttributeVersion);
|
||||
// No sparkle:version element/attribute anywhere?
|
||||
SULog(SULogLevelError, @"warning: Item '%@' is missing '<%@>' element. Version comparison may be unreliable. Please always specify %@", _title, SUAppcastElementVersion, SUAppcastElementVersion);
|
||||
|
||||
// Separate the url by underscores and take the last component, as that'll be closest to the end,
|
||||
// then we remove the extension. Hopefully, this will be the version.
|
||||
@@ -347,7 +352,7 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
||||
|
||||
if (!newVersion) {
|
||||
if (error) {
|
||||
*error = [NSString stringWithFormat:@"Feed item lacks %@ attribute, and version couldn't be deduced from file name (would have used last component of a file name like AppName_1.3.4.zip)", SUAppcastAttributeVersion];
|
||||
*error = [NSString stringWithFormat:@"Feed item lacks %@ element, and version couldn't be deduced from file name (would have used last component of a file name like AppName_1.3.4.zip)", SUAppcastElementVersion];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
@@ -360,7 +365,6 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
||||
}
|
||||
|
||||
_propertiesDictionary = [[NSDictionary alloc] initWithDictionary:dict];
|
||||
_title = [(NSString *)[dict objectForKey:SURSSElementTitle] copy];
|
||||
_dateString = [(NSString *)[dict objectForKey:SURSSElementPubDate] copy];
|
||||
_itemDescription = [(NSString *)[dict objectForKey:SURSSElementDescription] copy];
|
||||
|
||||
|
||||
Vendored
+2
@@ -77,6 +77,8 @@ extern NSString *const SUAppcastAttributeVersion;
|
||||
extern NSString *const SUAppcastAttributeOsType;
|
||||
extern NSString *const SUAppcastAttributeInstallationType;
|
||||
|
||||
extern NSString *const SUAppcastElementVersion;
|
||||
extern NSString *const SUAppcastElementShortVersionString;
|
||||
extern NSString *const SUAppcastElementCriticalUpdate;
|
||||
extern NSString *const SUAppcastElementDeltas;
|
||||
extern NSString *const SUAppcastElementMinimumAutoupdateVersion;
|
||||
|
||||
Vendored
+4
@@ -57,6 +57,8 @@ NSString *const SUEnableJavaScriptKey = @"SUEnableJavaScript";
|
||||
NSString *const SUFixedHTMLDisplaySizeKey = @"SUFixedHTMLDisplaySize";
|
||||
NSString *const SUDefaultsDomainKey = @"SUDefaultsDomain";
|
||||
NSString *const SUSparkleErrorDomain = @"SUSparkleErrorDomain";
|
||||
NSString *const SPUNoUpdateFoundReasonKey = @"SUNoUpdateFoundReason";
|
||||
NSString *const SPULatestAppcastItemFoundKey = @"SULatestAppcastItemFound";
|
||||
|
||||
NSString *const SUAppendVersionNumberKey = @"SUAppendVersionNumber";
|
||||
NSString *const SUEnableAutomatedDowngradesKey = @"SUEnableAutomatedDowngrades";
|
||||
@@ -71,6 +73,8 @@ NSString *const SUAppcastAttributeVersion = @"sparkle:version";
|
||||
NSString *const SUAppcastAttributeOsType = @"sparkle:os";
|
||||
NSString *const SUAppcastAttributeInstallationType = @"sparkle:installationType";
|
||||
|
||||
NSString *const SUAppcastElementVersion = SUAppcastAttributeVersion;
|
||||
NSString *const SUAppcastElementShortVersionString = SUAppcastAttributeShortVersionString;
|
||||
NSString *const SUAppcastElementCriticalUpdate = @"sparkle:criticalUpdate";
|
||||
NSString *const SUAppcastElementDeltas = @"sparkle:deltas";
|
||||
NSString *const SUAppcastElementMinimumAutoupdateVersion = @"sparkle:minimumAutoupdateVersion";
|
||||
|
||||
Vendored
+11
@@ -78,4 +78,15 @@ typedef NS_ENUM(OSStatus, SUError) {
|
||||
SUIncorrectAPIUsageError = 5000
|
||||
};
|
||||
|
||||
typedef NS_ENUM(OSStatus, SPUNoUpdateFoundReason) {
|
||||
SPUNoUpdateFoundReasonUnknown,
|
||||
SPUNoUpdateFoundReasonOnLatestVersion,
|
||||
SPUNoUpdateFoundReasonOnNewerThanLatestVersion,
|
||||
SPUNoUpdateFoundReasonSystemIsTooOld,
|
||||
SPUNoUpdateFoundReasonSystemIsTooNew
|
||||
};
|
||||
|
||||
SU_EXPORT extern NSString *const SPUNoUpdateFoundReasonKey;
|
||||
SU_EXPORT extern NSString *const SPULatestAppcastItemFoundKey;
|
||||
|
||||
#endif
|
||||
@@ -6,6 +6,7 @@
|
||||
<language>en</language>
|
||||
<item>
|
||||
<title>Version 2.0</title>
|
||||
<sparkle:version>2.0</sparkle:version>
|
||||
<description>
|
||||
<![CDATA[
|
||||
<ul>
|
||||
@@ -17,7 +18,7 @@
|
||||
]]>
|
||||
</description>
|
||||
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="2.0" length="$INSERT_ARCHIVE_LENGTH" type="application/octet-stream" sparkle:edSignature="$INSERT_EDDSA_SIGNATURE" />
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="$INSERT_ARCHIVE_LENGTH" type="application/octet-stream" sparkle:edSignature="$INSERT_EDDSA_SIGNATURE" />
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
@@ -6,26 +6,26 @@
|
||||
<title>Version 2.0</title>
|
||||
<description>desc</description>
|
||||
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
|
||||
<!-- Test sparkle:version in enclosure -->
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="2.0" />
|
||||
<sparkle:criticalUpdate sparkle:version="1.5" />
|
||||
</item>
|
||||
<!-- The best chosen release -->
|
||||
<item>
|
||||
<title>Version 3.0</title>
|
||||
<sparkle:version>3.0</sparkle:version>
|
||||
<sparkle:phasedRolloutInterval>86400</sparkle:phasedRolloutInterval>
|
||||
<!-- Test legacy critical update tag -->
|
||||
<sparkle:tags><sparkle:criticalUpdate /></sparkle:tags>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="3.0" length="1346234" />
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||
<sparkle:deltas>
|
||||
<enclosure url="http://localhost:1337/3.0_from_2.0.patch"
|
||||
sparkle:version="3.0"
|
||||
sparkle:deltaFrom="2.0"
|
||||
length="1235"
|
||||
type="application/octet-stream"
|
||||
sparkle:edSignature="..." />
|
||||
|
||||
<enclosure url="http://localhost:1337/3.0_from_1.0.patch"
|
||||
sparkle:version="3.0"
|
||||
sparkle:deltaFrom="1.0"
|
||||
length="1485"
|
||||
type="application/octet-stream"
|
||||
@@ -35,14 +35,16 @@
|
||||
<!-- A release testing minimumSystemVersion -->
|
||||
<item>
|
||||
<title>Version 4.0</title>
|
||||
<sparkle:version>4.0</sparkle:version>
|
||||
<pubDate>Sat, 26 Jul 2014 15:20:13 +0000</pubDate>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="4.0" length="1346234" />
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||
<sparkle:minimumSystemVersion>17.0.0</sparkle:minimumSystemVersion>
|
||||
</item>
|
||||
<!-- A joke release testing maximumSystemVersion -->
|
||||
<item>
|
||||
<title>Version 5.0</title>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="5.0" length="1346234" />
|
||||
<sparkle:version>5.0</sparkle:version>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||
<sparkle:maximumSystemVersion>2.0.0</sparkle:maximumSystemVersion>
|
||||
</item>
|
||||
</channel>
|
||||
|
||||
@@ -23,19 +23,18 @@
|
||||
<item>
|
||||
<title>Version 4.0</title>
|
||||
<pubDate>Sat, 26 Jul 2014 15:20:13 +0000</pubDate>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="4.0" length="1346234" />
|
||||
<sparkle:version>4.0</sparkle:version>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||
<sparkle:informationalUpdate></sparkle:informationalUpdate>
|
||||
<link>http://sparkle-project.org</link>
|
||||
<sparkle:deltas>
|
||||
<enclosure url="http://localhost:1337/3.0_from_2.0.patch"
|
||||
sparkle:version="3.0"
|
||||
<enclosure url="http://localhost:1337/4.0_from_2.0.patch"
|
||||
sparkle:deltaFrom="2.0"
|
||||
length="1235"
|
||||
type="application/octet-stream"
|
||||
sparkle:edSignature="..." />
|
||||
|
||||
<enclosure url="http://localhost:1337/3.0_from_1.0.patch"
|
||||
sparkle:version="3.0"
|
||||
<enclosure url="http://localhost:1337/4.0_from_1.0.patch"
|
||||
sparkle:deltaFrom="1.0"
|
||||
length="1485"
|
||||
type="application/octet-stream"
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
<title>For unit test only</title>
|
||||
<item>
|
||||
<title>Version 3.0</title>
|
||||
<sparkle:version>3.0</sparkle:version>
|
||||
<sparkle:minimumAutoupdateVersion>2.0</sparkle:minimumAutoupdateVersion>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="3.0" length="1346234" />
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||
</item>
|
||||
<item>
|
||||
<title>Version 2.0</title>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="2.0" length="1346234" />
|
||||
<sparkle:version>2.0</sparkle:version>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
@@ -5,8 +5,9 @@
|
||||
<!-- A release testing localized release notes -->
|
||||
<item>
|
||||
<title>Version 6.0</title>
|
||||
<sparkle:version>6.0</sparkle:version>
|
||||
<pubDate>Sat, 26 Jul 2019 15:20:13 +0000</pubDate>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="6.0" />
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" />
|
||||
<sparkle:releaseNotesLink>https://sparkle-project.org/#works</sparkle:releaseNotesLink>
|
||||
<sparkle:releaseNotesLink xml:lang='en'>
|
||||
https://sparkle-project.org/#localized_notes_link_works
|
||||
|
||||
@@ -30,6 +30,7 @@ class SUAppcastTest: XCTestCase {
|
||||
XCTAssertEqual("desc", items[0].itemDescription)
|
||||
XCTAssertEqual("Sat, 26 Jul 2014 15:20:11 +0000", items[0].dateString)
|
||||
XCTAssertTrue(items[0].isCriticalUpdate)
|
||||
XCTAssertEqual(items[0].versionString, "2.0")
|
||||
|
||||
// This is the best release matching our system version
|
||||
XCTAssertEqual("Version 3.0", items[1].title)
|
||||
@@ -37,6 +38,7 @@ class SUAppcastTest: XCTestCase {
|
||||
XCTAssertNil(items[1].dateString)
|
||||
XCTAssertTrue(items[1].isCriticalUpdate)
|
||||
XCTAssertEqual(items[1].phasedRolloutInterval, 86400)
|
||||
XCTAssertEqual(items[1].versionString, "3.0")
|
||||
|
||||
XCTAssertEqual("Version 4.0", items[2].title)
|
||||
XCTAssertNil(items[2].itemDescription)
|
||||
@@ -58,6 +60,7 @@ class SUAppcastTest: XCTestCase {
|
||||
|
||||
XCTAssertEqual(bestAppcastItem, items[1])
|
||||
XCTAssertEqual(deltaItem!.fileURL!.lastPathComponent, "3.0_from_1.0.patch")
|
||||
XCTAssertEqual(deltaItem!.versionString, "3.0")
|
||||
|
||||
// Test latest delta update item available
|
||||
var latestDeltaItem: SUAppcastItem?
|
||||
|
||||
@@ -71,7 +71,13 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
|
||||
var numItems = 0
|
||||
for update in updates {
|
||||
var item: XMLElement
|
||||
let existingItems = try channel.nodes(forXPath: "item[enclosure[@sparkle:version=\"\(update.version)\"]]")
|
||||
|
||||
var existingItems = try channel.nodes(forXPath: "item[enclosure[@\(SUAppcastAttributeVersion)=\"\(update.version)\"]]")
|
||||
if existingItems.count == 0 {
|
||||
// Fall back to see if any items are using the element version variant
|
||||
existingItems = try channel.nodes(forXPath: "item[\(SUAppcastElementVersion)=\"\(update.version)\"]")
|
||||
}
|
||||
|
||||
let createNewItem = existingItems.count == 0
|
||||
|
||||
// Update all old items, but aim for less than 5 in new feeds
|
||||
@@ -93,6 +99,20 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
|
||||
if nil == findElement(name: "pubDate", parent: item) {
|
||||
item.addChild(XMLElement.element(withName: "pubDate", stringValue: update.pubDate) as! XMLElement)
|
||||
}
|
||||
|
||||
var versionElement = findElement(name: SUAppcastElementVersion, parent: item)
|
||||
if nil == versionElement {
|
||||
versionElement = XMLElement.element(withName: SUAppcastElementVersion, uri: sparkleNS) as? XMLElement
|
||||
item.addChild(versionElement!)
|
||||
}
|
||||
versionElement?.setChildren([text(update.version)])
|
||||
|
||||
var shortVersionElement = findElement(name: SUAppcastElementShortVersionString, parent: item)
|
||||
if nil == shortVersionElement {
|
||||
shortVersionElement = XMLElement.element(withName: SUAppcastElementShortVersionString, uri: sparkleNS) as? XMLElement
|
||||
item.addChild(shortVersionElement!)
|
||||
}
|
||||
shortVersionElement?.setChildren([text(update.shortVersion)])
|
||||
|
||||
if let html = update.releaseNotesHTML {
|
||||
let descElement = findOrCreateElement(name: "description", parent: item)
|
||||
@@ -157,8 +177,6 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
|
||||
}
|
||||
var attributes = [
|
||||
XMLNode.attribute(withName: "url", stringValue: archiveURL) as! XMLNode,
|
||||
XMLNode.attribute(withName: SUAppcastAttributeVersion, uri: sparkleNS, stringValue: update.version) as! XMLNode,
|
||||
XMLNode.attribute(withName: SUAppcastAttributeShortVersionString, uri: sparkleNS, stringValue: update.shortVersion) as! XMLNode,
|
||||
XMLNode.attribute(withName: "length", stringValue: String(update.fileSize)) as! XMLNode,
|
||||
XMLNode.attribute(withName: "type", stringValue: update.mimeType) as! XMLNode,
|
||||
]
|
||||
@@ -181,8 +199,6 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem]) throws {
|
||||
for delta in update.deltas {
|
||||
var attributes = [
|
||||
XMLNode.attribute(withName: "url", stringValue: URL(string: delta.archivePath.lastPathComponent.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlPathAllowed)!, relativeTo: update.archiveURL)!.absoluteString) as! XMLNode,
|
||||
XMLNode.attribute(withName: SUAppcastAttributeVersion, uri: sparkleNS, stringValue: update.version) as! XMLNode,
|
||||
XMLNode.attribute(withName: SUAppcastAttributeShortVersionString, uri: sparkleNS, stringValue: update.shortVersion) as! XMLNode,
|
||||
XMLNode.attribute(withName: SUAppcastAttributeDeltaFrom, uri: sparkleNS, stringValue: delta.fromVersion) as! XMLNode,
|
||||
XMLNode.attribute(withName: "length", stringValue: String(delta.fileSize)) as! XMLNode,
|
||||
XMLNode.attribute(withName: "type", stringValue: "application/octet-stream") as! XMLNode,
|
||||
|
||||
Reference in new issue
Block a user