diff --git a/Sparkle/SPUScheduledUpdateDriver.m b/Sparkle/SPUScheduledUpdateDriver.m index 8029c138..60e942e0 100644 --- a/Sparkle/SPUScheduledUpdateDriver.m +++ b/Sparkle/SPUScheduledUpdateDriver.m @@ -19,7 +19,6 @@ @property (nonatomic, readonly) SPUUIBasedUpdateDriver *uiDriver; @property (nonatomic) BOOL showedUpdate; -@property (nonatomic) BOOL showingUpdate; @end @@ -27,7 +26,6 @@ @synthesize uiDriver = _uiDriver; @synthesize showedUpdate = _showedUpdate; -@synthesize showingUpdate = _showingUpdate; - (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id )userDriver updaterDelegate:(nullable id )updaterDelegate { @@ -65,12 +63,11 @@ - (void)uiDriverDidShowUpdate { self.showedUpdate = YES; - self.showingUpdate = YES; } -- (void)uiDriverFinishedShowingUpdate +- (BOOL)showingUpdate { - self.showingUpdate = NO; + return self.uiDriver.showingUpdate; } - (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *) error diff --git a/Sparkle/SPUUIBasedUpdateDriver.h b/Sparkle/SPUUIBasedUpdateDriver.h index bcba39d6..da12d9b8 100644 --- a/Sparkle/SPUUIBasedUpdateDriver.h +++ b/Sparkle/SPUUIBasedUpdateDriver.h @@ -17,11 +17,9 @@ NS_ASSUME_NONNULL_BEGIN - (void)coreDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error; - (void)uiDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error; -- (void)uiDriverDidShowUpdate; -- (void)uiDriverFinishedShowingUpdate; - @optional +- (void)uiDriverDidShowUpdate; - (void)basicDriverDidFinishLoadingAppcast; @end @@ -43,6 +41,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)resumeUpdate:(id)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock; +@property (nonatomic, readonly) BOOL showingUpdate; + - (void)abortUpdateWithError:(nullable NSError *)error; @end diff --git a/Sparkle/SPUUIBasedUpdateDriver.m b/Sparkle/SPUUIBasedUpdateDriver.m index 4ab14602..5e681d5f 100644 --- a/Sparkle/SPUUIBasedUpdateDriver.m +++ b/Sparkle/SPUUIBasedUpdateDriver.m @@ -33,6 +33,7 @@ @property (nonatomic) BOOL resumingInstallingUpdate; @property (nonatomic) BOOL resumingDownloadedUpdate; @property (nonatomic) BOOL preventsInstallerInteraction; +@property (nonatomic) BOOL showingUpdate; @end @@ -48,6 +49,7 @@ @synthesize resumingInstallingUpdate = _resumingInstallingUpdate; @synthesize resumingDownloadedUpdate = _resumingDownloadedUpdate; @synthesize preventsInstallerInteraction = _preventsInstallerInteraction; +@synthesize showingUpdate = _showingUpdate; - (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id )userDriver userInitiated:(BOOL)userInitiated updaterDelegate:(nullable id )updaterDelegate delegate:(id)delegate { @@ -115,7 +117,7 @@ [self.userDriver showInformationalUpdateFoundWithAppcastItem:updateItem userInitiated:self.userInitiated reply:^(SPUInformationalUpdateAlertChoice choice) { dispatch_async(dispatch_get_main_queue(), ^{ - [self.delegate uiDriverFinishedShowingUpdate]; + self.showingUpdate = NO; switch (choice) { case SPUSkipThisInformationalVersionChoice: @@ -134,7 +136,7 @@ } else if (self.resumingDownloadedUpdate) { [self.userDriver showDownloadedUpdateFoundWithAppcastItem:updateItem userInitiated:self.userInitiated reply:^(SPUUpdateAlertChoice choice) { dispatch_async(dispatch_get_main_queue(), ^{ - [self.delegate uiDriverFinishedShowingUpdate]; + self.showingUpdate = NO; [self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey]; switch (choice) { @@ -158,7 +160,7 @@ } else if (!self.resumingInstallingUpdate) { [self.userDriver showUpdateFoundWithAppcastItem:updateItem userInitiated:self.userInitiated reply:^(SPUUpdateAlertChoice choice) { dispatch_async(dispatch_get_main_queue(), ^{ - [self.delegate uiDriverFinishedShowingUpdate]; + self.showingUpdate = NO; [self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey]; switch (choice) { @@ -181,7 +183,7 @@ } else { [self.userDriver showResumableUpdateFoundWithAppcastItem:updateItem userInitiated:self.userInitiated reply:^(SPUInstallUpdateStatus choice) { dispatch_async(dispatch_get_main_queue(), ^{ - [self.delegate uiDriverFinishedShowingUpdate]; + self.showingUpdate = NO; [self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey]; [self.coreDriver finishInstallationWithResponse:choice displayingUserInterface:!self.preventsInstallerInteraction]; @@ -189,7 +191,11 @@ }]; } - [self.delegate uiDriverDidShowUpdate]; + self.showingUpdate = YES; + + if ([self.delegate respondsToSelector:@selector(uiDriverDidShowUpdate)]) { + [self.delegate uiDriverDidShowUpdate]; + } if (updateItem.releaseNotesURL != nil && (![updaterDelegate respondsToSelector:@selector(updaterShouldDownloadReleaseNotes:)] || [updaterDelegate updaterShouldDownloadReleaseNotes:self.updater])) { NSURLRequest *request = [NSURLRequest requestWithURL:updateItem.releaseNotesURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30]; diff --git a/Sparkle/SPUUserInitiatedUpdateDriver.m b/Sparkle/SPUUserInitiatedUpdateDriver.m index 499f2da3..ca4364b2 100644 --- a/Sparkle/SPUUserInitiatedUpdateDriver.m +++ b/Sparkle/SPUUserInitiatedUpdateDriver.m @@ -18,7 +18,6 @@ @property (nonatomic, readonly) SPUUIBasedUpdateDriver *uiDriver; @property (nonatomic, readonly) id userDriver; @property (nonatomic) BOOL showingUserInitiatedProgress; -@property (nonatomic) BOOL showingUpdate; @property (nonatomic) BOOL aborted; @end @@ -27,7 +26,6 @@ @synthesize uiDriver = _uiDriver; @synthesize userDriver = _userDriver; -@synthesize showingUpdate = _showingUpdate; @synthesize showingUserInitiatedProgress = _showingUserInitiatedProgress; @synthesize aborted = _aborted; @@ -93,14 +91,9 @@ [self.uiDriver resumeUpdate:resumableUpdate completion:completionBlock]; } -- (void)uiDriverDidShowUpdate +- (BOOL)showingUpdate { - self.showingUpdate = YES; -} - -- (void)uiDriverFinishedShowingUpdate -{ - self.showingUpdate = NO; + return self.uiDriver.showingUpdate; } - (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error