mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Fix subclass compatibility and update schedule unarchiving behavior
This commit is contained in:
1 parent
dd1bda5066
commit
137b73af4e
4 files changed
+24
-13
No files matched your search
Vendored
+1
-1
@@ -62,7 +62,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:NSApplicationDidBecomeActiveNotification object:NSApp];
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFinish
|
||||
- (void)unarchiverDidFinish:(id)__unused ua
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil];
|
||||
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(systemWillPowerOff:) name:NSWorkspaceWillPowerOffNotification object:nil];
|
||||
|
||||
Vendored
+4
@@ -40,6 +40,10 @@
|
||||
- (void)extractUpdate;
|
||||
- (void)failedToApplyDeltaUpdate;
|
||||
|
||||
// Needed to preserve compatibility to subclasses, even though our unarchiver code uses blocks now
|
||||
- (void)unarchiver:(id)ua extractedProgress:(double)progress;
|
||||
- (void)unarchiverDidFinish:(id)ua;
|
||||
|
||||
- (void)installWithToolAndRelaunch:(BOOL)relaunch;
|
||||
- (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI;
|
||||
- (void)installerForHost:(SUHost *)host failedWithError:(NSError *)error;
|
||||
|
||||
Vendored
+17
-10
@@ -334,17 +334,18 @@
|
||||
|
||||
if (!success) {
|
||||
NSError *reason = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{NSLocalizedDescriptionKey: @"Failed to extract update."}];
|
||||
[self unarchiverDidFail:reason];
|
||||
[self unarchiverDidFailWithError:reason];
|
||||
} else {
|
||||
[unarchiver unarchiveWithCompletionBlock:^(NSError *err){
|
||||
if (err) {
|
||||
[self unarchiverDidFail:err];
|
||||
[self unarchiverDidFailWithError:err];
|
||||
return;
|
||||
}
|
||||
|
||||
// This will call any of the subclass' implementation of -unarchiverDidFinish first
|
||||
[self unarchiverDidFinish];
|
||||
} progressBlock:nil];
|
||||
|
||||
[self unarchiverDidFinish:nil];
|
||||
} progressBlock:^(double progress) {
|
||||
[self unarchiver:nil extractedProgress:progress];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,14 +358,20 @@
|
||||
[self downloadUpdate];
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFinish
|
||||
// By default does nothing, can be overridden
|
||||
- (void)unarchiver:(id)__unused ua extractedProgress:(double)__unused progress
|
||||
{
|
||||
}
|
||||
|
||||
// Note this method can be overridden (and is)
|
||||
- (void)unarchiverDidFinish:(id)__unused ua
|
||||
{
|
||||
assert(self.updateItem);
|
||||
|
||||
|
||||
[self installWithToolAndRelaunch:YES];
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFail:(NSError *)err
|
||||
- (void)unarchiverDidFailWithError:(NSError *)err
|
||||
{
|
||||
// No longer needed
|
||||
self.updateValidator = nil;
|
||||
@@ -373,7 +380,7 @@
|
||||
[self failedToApplyDeltaUpdate];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
[self abortUpdateWithError:err];
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -216,7 +216,7 @@
|
||||
[super extractUpdate];
|
||||
}
|
||||
|
||||
- (void)unarchiver:(SUUnarchiver *)__unused ua extractedProgress:(double)progress
|
||||
- (void)unarchiver:(id)__unused ua extractedProgress:(double)progress
|
||||
{
|
||||
// We do this here instead of in extractUpdate so that we only have a determinate progress bar for archives with progress.
|
||||
if ([self.statusController maxProgressValue] == 0.0) {
|
||||
@@ -225,7 +225,7 @@
|
||||
[self.statusController setProgressValue:progress];
|
||||
}
|
||||
|
||||
- (void)unarchiverDidFinish
|
||||
- (void)unarchiverDidFinish:(id)__unused ua
|
||||
{
|
||||
if (self.automaticallyInstallUpdates) {
|
||||
[self installWithToolAndRelaunch:YES];
|
||||
|
||||
Reference in new issue
Block a user