From 9b6346516e63461a5cd57ecc656a240f368e00c4 Mon Sep 17 00:00:00 2001 From: George Nachman Date: Sat, 9 Mar 2019 14:58:08 -0800 Subject: [PATCH] Pass item to updaterShouldShowUpdateAlertForScheduledUpdate delegate method --- Sparkle/SUScheduledUpdateDriver.m | 8 ++++---- Sparkle/SUUIBasedUpdateDriver.h | 2 +- Sparkle/SUUIBasedUpdateDriver.m | 6 +++--- Sparkle/SUUpdaterDelegate.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Sparkle/SUScheduledUpdateDriver.m b/Sparkle/SUScheduledUpdateDriver.m index c11e3ef6..01e094bf 100644 --- a/Sparkle/SUScheduledUpdateDriver.m +++ b/Sparkle/SUScheduledUpdateDriver.m @@ -47,15 +47,15 @@ return YES; } -- (BOOL)shouldShowUpdateAlert { +- (BOOL)shouldShowUpdateAlertForItem:(SUAppcastItem *)item { id updater = self.updater; id updaterDelegate = [updater delegate]; - if ([updaterDelegate respondsToSelector:@selector(updaterShouldShowUpdateAlertForScheduledUpdate:)]) { - return [updaterDelegate updaterShouldShowUpdateAlertForScheduledUpdate:self.updater]; + if ([updaterDelegate respondsToSelector:@selector(updaterShouldShowUpdateAlertForScheduledUpdate:forItem:)]) { + return [updaterDelegate updaterShouldShowUpdateAlertForScheduledUpdate:self.updater forItem:item]; } - return [super shouldShowUpdateAlert]; + return [super shouldShowUpdateAlertForItem:item]; } @end diff --git a/Sparkle/SUUIBasedUpdateDriver.h b/Sparkle/SUUIBasedUpdateDriver.h index ee80a9b2..1b91132b 100644 --- a/Sparkle/SUUIBasedUpdateDriver.h +++ b/Sparkle/SUUIBasedUpdateDriver.h @@ -20,7 +20,7 @@ - (void)showAlert:(NSAlert *)alert; - (IBAction)cancelDownload:(id)sender; - (void)installAndRestart:(id)sender; -- (BOOL)shouldShowUpdateAlert; +- (BOOL)shouldShowUpdateAlertForItem:(SUAppcastItem *)item; @end diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m index 687a741d..55acd66a 100644 --- a/Sparkle/SUUIBasedUpdateDriver.m +++ b/Sparkle/SUUIBasedUpdateDriver.m @@ -56,7 +56,7 @@ return self; } -- (BOOL)shouldShowUpdateAlert { +- (BOOL)shouldShowUpdateAlertForItem:(SUAppcastItem *)__unused item { return YES; } @@ -72,12 +72,12 @@ return; } - if (![self shouldShowUpdateAlert]) { + SUAppcastItem *updateItem = self.updateItem; + if (![self shouldShowUpdateAlertForItem:updateItem]) { [self abortUpdate]; return; } - SUAppcastItem *updateItem = self.updateItem; self.updateAlert = [[SUUpdateAlert alloc] initWithAppcastItem:updateItem host:self.host completionBlock:^(SUUpdateAlertChoice choice) { [self updateAlertFinishedWithChoice:choice forItem:updateItem]; }]; diff --git a/Sparkle/SUUpdaterDelegate.h b/Sparkle/SUUpdaterDelegate.h index 0ff73b6f..a09b0777 100644 --- a/Sparkle/SUUpdaterDelegate.h +++ b/Sparkle/SUUpdaterDelegate.h @@ -124,7 +124,7 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey; \return YES to allow the update prompt to be shown (the default behavior), or NO to suppress it. */ -- (BOOL)updaterShouldShowUpdateAlertForScheduledUpdate:(SUUpdater *)updater; +- (BOOL)updaterShouldShowUpdateAlertForScheduledUpdate:(SUUpdater *)updater forItem:(SUAppcastItem *)item; /*! Called after the user dismisses the update alert.