Use new update group for next downloaded update if applicable

This commit is contained in:
Zorg committed 2021-01-24 20:17:10 -08:00
1 parent d97dbf7ba0
commit bc0e338cde
2 files changed
+12

No files matched your search

+2
View File
@@ -35,6 +35,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)downloadDriverDidReceiveDataOfLength:(uint64_t)length;
- (void)downloadDriverDidDownloadUpdate;
- (void)coreDriverDidStartExtractingUpdate;
- (void)installerDidStartInstalling;
+10
View File
@@ -20,6 +20,7 @@
#import "SUAppcastItem.h"
#import "SULocalizations.h"
#import "SPUInstallationType.h"
#import "SUPhasedUpdateGroupInfo.h"
#include "AppKitPrevention.h"
@@ -40,6 +41,7 @@
@property (nonatomic, readonly, weak) id updater; // if we didn't have legacy support, I'd remove this..
@property (nullable, nonatomic, readonly, weak) id <SPUUpdaterDelegate>updaterDelegate;
@property (nonatomic) NSString *userAgent;
@property (nonatomic) BOOL downloadInBackground;
@end
@@ -58,6 +60,7 @@
@synthesize updaterDelegate = _updaterDelegate;
@synthesize userAgent = _userAgent;
@synthesize resumableUpdate = _resumableUpdate;
@synthesize downloadInBackground = _downloadInBackground;
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUCoreBasedUpdateDriverDelegate>)delegate
{
@@ -166,6 +169,8 @@
- (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem inBackground:(BOOL)background
{
self.downloadInBackground = background;
self.downloadDriver = [[SPUDownloadDriver alloc] initWithUpdateItem:updateItem host:self.host userAgent:self.userAgent inBackground:background delegate:self];
if ([self.updaterDelegate respondsToSelector:@selector((updater:willDownloadUpdate:withRequest:))]) {
@@ -200,6 +205,11 @@
- (void)downloadDriverDidDownloadUpdate:(SPUDownloadedUpdate *)downloadedUpdate
{
// Use a new update group for our next downloaded update, if applicable
if (self.downloadInBackground && downloadedUpdate.updateItem.phasedRolloutInterval != nil) {
[SUPhasedUpdateGroupInfo setNewUpdateGroupIdentifierForHost:self.host];
}
self.resumableUpdate = downloadedUpdate;
[self extractUpdate:downloadedUpdate];
}