diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index 9c8dac8c..fe8c05dc 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -318,6 +318,10 @@ { // finished. downloadData should be nil as this was a permanent download assert(self.updateItem); + id updater = self.updater; + if ([[updater delegate] respondsToSelector:@selector(updater:didDownloadUpdate:)]) { + [[updater delegate] updater:self.updater didDownloadUpdate:self.updateItem]; + } [self extractUpdate]; } @@ -371,11 +375,18 @@ NSError *reason = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{NSLocalizedDescriptionKey: @"Failed to extract update."}]; [self unarchiverDidFailWithError:reason]; } else { + if ([[updater delegate] respondsToSelector:@selector(updater:willExtractUpdate:)]) { + [[updater delegate] updater:self.updater willExtractUpdate:self.updateItem]; + } + [unarchiver unarchiveWithCompletionBlock:^(NSError *err){ if (err) { [self unarchiverDidFailWithError:err]; return; } + if ([[updater delegate] respondsToSelector:@selector(updater:didExtractUpdate:)]) { + [[updater delegate] updater:self.updater didExtractUpdate:self.updateItem]; + } [self performSelectorOnMainThread:@selector(unarchiverDidFinish:) withObject:nil waitUntilDone:NO]; } progressBlock:^(double progress) { diff --git a/Sparkle/SUUpdaterDelegate.h b/Sparkle/SUUpdaterDelegate.h index dbc14024..ec5586f5 100644 --- a/Sparkle/SUUpdaterDelegate.h +++ b/Sparkle/SUUpdaterDelegate.h @@ -137,6 +137,14 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey; */ - (void)updater:(SUUpdater *)updater willDownloadUpdate:(SUAppcastItem *)item withRequest:(NSMutableURLRequest *)request; +/*! + Called immediately after succesfull download of the specified update. + + \param updater The SUUpdater instance. + \param item The appcast item corresponding to the update that has been downloaded. + */ +- (void)updater:(SUUpdater *)updater didDownloadUpdate:(SUAppcastItem *)item; + /*! Called after the specified update failed to download. @@ -153,6 +161,22 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey; */ - (void)userDidCancelDownload:(SUUpdater *)updater; +/*! + Called immediately before extracting the specified downloaded update. + + \param updater The SUUpdater instance. + \param item The appcast item corresponding to the update that is proposed to be extracted. + */ +- (void)updater:(SUUpdater *)updater willExtractUpdate:(SUAppcastItem *)item; + +/*! + Called immediately after extracting the specified downloaded update. + + \param updater The SUUpdater instance. + \param item The appcast item corresponding to the update that has been extracted. + */ +- (void)updater:(SUUpdater *)updater didExtractUpdate:(SUAppcastItem *)item; + /*! Called immediately before installing the specified update.