diff --git a/Sparkle/SPUStandardUserDriver.m b/Sparkle/SPUStandardUserDriver.m index 2a936689..0a9debfd 100644 --- a/Sparkle/SPUStandardUserDriver.m +++ b/Sparkle/SPUStandardUserDriver.m @@ -21,8 +21,10 @@ #import "SUOperatingSystem.h" #import "SPUUserUpdateState.h" #import "SUErrors.h" +#import "SPUInstallationType.h" #include + #import // The amount of time we wait until the app becomes inactive and active again to show an update prompt at an opportune time. @@ -53,6 +55,8 @@ static const NSTimeInterval SUScheduledUpdateIdleEventLeewayInterval = DEBUG ? 3 @property (nonatomic, readonly) uint64_t initializationTime; +@property (nonatomic) BOOL regularApplicationUpdate; + @end @implementation SPUStandardUserDriver @@ -70,6 +74,7 @@ static const NSTimeInterval SUScheduledUpdateIdleEventLeewayInterval = DEBUG ? 3 @synthesize expectedContentLength = _expectedContentLength; @synthesize bytesDownloaded = _bytesDownloaded; @synthesize initializationTime = _initializationTime; +@synthesize regularApplicationUpdate = _regularApplicationUpdate; #pragma mark Birth @@ -205,6 +210,8 @@ static const NSTimeInterval SUScheduledUpdateIdleEventLeewayInterval = DEBUG ? 3 weakSelf.activeUpdateAlert = nil; }]; + self.regularApplicationUpdate = [appcastItem.installationType isEqualToString:SPUInstallationTypeApplication]; + BOOL allowInstallButtonFocus; if (state.userInitiated) { allowInstallButtonFocus = YES; @@ -431,7 +438,18 @@ static const NSTimeInterval SUScheduledUpdateIdleEventLeewayInterval = DEBUG ? 3 - (void)createAndShowStatusController { if (self.statusController == nil) { - self.statusController = [[SUStatusController alloc] initWithHost:self.host minimizable:YES]; + // We will make the status window minimizable for regular app updates which are often + // quick and atomic to install on quit. But we won't do this for package based updates. + BOOL minimizable; + if (!self.regularApplicationUpdate) { + minimizable = NO; + } else if ([self.delegate respondsToSelector:@selector(standardUserDriverAllowsMinimizableStatusWindow)]) { + minimizable = [self.delegate standardUserDriverAllowsMinimizableStatusWindow]; + } else { + minimizable = YES; + } + + self.statusController = [[SUStatusController alloc] initWithHost:self.host minimizable:minimizable]; [self.statusController showWindow:self]; } } diff --git a/Sparkle/SPUStandardUserDriverDelegate.h b/Sparkle/SPUStandardUserDriverDelegate.h index 497bd7db..6cef7856 100644 --- a/Sparkle/SPUStandardUserDriverDelegate.h +++ b/Sparkle/SPUStandardUserDriverDelegate.h @@ -61,4 +61,14 @@ SU_EXPORT @protocol SPUStandardUserDriverDelegate */ - (void)standardUserDriverShowVersionHistoryForAppcastItem:(SUAppcastItem *_Nonnull)item; +/** + Specifies whether or not the download, extraction, and installing status windows allows to be minimized. + + By default, the status window showing the current status of the update (download, extraction, ready to install) is allowed to be minimized + for regular application bundle updates. + + @return @c YES if the status window is allowed to be minimized (default behavior), otherwise @c NO. + */ +- (BOOL)standardUserDriverAllowsMinimizableStatusWindow; + @end