mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-29 05:24:26 +00:00
Merge pull request #1273 from rob-patchett/ui-separation-and-xpc
Adds an option to turn off hideOnDeactivate in SPUStandardUserDriver for foreground apps
This commit is contained in:
2 files changed
+11
-1
No files matched your search
Vendored
+5
@@ -33,6 +33,11 @@ SU_EXPORT @interface SPUStandardUserDriver : NSObject <SPUUserDriver, SPUStandar
|
||||
*/
|
||||
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle delegate:(nullable id<SPUStandardUserDriverDelegate>)delegate;
|
||||
|
||||
/*!
|
||||
* Enable or disable hideOnDeactivate for standard update window.
|
||||
*/
|
||||
@property (nonatomic) BOOL hideOnDeactivate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Vendored
+6
-1
@@ -39,6 +39,7 @@
|
||||
@synthesize delegate = _delegate;
|
||||
@synthesize checkingController = _checkingController;
|
||||
@synthesize activeUpdateAlert = _activeUpdateAlert;
|
||||
@synthesize hideOnDeactivate = _hideOnDeactivate;
|
||||
@synthesize statusController = _statusController;
|
||||
|
||||
#pragma mark Birth
|
||||
@@ -50,6 +51,7 @@
|
||||
_host = [[SUHost alloc] initWithBundle:hostBundle];
|
||||
_delegate = delegate;
|
||||
_coreComponent = [[SPUUserDriverCoreComponent alloc] init];
|
||||
_hideOnDeactivate = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -88,12 +90,15 @@
|
||||
// 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];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user