diff --git a/Sparkle/SPUUIBasedUpdateDriver.m b/Sparkle/SPUUIBasedUpdateDriver.m index ceb41864..c165c740 100644 --- a/Sparkle/SPUUIBasedUpdateDriver.m +++ b/Sparkle/SPUUIBasedUpdateDriver.m @@ -107,6 +107,8 @@ - (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem preventsAutoupdate:(BOOL)preventsAutoupdate { + id 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 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]; diff --git a/Sparkle/SPUUpdaterDelegate.h b/Sparkle/SPUUpdaterDelegate.h index a336047f..7dff6691 100644 --- a/Sparkle/SPUUpdaterDelegate.h +++ b/Sparkle/SPUUpdaterDelegate.h @@ -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. diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index f767c00d..8cde41f8 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -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:)]) { diff --git a/Sparkle/SUUpdaterDelegate.h b/Sparkle/SUUpdaterDelegate.h index 87e5d1c6..3ac41414 100644 --- a/Sparkle/SUUpdaterDelegate.h +++ b/Sparkle/SUUpdaterDelegate.h @@ -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.