mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-27 05:04:27 +00:00
Handle informational only updates from the automatic update driver
The automatic update driver defers the informational only update & aborts, allowing a scheduled UI driver to resume it. The automatic update driver aborts before the point an update would normally be downloaded.
This commit is contained in:
1 parent
27a24a5413
commit
0bb3ab51b3
6 files changed
+32
-5
No files matched your search
Vendored
+7
-2
@@ -84,7 +84,12 @@
|
||||
{
|
||||
self.updateItem = updateItem;
|
||||
|
||||
[self.coreDriver downloadUpdateFromAppcastItem:updateItem];
|
||||
if (updateItem.isInformationOnlyUpdate) {
|
||||
[self.coreDriver deferInformationalUpdate:updateItem];
|
||||
[self abortUpdate];
|
||||
} else {
|
||||
[self.coreDriver downloadUpdateFromAppcastItem:updateItem];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently
|
||||
@@ -126,7 +131,7 @@
|
||||
|
||||
- (void)abortUpdateWithError:(NSError *)error
|
||||
{
|
||||
BOOL showNextUpdateImmediately = (error == nil || error.code == SUInstallationAuthorizeLaterError) && (!self.willInstallSilently || self.updateItem.isCriticalUpdate);
|
||||
BOOL showNextUpdateImmediately = (error == nil || error.code == SUInstallationAuthorizeLaterError) && (!self.willInstallSilently || self.updateItem.isCriticalUpdate || self.updateItem.isInformationOnlyUpdate);
|
||||
[self.coreDriver abortUpdateAndShowNextUpdateImmediately:showNextUpdateImmediately error:error];
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
@@ -63,6 +63,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem;
|
||||
|
||||
- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem;
|
||||
|
||||
- (void)extractDownloadedUpdate;
|
||||
|
||||
- (void)clearDownloadedUpdate;
|
||||
|
||||
Vendored
+6
@@ -203,6 +203,11 @@
|
||||
[self extractUpdate:downloadedUpdate];
|
||||
}
|
||||
|
||||
- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem
|
||||
{
|
||||
self.downloadedUpdate = [[SPUDownloadedUpdate alloc] initWithAppcastItem:updateItem];
|
||||
}
|
||||
|
||||
- (void)extractDownloadedUpdate
|
||||
{
|
||||
assert(self.downloadedUpdate != nil);
|
||||
@@ -342,6 +347,7 @@
|
||||
[self.downloadDriver cleanup];
|
||||
|
||||
SPUDownloadedUpdate *downloadedUpdate = (error == nil || error.code == SUInstallationAuthorizeLaterError) ? self.downloadedUpdate : nil;
|
||||
|
||||
[self.basicDriver abortUpdateAndShowNextUpdateImmediately:shouldShowUpdateImmediately downloadedUpdate:downloadedUpdate error:error];
|
||||
}
|
||||
|
||||
|
||||
Vendored
+7
-2
@@ -16,9 +16,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem downloadName:(NSString *)downloadName temporaryDirectory:(NSString *)temporaryDirectory;
|
||||
|
||||
// For information only updates
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem;
|
||||
|
||||
@property (nonatomic, readonly) SUAppcastItem *updateItem;
|
||||
@property (nonatomic, copy, readonly) NSString *downloadName;
|
||||
@property (nonatomic, copy, readonly) NSString *temporaryDirectory;
|
||||
|
||||
// These are nil when the update item is just informational and no download is linked
|
||||
@property (nonatomic, copy, nullable, readonly) NSString *downloadName;
|
||||
@property (nonatomic, copy, nullable, readonly) NSString *temporaryDirectory;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Vendored
+9
@@ -29,4 +29,13 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_updateItem = updateItem;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+1
-1
@@ -797,7 +797,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
// Proceed as normal if there's no resumable updates
|
||||
completionHandler(regularCheckInterval);
|
||||
} else {
|
||||
if (!installationInfo.canSilentlyInstall || [installationInfo.appcastItem isCriticalUpdate]) {
|
||||
if (!installationInfo.canSilentlyInstall || [installationInfo.appcastItem isCriticalUpdate] || [installationInfo.appcastItem isInformationOnlyUpdate]) {
|
||||
completionHandler(MIN(regularCheckInterval, SUImpatientUpdateCheckInterval));
|
||||
} else {
|
||||
completionHandler(MAX(regularCheckInterval, SUImpatientUpdateCheckInterval));
|
||||
|
||||
Reference in new issue
Block a user