From 062bfaaa97f3cdfe466379ded0df0621676b2498 Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 31 May 2021 10:59:35 -0700 Subject: [PATCH] Remove old code passing min/max OS tests --- Sparkle/SPUBasicUpdateDriver.m | 8 +++++--- Sparkle/SUAppcastDriver.h | 2 +- Sparkle/SUAppcastDriver.m | 10 +--------- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Sparkle/SPUBasicUpdateDriver.m b/Sparkle/SPUBasicUpdateDriver.m index c0b2459a..173bde88 100644 --- a/Sparkle/SPUBasicUpdateDriver.m +++ b/Sparkle/SPUBasicUpdateDriver.m @@ -18,6 +18,8 @@ #import "SPUProbeInstallStatus.h" #import "SPUInstallationInfo.h" #import "SPUResumableUpdate.h" +#import "SPUAppcastItemState.h" +#import "SUAppcastItem+Private.h" #include "AppKitPrevention.h" @@ -157,7 +159,7 @@ [self notifyFoundValidUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryAppcastItem preventsAutoupdate:preventsAutoupdate systemDomain:nil]; } -- (void)didNotFindUpdateWithLatestAppcastItem:(nullable SUAppcastItem *)latestAppcastItem hostToLatestAppcastItemComparisonResult:(NSComparisonResult)hostToLatestAppcastItemComparisonResult passesMinOSVersion:(BOOL)passesMinOSVersion passesMaxOSVersion:(BOOL)passesMaxOSVersion +- (void)didNotFindUpdateWithLatestAppcastItem:(nullable SUAppcastItem *)latestAppcastItem hostToLatestAppcastItemComparisonResult:(NSComparisonResult)hostToLatestAppcastItemComparisonResult { if (!self.aborted) { if ([self.updaterDelegate respondsToSelector:@selector((updaterDidNotFindUpdate:))]) { @@ -185,11 +187,11 @@ break; case NSOrderedAscending: // This means a new update doesn't match the OS requirements - if (!passesMinOSVersion) { + if (!latestAppcastItem.state.minimumOperatingSystemVersionIsOK) { localizedDescription = SULocalizedString(@"Your macOS version is too old", nil); recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required.", nil), [self.host name], latestAppcastItem.versionString, latestAppcastItem.minimumSystemVersion]; - } else if (!passesMaxOSVersion) { + } else if (!latestAppcastItem.state.maximumOperatingSystemVersionIsOK) { localizedDescription = SULocalizedString(@"Your macOS version is too new", nil); recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@.", nil), [self.host name], latestAppcastItem.versionString, latestAppcastItem.maximumSystemVersion]; diff --git a/Sparkle/SUAppcastDriver.h b/Sparkle/SUAppcastDriver.h index cc142d72..12509e3a 100644 --- a/Sparkle/SUAppcastDriver.h +++ b/Sparkle/SUAppcastDriver.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)didFailToFetchAppcastWithError:(NSError *)error; - (void)didFinishLoadingAppcast:(SUAppcast *)appcast; - (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)appcastItem secondaryAppcastItem:(SUAppcastItem *)secondaryAppcastItem preventsAutoupdate:(BOOL)preventsAutoupdate; -- (void)didNotFindUpdateWithLatestAppcastItem:(nullable SUAppcastItem *)latestAppcastItem hostToLatestAppcastItemComparisonResult:(NSComparisonResult)hostToLatestAppcastItemComparisonResult passesMinOSVersion:(BOOL)passesMinOSVersion passesMaxOSVersion:(BOOL)passesMaxOSVersion; +- (void)didNotFindUpdateWithLatestAppcastItem:(nullable SUAppcastItem *)latestAppcastItem hostToLatestAppcastItemComparisonResult:(NSComparisonResult)hostToLatestAppcastItemComparisonResult; @end diff --git a/Sparkle/SUAppcastDriver.m b/Sparkle/SUAppcastDriver.m index 1ea31a7c..b8ff51ab 100644 --- a/Sparkle/SUAppcastDriver.m +++ b/Sparkle/SUAppcastDriver.m @@ -209,24 +209,16 @@ // We only need to do this if an update is being checked by the user manually SUAppcastItem *notFoundPrimaryItem; NSComparisonResult hostToLatestAppcastItemComparisonResult; - BOOL passesMinOSVersion; - BOOL passesMaxOSVersion; if (!background) { notFoundPrimaryItem = [self retrieveBestAppcastItemFromAppcast:macOSAppcast versionComparator:applicationVersionComparator secondaryUpdate:nil]; hostToLatestAppcastItemComparisonResult = [applicationVersionComparator compareVersion:self.host.version toVersion:notFoundPrimaryItem.versionString]; - - passesMinOSVersion = notFoundPrimaryItem.state.minimumOperatingSystemVersionIsOK; - - passesMaxOSVersion = notFoundPrimaryItem.state.maximumOperatingSystemVersionIsOK; } else { notFoundPrimaryItem = nil; hostToLatestAppcastItemComparisonResult = 0; - passesMinOSVersion = YES; - passesMaxOSVersion = YES; } - [self.delegate didNotFindUpdateWithLatestAppcastItem:notFoundPrimaryItem hostToLatestAppcastItemComparisonResult:hostToLatestAppcastItemComparisonResult passesMinOSVersion:passesMinOSVersion passesMaxOSVersion:passesMaxOSVersion]; + [self.delegate didNotFindUpdateWithLatestAppcastItem:notFoundPrimaryItem hostToLatestAppcastItemComparisonResult:hostToLatestAppcastItemComparisonResult]; } }