mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Remove passing includesSkippedUpdates in favor of background flag
This commit is contained in:
1 parent
e7441351d7
commit
f1be9f72d5
12 files changed
+24
-26
No files matched your search
Vendored
+1
-1
@@ -60,7 +60,7 @@
|
||||
if (error != nil) {
|
||||
[self abortUpdateWithError:error];
|
||||
} else {
|
||||
[self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES includesSkippedUpdates:NO requiresSilentInstall:YES];
|
||||
[self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES requiresSilentInstall:YES];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -32,7 +32,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)prepareCheckForUpdatesWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background includesSkippedUpdates:(BOOL)includesSkippedUpdates;
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background;
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
|
||||
Vendored
+5
-4
@@ -65,7 +65,7 @@
|
||||
self.completionBlock = completionBlock;
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background includesSkippedUpdates:(BOOL)includesSkippedUpdates
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background
|
||||
{
|
||||
if ([self.host isRunningOnReadOnlyVolume]) {
|
||||
NSString *hostName = self.host.name;
|
||||
@@ -75,7 +75,7 @@
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"%1$@ can't be updated, because it was opened from a read-only or a temporary location.", nil), hostName], NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:SULocalizedString(@"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again.", nil), hostName] }]];
|
||||
}
|
||||
} else {
|
||||
[self.appcastDriver loadAppcastFromURL:appcastURL userAgent:userAgent httpHeaders:httpHeaders inBackground:background includesSkippedUpdates:includesSkippedUpdates];
|
||||
[self.appcastDriver loadAppcastFromURL:appcastURL userAgent:userAgent httpHeaders:httpHeaders inBackground:background];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
NSString *recoverySuggestion;
|
||||
NSString *recoveryOption;
|
||||
|
||||
if (latestAppcastItem != nil) { // if the appcast was successfully loaded
|
||||
if (latestAppcastItem != nil) {
|
||||
switch (hostToLatestAppcastItemComparisonResult) {
|
||||
case NSOrderedDescending:
|
||||
// This means the user is a 'newer than latest' version. give a slight hint to the user instead of wrongly claiming this version is identical to the latest feed version.
|
||||
@@ -204,7 +204,8 @@
|
||||
|
||||
recoveryOption = @"OK";
|
||||
} else {
|
||||
// When no updates are found in the appcast
|
||||
// When no updates are found in the appcast, or latest appcast item info
|
||||
// was not provided (i.e, for a background update check)
|
||||
localizedDescription = SULocalizedString(@"Update Error!", nil);
|
||||
recoverySuggestion = SULocalizedString(@"No valid update information could be loaded.", nil);
|
||||
recoveryOption = SULocalizedString(@"Cancel Update", nil);
|
||||
|
||||
Vendored
+1
-1
@@ -55,7 +55,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)preflightForUpdatePermissionPreventingInstallerInteraction:(BOOL)preventsInstallerInteraction reply:(void (^)(NSError * _Nullable))reply;
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background includesSkippedUpdates:(BOOL)includesSkippedUpdates requiresSilentInstall:(BOOL)silentInstall;
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background requiresSilentInstall:(BOOL)silentInstall;
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -114,13 +114,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background includesSkippedUpdates:(BOOL)includesSkippedUpdates requiresSilentInstall:(BOOL)silentInstall
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background requiresSilentInstall:(BOOL)silentInstall
|
||||
{
|
||||
self.userAgent = userAgent;
|
||||
self.httpHeaders = httpHeaders;
|
||||
self.silentInstall = silentInstall;
|
||||
|
||||
[self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:background includesSkippedUpdates:includesSkippedUpdates];
|
||||
[self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:background];
|
||||
}
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
|
||||
|
||||
Vendored
+1
-1
@@ -39,7 +39,7 @@
|
||||
|
||||
[self.basicDriver prepareCheckForUpdatesWithCompletion:completionBlock];
|
||||
|
||||
[self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES includesSkippedUpdates:NO];
|
||||
[self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES];
|
||||
}
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
|
||||
|
||||
Vendored
+1
-1
@@ -45,7 +45,7 @@
|
||||
// Don't tell the user about the permission error for scheduled update checks
|
||||
[self abortUpdateWithError:nil];
|
||||
} else {
|
||||
[self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES includesSkippedUpdates:NO];
|
||||
[self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)preflightForUpdatePermissionPreventingInstallerInteraction:(BOOL)preventsInstallerInteraction reply:(void (^)(NSError * _Nullable))reply;
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background includesSkippedUpdates:(BOOL)includesSkippedUpdates;
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background;
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -131,9 +131,9 @@
|
||||
[self.coreDriver preflightForUpdatePermissionPreventingInstallerInteraction:preventsInstallerInteraction reply:reply];
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background includesSkippedUpdates:(BOOL)includesSkippedUpdates
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background
|
||||
{
|
||||
[self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:background includesSkippedUpdates:includesSkippedUpdates requiresSilentInstall:NO];
|
||||
[self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:background requiresSilentInstall:NO];
|
||||
}
|
||||
|
||||
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@
|
||||
}];
|
||||
}
|
||||
|
||||
[self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:NO includesSkippedUpdates:YES];
|
||||
[self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:NO];
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
Vendored
+1
-1
@@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(nullable id <SUAppcastDriverDelegate>)delegate;
|
||||
|
||||
- (void)loadAppcastFromURL:(NSURL *)appcastURL userAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background includesSkippedUpdates:(BOOL)includesSkippedUpdates;
|
||||
- (void)loadAppcastFromURL:(NSURL *)appcastURL userAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background;
|
||||
|
||||
- (void)cleanup:(void (^)(void))completionHandler;
|
||||
|
||||
|
||||
Vendored
+7
-10
@@ -33,7 +33,6 @@
|
||||
@property (nullable, nonatomic, readonly, weak) id <SPUUpdaterDelegate> updaterDelegate;
|
||||
@property (nullable, nonatomic, readonly, weak) id <SUAppcastDriverDelegate> delegate;
|
||||
@property (nonatomic) SPUDownloadDriver *downloadDriver;
|
||||
@property (nonatomic) BOOL includesSkippedUpdates;
|
||||
|
||||
@end
|
||||
|
||||
@@ -44,7 +43,6 @@
|
||||
@synthesize updaterDelegate = _updaterDelegate;
|
||||
@synthesize delegate = _delegate;
|
||||
@synthesize downloadDriver = _downloadDriver;
|
||||
@synthesize includesSkippedUpdates = _includesSkippedUpdates;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host updater:(id)updater updaterDelegate:(id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SUAppcastDriverDelegate>)delegate
|
||||
{
|
||||
@@ -58,7 +56,7 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)loadAppcastFromURL:(NSURL *)appcastURL userAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background includesSkippedUpdates:(BOOL)includesSkippedUpdates
|
||||
- (void)loadAppcastFromURL:(NSURL *)appcastURL userAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background
|
||||
{
|
||||
NSMutableDictionary *requestHTTPHeaders = [NSMutableDictionary dictionary];
|
||||
if (httpHeaders != nil) {
|
||||
@@ -68,8 +66,6 @@
|
||||
|
||||
self.downloadDriver = [[SPUDownloadDriver alloc] initWithRequestURL:appcastURL host:self.host userAgent:userAgent httpHeaders:requestHTTPHeaders inBackground:background delegate:self];
|
||||
|
||||
self.includesSkippedUpdates = includesSkippedUpdates;
|
||||
|
||||
[self.downloadDriver downloadFile];
|
||||
}
|
||||
|
||||
@@ -87,7 +83,7 @@
|
||||
|
||||
[self.delegate didFailToFetchAppcastWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastParseError userInfo:userInfo]];
|
||||
} else {
|
||||
[self appcastDidFinishLoading:appcast inBackground:self.downloadDriver.inBackground includesSkippedUpdates:self.includesSkippedUpdates];
|
||||
[self appcastDidFinishLoading:appcast inBackground:self.downloadDriver.inBackground];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +151,7 @@
|
||||
return [self preferredUpdateForRegularAppcastItem:regularItem secondaryUpdate:secondaryAppcastItem];
|
||||
}
|
||||
|
||||
- (void)appcastDidFinishLoading:(SUAppcast *)loadedAppcast inBackground:(BOOL)background includesSkippedUpdates:(BOOL)includesSkippedUpdates
|
||||
- (void)appcastDidFinishLoading:(SUAppcast *)loadedAppcast inBackground:(BOOL)background
|
||||
{
|
||||
[self.delegate didFinishLoadingAppcast:loadedAppcast];
|
||||
|
||||
@@ -171,7 +167,7 @@
|
||||
|
||||
NSNumber *phasedUpdateGroup = background ? @([SUPhasedUpdateGroupInfo updateGroupForHost:self.host]) : nil;
|
||||
|
||||
NSString *skippedVersion = !includesSkippedUpdates ? [self.host objectForUserDefaultsKey:SUSkippedVersionKey] : nil;
|
||||
NSString *skippedVersion = background ? [self.host objectForUserDefaultsKey:SUSkippedVersionKey] : nil;
|
||||
|
||||
// First filter out min/max OS version and see if there's an update that passes
|
||||
// the minimum autoupdate version. We filter out updates that fail the minimum
|
||||
@@ -203,11 +199,12 @@
|
||||
} else {
|
||||
// Find the latest appcast item even if it fails min/max OS test
|
||||
// We want to inform the user if an update requires a different OS version
|
||||
SUAppcastItem *notFoundPrimaryItem = [self retrieveBestAppcastItemFromAppcast:macOSAppcast versionComparator:applicationVersionComparator secondaryUpdate:nil];
|
||||
// We only need to do this if an update is being checked automatically in the background
|
||||
SUAppcastItem *notFoundPrimaryItem = background ? [self retrieveBestAppcastItemFromAppcast:macOSAppcast versionComparator:applicationVersionComparator secondaryUpdate:nil] : nil;
|
||||
|
||||
NSComparisonResult hostToLatestAppcastItemComparisonResult = (notFoundPrimaryItem != nil) ? [applicationVersionComparator compareVersion:self.host.version toVersion:notFoundPrimaryItem.versionString] : 0;
|
||||
|
||||
SUStandardVersionComparator *standardVersionComparator = [[SUStandardVersionComparator alloc] init];
|
||||
SUStandardVersionComparator *standardVersionComparator = (notFoundPrimaryItem != nil) ? [[SUStandardVersionComparator alloc] init] : nil;
|
||||
|
||||
BOOL passesMinOSVersion = (notFoundPrimaryItem != nil) ? [[self class] isItemMinimumOperatingSystemVersionOK:notFoundPrimaryItem versionComparator:standardVersionComparator] : YES;
|
||||
BOOL passesMaxOSVersion = (notFoundPrimaryItem != nil) ? [[self class] isItemMaximumOperatingSystemVersionOK:notFoundPrimaryItem versionComparator:standardVersionComparator] : YES;
|
||||
|
||||
Reference in new issue
Block a user