From b3ce4141d1d5ec73191911db6fcb9617b7e51599 Mon Sep 17 00:00:00 2001 From: Marcus Osobase Date: Tue, 3 May 2016 15:56:34 -0400 Subject: [PATCH] Automatically download update and wait until restart to install --- Sparkle/SUAutomaticUpdateDriver.m | 8 ++++++++ Sparkle/SUUIBasedUpdateDriver.m | 2 +- Sparkle/SUUpdater.h | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Sparkle/SUAutomaticUpdateDriver.m b/Sparkle/SUAutomaticUpdateDriver.m index 6727d0d9..9fed2c71 100644 --- a/Sparkle/SUAutomaticUpdateDriver.m +++ b/Sparkle/SUAutomaticUpdateDriver.m @@ -43,6 +43,14 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2 - (void)showUpdateAlert { + + id updaterDelegate = [self.updater delegate]; + if ([updaterDelegate suppressSparkleUI]) + { + [self automaticUpdateAlertFinishedWithChoice:SUInstallLaterChoice]; + return; + } + self.interruptible = NO; self.alert = [[SUAutomaticUpdateAlert alloc] initWithAppcastItem:self.updateItem host:self.host completionBlock:^(SUAutomaticInstallationChoice choice) { [self automaticUpdateAlertFinishedWithChoice:choice]; diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m index 3872fb7d..e92aa3d4 100644 --- a/Sparkle/SUUIBasedUpdateDriver.m +++ b/Sparkle/SUUIBasedUpdateDriver.m @@ -117,7 +117,7 @@ switch (choice) { case SUInstallUpdateChoice: - if(![[self.updater delegate] suppressUI]) { + if(![[self.updater delegate] suppressSparkleUI]) { self.statusController = [[SUStatusController alloc] initWithHost:self.host]; [self.statusController beginActionWithTitle:SULocalizedString(@"Downloading update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil]; [self.statusController setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelDownload:) isDefault:NO]; diff --git a/Sparkle/SUUpdater.h b/Sparkle/SUUpdater.h index e4467496..14fb786f 100644 --- a/Sparkle/SUUpdater.h +++ b/Sparkle/SUUpdater.h @@ -154,7 +154,7 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey; @optional -@property (nonatomic) BOOL suppressUI; +-(BOOL)suppressSparkleUI; /*! Returns whether to allow Sparkle to pop up.