diff --git a/Resources/SampleAppcast.xml b/Resources/SampleAppcast.xml index d07c724d..680c795d 100755 --- a/Resources/SampleAppcast.xml +++ b/Resources/SampleAppcast.xml @@ -11,6 +11,9 @@ https://you.com/app/2.0.html + + https://you.com/app/changelog.php + Wed, 09 Jan 2006 19:20:11 +0000 10.11 @@ -23,6 +26,9 @@ https://you.com/app/1.5.html + + https://you.com/app/changelog.php?up-to=1.5 + Wed, 01 Jan 2006 12:20:11 +0000 10.11 @@ -35,6 +41,9 @@ https://you.com/app/1.4.html + + https://you.com/app/changelog.php?up-to=1.4 + 241 1.4 Wed, 25 Dec 2005 12:20:11 +0000 diff --git a/Sparkle/SPUStandardUserDriver.m b/Sparkle/SPUStandardUserDriver.m index 000cb6ac..440c2bf2 100644 --- a/Sparkle/SPUStandardUserDriver.m +++ b/Sparkle/SPUStandardUserDriver.m @@ -286,8 +286,15 @@ secondaryAction = ^{ [delegate standardUserDriverShowVersionHistoryForAppcastItem:latestAppcastItem]; }; + } else if (latestAppcastItem.fullReleaseNotesURL != nil) { + // Open the full release notes URL if informed + [alert addButtonWithTitle:localizedButtonTitle]; + + secondaryAction = ^{ + [[NSWorkspace sharedWorkspace] openURL:(NSURL * _Nonnull)latestAppcastItem.fullReleaseNotesURL]; + }; } else if (latestAppcastItem.releaseNotesURL != nil) { - // Fall back to opening the release notes URL (or forthcoming full version history link attr!) + // Fall back to opening the release notes URL [alert addButtonWithTitle:localizedButtonTitle]; secondaryAction = ^{ diff --git a/Sparkle/SUAppcastItem.h b/Sparkle/SUAppcastItem.h index 4d79a763..d684411c 100644 --- a/Sparkle/SUAppcastItem.h +++ b/Sparkle/SUAppcastItem.h @@ -163,6 +163,18 @@ SU_EXPORT @interface SUAppcastItem : NSObject */ @property (copy, readonly, nullable) NSString *itemDescription; +/** + The full release notes URL of the appcast item if provided. + + This external link will open when `Version History` button is clicked. The link should point to the product's changelog. + + The delegate `standardUserDriverShowVersionHistoryForAppcastItem` will be used instead if implemented. + If none is set `releaseNotesURL` will be used. + + This is extracted from the @c element. + */ +@property (readonly, nullable) NSURL *fullReleaseNotesURL; + /** The required minimum system operating version string for this update if provided. diff --git a/Sparkle/SUAppcastItem.m b/Sparkle/SUAppcastItem.m index 11cd0c88..8b360079 100644 --- a/Sparkle/SUAppcastItem.m +++ b/Sparkle/SUAppcastItem.m @@ -29,6 +29,7 @@ static NSString *SUAppcastItemDescriptionKey = @"itemDescription"; static NSString *SUAppcastItemMaximumSystemVersionKey = @"maximumSystemVersion"; static NSString *SUAppcastItemMinimumSystemVersionKey = @"minimumSystemVersion"; static NSString *SUAppcastItemReleaseNotesURLKey = @"releaseNotesURL"; +static NSString *SUAppcastItemFullReleaseNotesURLKey = @"fullReleaseNotesURL"; static NSString *SUAppcastItemTitleKey = @"title"; static NSString *SUAppcastItemVersionStringKey = @"versionString"; static NSString *SUAppcastItemPropertiesKey = @"propertiesDictionary"; @@ -65,6 +66,7 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState"; @synthesize maximumSystemVersion = _maximumSystemVersion; @synthesize minimumSystemVersion = _minimumSystemVersion; @synthesize releaseNotesURL = _releaseNotesURL; +@synthesize fullReleaseNotesURL = _fullReleaseNotesURL; @synthesize title = _title; @synthesize versionString = _versionString; @synthesize osString = _osString; @@ -114,6 +116,7 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState"; _minimumSystemVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMinimumSystemVersionKey] copy]; _minimumAutoupdateVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastElementMinimumAutoupdateVersion] copy]; _releaseNotesURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemReleaseNotesURLKey]; + _fullReleaseNotesURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemFullReleaseNotesURLKey]; _title = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemTitleKey] copy]; NSString *versionString = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemVersionStringKey] copy]; @@ -188,6 +191,10 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState"; [encoder encodeObject:self.releaseNotesURL forKey:SUAppcastItemReleaseNotesURLKey]; } + if (self.fullReleaseNotesURL != nil) { + [encoder encodeObject:self.fullReleaseNotesURL forKey:SUAppcastItemFullReleaseNotesURLKey]; + } + if (self.title != nil) { [encoder encodeObject:self.title forKey:SUAppcastItemTitleKey]; } @@ -543,6 +550,19 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState"; } else { _releaseNotesURL = nil; } + + // Get full release notes URL if informed. + NSString *fullReleaseNotesString = [dict objectForKey:SUAppcastElementFullReleaseNotesLink]; + if (fullReleaseNotesString) { + NSURL *url = [NSURL URLWithString:fullReleaseNotesString]; + if ([url isFileURL]) { + SULog(SULogLevelError, @"Full release notes with file:// URLs are not supported"); + } else { + _fullReleaseNotesURL = url; + } + } else { + _fullReleaseNotesURL = nil; + } NSArray *deltaDictionaries = [dict objectForKey:SUAppcastElementDeltas]; if (deltaDictionaries) { diff --git a/Sparkle/SUConstants.h b/Sparkle/SUConstants.h index 5655008d..5212ca4f 100644 --- a/Sparkle/SUConstants.h +++ b/Sparkle/SUConstants.h @@ -89,6 +89,7 @@ extern NSString *const SUAppcastElementMinimumAutoupdateVersion; extern NSString *const SUAppcastElementMinimumSystemVersion; extern NSString *const SUAppcastElementMaximumSystemVersion; extern NSString *const SUAppcastElementReleaseNotesLink; +extern NSString *const SUAppcastElementFullReleaseNotesLink; extern NSString *const SUAppcastElementTags; extern NSString *const SUAppcastElementPhasedRolloutInterval; extern NSString *const SUAppcastElementInformationalUpdate; diff --git a/Sparkle/SUConstants.m b/Sparkle/SUConstants.m index d64c1daa..038e8add 100644 --- a/Sparkle/SUConstants.m +++ b/Sparkle/SUConstants.m @@ -86,6 +86,7 @@ NSString *const SUAppcastElementMinimumAutoupdateVersion = @"sparkle:minimumAuto NSString *const SUAppcastElementMinimumSystemVersion = @"sparkle:minimumSystemVersion"; NSString *const SUAppcastElementMaximumSystemVersion = @"sparkle:maximumSystemVersion"; NSString *const SUAppcastElementReleaseNotesLink = @"sparkle:releaseNotesLink"; +NSString *const SUAppcastElementFullReleaseNotesLink = @"sparkle:fullReleaseNotesLink"; NSString *const SUAppcastElementTags = @"sparkle:tags"; NSString *const SUAppcastElementPhasedRolloutInterval = @"sparkle:phasedRolloutInterval"; NSString *const SUAppcastElementInformationalUpdate = @"sparkle:informationalUpdate";