Merge pull request #1036 from gnachman/preventAccidentalInstalls

Disable the keyboard shortcut for the install button for scheduled updates to avoid accidental installs.
This commit is contained in:
Kornel authored and GitHub committed 2017-02-16 17:21:55 +00:00
commit 46d2a6aeab
4 files changed
+19 -3

No files matched your search

+4
View File
@@ -56,4 +56,8 @@
}
}
- (BOOL)shouldDisableKeyboardShortcutForInstallButton {
return YES;
}
@end
+11 -3
View File
@@ -85,12 +85,20 @@
}
// Only show the update alert if the app is active; otherwise, we'll wait until it is.
if ([NSApp isActive])
[[self.updateAlert window] makeKeyAndOrderFront:self];
else
if ([NSApp isActive]) {
NSWindow *window = [self.updateAlert window];
if ([self shouldDisableKeyboardShortcutForInstallButton]) {
[self.updateAlert disableKeyboardShortcutForInstallButton];
}
[window makeKeyAndOrderFront:self];
} else
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:NSApplicationDidBecomeActiveNotification object:NSApp];
}
- (BOOL)shouldDisableKeyboardShortcutForInstallButton {
return NO;
}
- (void)didNotFindUpdate
{
id<SUUpdaterPrivate> updater = self.updater;
+1
View File
@@ -31,6 +31,7 @@ typedef NS_ENUM(NSInteger, SUUpdateAlertChoice) {
- (IBAction)installUpdate:sender;
- (IBAction)skipThisVersion:sender;
- (IBAction)remindMeLater:sender;
- (void)disableKeyboardShortcutForInstallButton;
@end
+3
View File
@@ -93,6 +93,9 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [self.host bundlePath]]; }
- (void)disableKeyboardShortcutForInstallButton {
self.installButton.keyEquivalent = @"";
}
- (void)endWithSelection:(SUUpdateAlertChoice)choice
{