mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-26 04:57:54 +00:00
Refine minimizing state for download/extraction/installation status (#2121)
Don't allow status window to be minimizable for non-app bundle updates due to atomicity concerns. Add delegate method to allow developer to configure if they want the status window to be minimizable.
This commit is contained in:
2 files changed
+29
-1
No files matched your search
Vendored
+19
-1
@@ -21,8 +21,10 @@
|
||||
#import "SUOperatingSystem.h"
|
||||
#import "SPUUserUpdateState.h"
|
||||
#import "SUErrors.h"
|
||||
#import "SPUInstallationType.h"
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -61,4 +61,14 @@ SU_EXPORT @protocol SPUStandardUserDriverDelegate <NSObject>
|
||||
*/
|
||||
- (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
|
||||
Reference in new issue
Block a user