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 e826ee69..e42fe7ea 100644
--- a/Sparkle/SUUpdateAlert.m
+++ b/Sparkle/SUUpdateAlert.m
@@ -305,57 +305,56 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
[self.releaseNotesContainerView removeFromSuperview];
}
+ // NOTE: The code below for deciding what buttons to hide is complex! Due to array of feature configurations :)
+
// When we show release notes, it looks ugly if the install buttons are not closer to the release notes view
// However when we don't show release notes, it looks ugly if the install buttons are too close to the description field. Shrugs.
- if (showReleaseNotes && ![self allowsAutomaticUpdates]) {
- 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];
+ BOOL allowsAutomaticUpdates = [self allowsAutomaticUpdates];
+ // 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 (!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;
+ }
+ }
+
+ // A developer wishing for automatic updates shouldn't want users to skip updates
+ // Except maybe when there's a minimum auto update version for auto-downloading specified
+ if (automaticDownloadsEnabledByDeveloper && self.updateItem.minimumAutoupdateVersion.length == 0) {
+ self.skipButton.hidden = YES;
}
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;
+ // Reminding user later doesn't make sense when automatic update checks are off
+ if (![self.host boolForKey:SUEnableAutomaticChecksKey]) {
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")];
+
+ // If the developer makes use of minimumAutoupdateVersion, just stick to Remind Me Later on the safe side
+ // (Install Later would be harmfully incorrect if this update cannot be automatically installed)
+ // And this is really not the place to do comparison/version checks.
+ // Also make sure to check that the system and developer allows us to automatically update.
+ // This logic is not very sound and gets worse in 2.x where apps can be sandboxed. We may need to revisit this
+ // and also decide if we really need this button in the first place.
+ if ([self.host boolForKey:SUAutomaticallyUpdateKey] && allowsAutomaticUpdates && self.updateItem.minimumAutoupdateVersion.length == 0) {
+ [self.laterButton setTitle:SULocalizedString(@"Install Later", @"Alternate title for 'Remind Me Later' button when automatic updates are enabled")];
}
[self.window center];
}
-- (BOOL)automaticChecksEnabled {
- NSNumber *automaticChecksEnabled = [self.host objectForKey:SUEnableAutomaticChecksKey];
- if (automaticChecksEnabled == nil)
- {
- return false;
- }
-
- 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];