mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Adds standard user driver delegate method for responding to Version History button (#1989)
This commit is contained in:
1 parent
a81f8f3d2d
commit
e48edc6856
2 files changed
+24
-3
No files matched your search
Vendored
+15
-3
@@ -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
@@ -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
|
||||
Reference in new issue
Block a user