mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
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:
commit
46d2a6aeab
4 files changed
+19
-3
No files matched your search
Vendored
+4
@@ -56,4 +56,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)shouldDisableKeyboardShortcutForInstallButton {
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+11
-3
@@ -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;
|
||||
|
||||
Vendored
+1
@@ -31,6 +31,7 @@ typedef NS_ENUM(NSInteger, SUUpdateAlertChoice) {
|
||||
- (IBAction)installUpdate:sender;
|
||||
- (IBAction)skipThisVersion:sender;
|
||||
- (IBAction)remindMeLater:sender;
|
||||
- (void)disableKeyboardShortcutForInstallButton;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Vendored
+3
@@ -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
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user