From f95bf0c7d59e361cfa3cae669b6e87532ed70f2d Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 22 Mar 2021 15:48:25 -0700 Subject: [PATCH 1/2] Don't hide standard updater window on deactivation Sometimes when the app is re-activated, the window is ordered back behind other applications. Also it may be useful to eg read the release notes when browsing another application. We still preserve the logic that defers showing the update alert when the application isn't initially frontmost. --- Sparkle/Base.lproj/SUUpdateAlert.xib | 4 ++-- Sparkle/SPUStandardUserDriver.h | 5 ----- Sparkle/SPUStandardUserDriver.m | 7 ------- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/Sparkle/Base.lproj/SUUpdateAlert.xib b/Sparkle/Base.lproj/SUUpdateAlert.xib index 94fbcc59..90e159dd 100644 --- a/Sparkle/Base.lproj/SUUpdateAlert.xib +++ b/Sparkle/Base.lproj/SUUpdateAlert.xib @@ -20,12 +20,12 @@ - + - + diff --git a/Sparkle/SPUStandardUserDriver.h b/Sparkle/SPUStandardUserDriver.h index b352edd2..cb55acd6 100644 --- a/Sparkle/SPUStandardUserDriver.h +++ b/Sparkle/SPUStandardUserDriver.h @@ -34,11 +34,6 @@ SU_EXPORT @interface SPUStandardUserDriver : NSObject */ - (instancetype)initWithHostBundle:(NSBundle *)hostBundle delegate:(nullable id)delegate; -/*! - * Enable or disable hideOnDeactivate for standard update window. - */ -@property (nonatomic) BOOL hideOnDeactivate; - @end NS_ASSUME_NONNULL_END diff --git a/Sparkle/SPUStandardUserDriver.m b/Sparkle/SPUStandardUserDriver.m index c483a6d2..a1d85b28 100644 --- a/Sparkle/SPUStandardUserDriver.m +++ b/Sparkle/SPUStandardUserDriver.m @@ -39,7 +39,6 @@ @synthesize delegate = _delegate; @synthesize checkingController = _checkingController; @synthesize activeUpdateAlert = _activeUpdateAlert; -@synthesize hideOnDeactivate = _hideOnDeactivate; @synthesize statusController = _statusController; #pragma mark Birth @@ -51,7 +50,6 @@ _host = [[SUHost alloc] initWithBundle:hostBundle]; _delegate = delegate; _coreComponent = [[SPUUserDriverCoreComponent alloc] init]; - _hideOnDeactivate = YES; } return self; } @@ -83,15 +81,10 @@ // Make sure the window is loaded in any case [self.activeUpdateAlert window]; - if (!self.hideOnDeactivate) { - [self.activeUpdateAlert.window setHidesOnDeactivate:NO]; - } - // If the app is a menubar app or the like, we need to focus it first and alter the // update prompt to behave like a normal window. Otherwise if the window were hidden // there may be no way for the application to be activated to make it visible again. if ([SUApplicationInfo isBackgroundApplication:[NSApplication sharedApplication]]) { - [self.activeUpdateAlert.window setHidesOnDeactivate:NO]; [NSApp activateIgnoringOtherApps:YES]; } From 9555cb7397c1ec4154c8f82dfb425ed4e63fb51e Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 22 Mar 2021 23:05:02 -0700 Subject: [PATCH 2/2] Fix UI tests from not making update alert hide on deactivation --- UITests/SUTestApplicationTest.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UITests/SUTestApplicationTest.swift b/UITests/SUTestApplicationTest.swift index 0d0fab30..8432903b 100644 --- a/UITests/SUTestApplicationTest.swift +++ b/UITests/SUTestApplicationTest.swift @@ -47,7 +47,7 @@ class SUTestApplicationTest: XCTestCase menuBarsQuery.menuBarItems["Sparkle Test App"].click() } - app.dialogs["SUUpdateAlert"].buttons["Install Update"].click() + app.windows["SUUpdateAlert"].buttons["Install Update"].click() // Give some time for the update to finish downloading / extracting sleep(30)