Merge pull request #1696 from lorenrh/customUpdateButtons

Hide automatic update button and skip button, depending on `SUAutomaticallyUpdate` key
This commit is contained in:
Kornel authored and GitHub committed 2021-01-19 11:39:09 +00:00
commit fddbadb114
1 file changed
+17
+17
View File
@@ -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];