From 0cfedd45166c2750f688307728fc38c9f897a66b Mon Sep 17 00:00:00 2001 From: Kenneth Johnsen Date: Tue, 15 Oct 2019 15:04:31 +0200 Subject: [PATCH] Hide "Skip..." and "Remind..." buttons. (#1480) Show/Hide skip/later buttons based on whether update is critical / automatic updates enabled. The skip-button is now hidden for critical updates, and the later-button is hidden if automatic updates are disabled. Note that the user can still choose to just close the window by clicking the red dot at the top of the window. --- Sparkle/SUUpdateAlert.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index 59ddd32e..d0e25f1c 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -262,11 +262,29 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE if ([self.updateItem isCriticalUpdate]) { self.skipButton.enabled = NO; + self.skipButton.hidden = YES; + self.laterButton.enabled = NO; + self.laterButton.hidden = YES; } + if (![self automaticChecksEnabled]) { + self.laterButton.enabled = NO; + self.laterButton.hidden = YES; + } + [self.window center]; } +- (BOOL)automaticChecksEnabled { + NSNumber *automaticChecksEnabled = [self.host objectForInfoDictionaryKey:SUEnableAutomaticChecksKey]; + if (automaticChecksEnabled == nil) + { + return false; + } + + return [automaticChecksEnabled boolValue]; +} + - (BOOL)windowShouldClose:(NSNotification *) __unused note { [self endWithSelection:SURemindMeLaterChoice];