From 4c9397d75200c9dc922b2a812169b4f6bc6d9919 Mon Sep 17 00:00:00 2001 From: Lorena Rangel Date: Wed, 13 Jan 2021 11:38:55 +0100 Subject: [PATCH] Show check for updates button only when automatic updates are enabled Signed-off-by: Lorena Rangel --- Sparkle/SUUpdateAlert.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index 090ace02..e826ee69 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -326,6 +326,13 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE self.laterButton.enabled = NO; self.laterButton.hidden = YES; } + + if([self automaticallyUpdateEnabled]) { + self.skipButton.hidden = YES; + self.automaticallyInstallUpdatesButton.hidden = YES; + [self.laterButton setTitle:SULocalizedString(@"Install later", @"Alternate title for 'Remind me later' button when automatic updates are enabled")]; + } + [self.window center]; } @@ -339,6 +346,16 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE return [automaticChecksEnabled boolValue]; } +- (BOOL)automaticallyUpdateEnabled { + NSNumber *automaticChecksEnabled = [self.host objectForKey:SUAutomaticallyUpdateKey]; + if (automaticChecksEnabled == nil) + { + return false; + } + + return [automaticChecksEnabled boolValue]; +} + - (BOOL)windowShouldClose:(NSNotification *) __unused note { [self endWithSelection:SURemindMeLaterChoice];