diff --git a/Sparkle/SPUStandardUserDriver.m b/Sparkle/SPUStandardUserDriver.m index a1d85b28..58c09401 100644 --- a/Sparkle/SPUStandardUserDriver.m +++ b/Sparkle/SPUStandardUserDriver.m @@ -76,7 +76,7 @@ #pragma mark Update Alert Focus -- (void)setUpFocusForActiveUpdateAlert +- (void)setUpFocusForActiveUpdateAlertWithUserInitiation:(BOOL)userInitiated { // Make sure the window is loaded in any case [self.activeUpdateAlert window]; @@ -89,10 +89,14 @@ } // Only show the update alert if the app is active; otherwise, we'll wait until it is. - if ([NSApp isActive]) + if ([NSApp isActive]) { + if (!userInitiated) { + [self.activeUpdateAlert disableKeyboardShortcutForInstallButton]; + } [self.activeUpdateAlert.window makeKeyAndOrderFront:self]; - else + } else { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:NSApplicationDidBecomeActiveNotification object:NSApp]; + } } - (void)applicationDidBecomeActive:(NSNotification *)__unused aNotification @@ -103,7 +107,7 @@ #pragma mark Update Found -- (void)showUpdateFoundWithAlertHandler:(SUUpdateAlert *(^)(SPUStandardUserDriver *, SUHost *, id))alertHandler +- (void)showUpdateFoundWithAlertHandler:(SUUpdateAlert *(^)(SPUStandardUserDriver *, SUHost *, id))alertHandler userInitiated:(BOOL)userInitiated { id versionDisplayer = nil; if ([self.delegate respondsToSelector:@selector(standardUserDriverRequestsVersionDisplayer)]) { @@ -114,10 +118,10 @@ SUHost *host = self.host; self.activeUpdateAlert = alertHandler(weakSelf, host, versionDisplayer); - [self setUpFocusForActiveUpdateAlert]; + [self setUpFocusForActiveUpdateAlertWithUserInitiation:userInitiated]; } -- (void)showUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)__unused userInitiated reply:(void (^)(SPUUpdateAlertChoice))reply +- (void)showUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)userInitiated reply:(void (^)(SPUUpdateAlertChoice))reply { assert(NSThread.isMainThread); @@ -126,10 +130,10 @@ reply(choice); weakSelf.activeUpdateAlert = nil; }]; - }]; + } userInitiated:userInitiated]; } -- (void)showDownloadedUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)__unused userInitiated reply:(void (^)(SPUUpdateAlertChoice))reply +- (void)showDownloadedUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)userInitiated reply:(void (^)(SPUUpdateAlertChoice))reply { assert(NSThread.isMainThread); @@ -138,10 +142,10 @@ reply(choice); weakSelf.activeUpdateAlert = nil; }]; - }]; + } userInitiated:userInitiated]; } -- (void)showResumableUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)__unused userInitiated reply:(void (^)(SPUInstallUpdateStatus))reply +- (void)showResumableUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)userInitiated reply:(void (^)(SPUInstallUpdateStatus))reply { assert(NSThread.isMainThread); @@ -150,10 +154,10 @@ reply(choice); weakSelf.activeUpdateAlert = nil; }]; - }]; + } userInitiated:userInitiated]; } -- (void)showInformationalUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)__unused userInitiated reply:(void (^)(SPUInformationalUpdateAlertChoice))reply +- (void)showInformationalUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)userInitiated reply:(void (^)(SPUInformationalUpdateAlertChoice))reply { assert(NSThread.isMainThread); @@ -162,7 +166,7 @@ reply(choice); weakSelf.activeUpdateAlert = nil; }]; - }]; + } userInitiated:userInitiated]; } - (void)showUpdateReleaseNotesWithDownloadData:(SPUDownloadData *)downloadData