diff --git a/Sparkle/SUCoreBasedUpdateDriver.m b/Sparkle/SUCoreBasedUpdateDriver.m index 19b34ba9..9eb0e4d8 100644 --- a/Sparkle/SUCoreBasedUpdateDriver.m +++ b/Sparkle/SUCoreBasedUpdateDriver.m @@ -27,6 +27,7 @@ @property (nonatomic) SUAppcastItem *updateItem; @property (nonatomic, readonly) SUHost *host; +@property (nonatomic) BOOL resumingUpdate; @property (nonatomic, readonly, weak) id updater; // if we didn't have legacy support, I'd remove this.. @property (nullable, nonatomic, readonly, weak) id updaterDelegate; @property (nonatomic) NSString *userAgent; @@ -41,6 +42,7 @@ @synthesize delegate = _delegate; @synthesize updateItem = _updateItem; @synthesize host = _host; +@synthesize resumingUpdate = _resumingUpdate; @synthesize updater = _updater; @synthesize updaterDelegate = _updaterDelegate; @synthesize userAgent = _userAgent; @@ -97,6 +99,7 @@ - (void)resumeUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock { + self.resumingUpdate = YES; [self.basicDriver resumeUpdateWithCompletion:completionBlock]; } @@ -111,6 +114,10 @@ { self.updateItem = updateItem; + if (self.resumingUpdate) { + [self.installerDriver resumeUpdateWithUpdateItem:updateItem]; + } + [self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem]; } diff --git a/Sparkle/SUInstallerDriver.h b/Sparkle/SUInstallerDriver.h index 581283d2..f0fd63fe 100644 --- a/Sparkle/SUInstallerDriver.h +++ b/Sparkle/SUInstallerDriver.h @@ -31,6 +31,8 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithHost:(SUHost *)host cachePath:(NSString *)cachePath sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(nullable id)updaterDelegate delegate:(nullable id)delegate; +- (void)resumeUpdateWithUpdateItem:(SUAppcastItem *)updateItem; + - (void)extractDownloadName:(NSString *)downloadName withUpdateItem:(SUAppcastItem *)updateItem temporaryDirectory:(NSString *)temporaryDirectory completion:(void (^)(NSError * _Nullable))completionHandler; - (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI; diff --git a/Sparkle/SUInstallerDriver.m b/Sparkle/SUInstallerDriver.m index 0975b42f..103bc5ec 100644 --- a/Sparkle/SUInstallerDriver.m +++ b/Sparkle/SUInstallerDriver.m @@ -210,6 +210,11 @@ } } +- (void)resumeUpdateWithUpdateItem:(SUAppcastItem *)updateItem +{ + self.updateItem = updateItem; +} + - (void)sendInstallationData { NSString *pathToRelaunch = [self.host bundlePath]; @@ -526,8 +531,7 @@ - (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI { -#warning this assertion no longer holds trues due to resumability - matters for commented invocation code below - //assert(self.updateItem); + assert(self.updateItem); if (![self mayUpdateAndRestart]) {