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:
Kornel authored and GitHub committed 2018-07-25 14:11:56 +01:00
commit e40628a78f
2 files changed
+11 -1

No files matched your search

+5
View File
@@ -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
+6 -1
View File
@@ -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];
}