Add updater:userDidSkipThisVersion: delegate method

This commit is contained in:
Zorg committed 2021-02-20 00:38:12 -08:00
1 parent c822f88cf1
commit 2d666b4d84
4 files changed
+33 -1

No files matched your search

+10 -1
View File
@@ -107,6 +107,8 @@
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem preventsAutoupdate:(BOOL)preventsAutoupdate
{
id <SPUUpdaterDelegate> updaterDelegate = self.updaterDelegate;
if (updateItem.isInformationOnlyUpdate) {
assert(!self.resumingDownloadedUpdate);
assert(!self.resumingInstallingUpdate);
@@ -134,6 +136,10 @@
case SPUSkipThisVersionChoice:
[self.coreDriver clearDownloadedUpdate];
[self.host setObject:[updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey];
if ([self.updaterDelegate respondsToSelector:@selector(updater:userDidSkipThisVersion:)]) {
[self.updaterDelegate updater:self.updater userDidSkipThisVersion:updateItem];
}
// Fall through
case SPUInstallLaterChoice:
[self.delegate uiDriverIsRequestingAbortUpdateWithError:nil];
@@ -151,6 +157,10 @@
break;
case SPUSkipThisVersionChoice:
[self.host setObject:[updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey];
if ([self.updaterDelegate respondsToSelector:@selector(updater:userDidSkipThisVersion:)]) {
[self.updaterDelegate updater:self.updater userDidSkipThisVersion:updateItem];
}
// Fall through
case SPUInstallLaterChoice:
[self.delegate uiDriverIsRequestingAbortUpdateWithError:nil];
@@ -171,7 +181,6 @@
[self.delegate uiDriverDidShowUpdate];
}
id <SPUUpdaterDelegate> updaterDelegate = self.updaterDelegate;
if (updateItem.releaseNotesURL != nil && (![updaterDelegate respondsToSelector:@selector(updaterShouldDownloadReleaseNotes:)] || [updaterDelegate updaterShouldDownloadReleaseNotes:self.updater])) {
NSURLRequest *request = [NSURLRequest requestWithURL:updateItem.releaseNotesURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30];
+8
View File
@@ -188,6 +188,14 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
*/
- (void)updaterDidNotFindUpdate:(SPUUpdater *)updater;
/*!
Called when an update is skipped by the user.
\param updater The updater instance.
\param item The appcast item corresponding to the update that the user skipped.
*/
- (void)updater:(SPUUpdater *)updater userDidSkipThisVersion:(SUAppcastItem *)item;
/*!
Returns whether the release notes (if available) should be downloaded after an update is found and shown.
+7
View File
@@ -326,6 +326,13 @@ static NSMutableDictionary *sharedUpdaters = nil;
}
}
- (void)updater:(SPUUpdater *)__unused updater userDidSkipThisVersion:(nonnull SUAppcastItem *)item
{
if ([self.delegate respondsToSelector:@selector(updater:userDidSkipThisVersion:)]) {
[self.delegate updater:self userDidSkipThisVersion:item];
}
}
- (void)updater:(SPUUpdater *)__unused updater willDownloadUpdate:(SUAppcastItem *)item withRequest:(NSMutableURLRequest *)request
{
if ([self.delegate respondsToSelector:@selector(updater:willDownloadUpdate:withRequest:)]) {
+8
View File
@@ -160,6 +160,14 @@ __deprecated_msg("See SPUUpdaterDelegate instead")
*/
- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)item;
/*!
Called when an update is skipped by the user.
\param updater The updater instance.
\param item The appcast item corresponding to the update that the user skipped.
*/
- (void)updater:(SUUpdater *)updater userDidSkipThisVersion:(SUAppcastItem *)item;
/*!
Returns whether the relaunch should be delayed in order to perform other tasks.