From f60b60b08f7e44a47033c6d85a05c8254081efbc Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 23 Jan 2021 21:14:59 -0800 Subject: [PATCH] Fix automatic updates checkbox state when not showing release notes --- Sparkle/Base.lproj/SUUpdateAlert.xib | 5 ----- Sparkle/SUUpdateAlert.m | 24 +++++++++++------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Sparkle/Base.lproj/SUUpdateAlert.xib b/Sparkle/Base.lproj/SUUpdateAlert.xib index f9d5d104..94fbcc59 100644 --- a/Sparkle/Base.lproj/SUUpdateAlert.xib +++ b/Sparkle/Base.lproj/SUUpdateAlert.xib @@ -174,11 +174,6 @@ DQ - - - NSNegateBoolean - - diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index 9db1a078..1ed51560 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -313,22 +313,20 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE // Automatic downloads is enabled by developer if they set SUAutomaticallyUpdateKey in Info.plist, // rather than the user toggling the setting BOOL automaticDownloadsEnabledByDeveloper = [self.host boolForInfoDictionaryKey:SUAutomaticallyUpdateKey]; - if (showReleaseNotes && (!allowsAutomaticUpdates || automaticDownloadsEnabledByDeveloper)) { - // Fix constraints so that buttons aren't far away from web view when we hide the automatic updates check box - NSLayoutConstraint *skipButtonToReleaseNotesContainerConstraint = [NSLayoutConstraint constraintWithItem:self.skipButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.releaseNotesContainerView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12.0]; - - [self.window.contentView addConstraint:skipButtonToReleaseNotesContainerConstraint]; - - [self.automaticallyInstallUpdatesButton removeFromSuperview]; + if (!allowsAutomaticUpdates || automaticDownloadsEnabledByDeveloper) { + if (showReleaseNotes) { + // Fix constraints so that buttons aren't far away from web view when we hide the automatic updates check box + NSLayoutConstraint *skipButtonToReleaseNotesContainerConstraint = [NSLayoutConstraint constraintWithItem:self.skipButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.releaseNotesContainerView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12.0]; + + [self.window.contentView addConstraint:skipButtonToReleaseNotesContainerConstraint]; + + [self.automaticallyInstallUpdatesButton removeFromSuperview]; + } else { + self.automaticallyInstallUpdatesButton.enabled = NO; + } } if (automaticDownloadsEnabledByDeveloper) { - if (!showReleaseNotes) { - // Disable automatic install updates option if the developer wishes for it in Info.plist - // If we are showing release notes, this button will be hidden instead - self.automaticallyInstallUpdatesButton.enabled = NO; - } - // A developer wishing for automatic updates shouldn't want users to skip updates self.skipButton.hidden = YES; }