Adds standard user driver delegate method for responding to Version History button (#1989)

This commit is contained in:
Billy Gray authored and GitHub committed 2021-10-29 16:59:48 -07:00
1 parent a81f8f3d2d
commit e48edc6856
2 files changed
+24 -3

No files matched your search

+15 -3
View File
@@ -274,9 +274,21 @@
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)];
// Show the user the past version history if available
NSString *localizedButtonTitle = SULocalizedString(@"Version History", nil);
// Check if the delegate implements a Version History action
id <SPUStandardUserDriverDelegate> delegate = self.delegate;
if ([delegate respondsToSelector:@selector(standardUserDriverShowVersionHistoryForAppcastItem:)]) {
[alert addButtonWithTitle:localizedButtonTitle];
secondaryAction = ^{
[delegate standardUserDriverShowVersionHistoryForAppcastItem:latestAppcastItem];
};
} else if (latestAppcastItem.releaseNotesURL != nil) {
// Fall back to opening the release notes URL (or forthcoming full version history link attr!)
[alert addButtonWithTitle:localizedButtonTitle];
secondaryAction = ^{
[[NSWorkspace sharedWorkspace] openURL:(NSURL * _Nonnull)latestAppcastItem.releaseNotesURL];
+9
View File
@@ -45,4 +45,13 @@ SU_EXPORT @protocol SPUStandardUserDriverDelegate <NSObject>
*/
- (_Nullable id <SUVersionDisplay>)standardUserDriverRequestsVersionDisplayer;
/**
Called if implemented when the Version History button is chosen by the user. Otherwise,
the `fullReleaseNotesLink` or `releaseNotesLink` in the appcast's latest item will be be
opened.
@param item The appcast item corresponding to the latest version available.
*/
- (void)standardUserDriverShowVersionHistoryForAppcastItem:(SUAppcastItem *_Nonnull)item;
@end