mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Include secondary non-delta update to resumable updates
This commit is contained in:
1 parent
e51eb32403
commit
71557fac85
16 files changed
+51
-50
No files matched your search
Vendored
+3
-3
@@ -77,15 +77,15 @@
|
||||
SULog(SULogLevelError, @"Error: resumeDownloadedUpdate:completion: called on SPUAutomaticUpdateDriver");
|
||||
}
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem preventsAutoupdate:(BOOL)preventsAutoupdate
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate
|
||||
{
|
||||
self.updateItem = updateItem;
|
||||
|
||||
if (updateItem.isInformationOnlyUpdate || preventsAutoupdate) {
|
||||
[self.coreDriver deferInformationalUpdate:updateItem preventsAutoupdate:preventsAutoupdate];
|
||||
[self.coreDriver deferInformationalUpdate:updateItem secondaryUpdate:secondaryUpdateItem preventsAutoupdate:preventsAutoupdate];
|
||||
[self abortUpdate];
|
||||
} else {
|
||||
[self.coreDriver downloadUpdateFromAppcastItem:updateItem inBackground:YES];
|
||||
[self.coreDriver downloadUpdateFromAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem inBackground:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-3
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol SPUBasicUpdateDriverDelegate <NSObject>
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)appcastItem preventsAutoupdate:(BOOL)preventsAutoupdate systemDomain:(NSNumber * _Nullable)systemDomain;
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)appcastItem secondaryAppcastItem:(SUAppcastItem *)secondaryAppcastItem preventsAutoupdate:(BOOL)preventsAutoupdate systemDomain:(NSNumber * _Nullable)systemDomain;
|
||||
|
||||
- (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error;
|
||||
|
||||
@@ -38,8 +38,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
@property (nullable, nonatomic, readonly) SUAppcastItem *secondaryUpdateItem;
|
||||
|
||||
- (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldSignalShowingUpdate resumableUpdate:(id<SPUResumableUpdate> _Nullable)resumableUpdate error:(nullable NSError *)error;
|
||||
|
||||
@end
|
||||
|
||||
Vendored
+8
-13
@@ -79,7 +79,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)notifyResumableUpdateItem:(SUAppcastItem *)updateItem systemDomain:(NSNumber * _Nullable)systemDomain
|
||||
- (void)notifyResumableUpdateItem:(SUAppcastItem *)updateItem secondaryUpdateItem:(SUAppcastItem *)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain
|
||||
{
|
||||
if (updateItem == nil) {
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUResumeAppcastError userInfo:@{ NSLocalizedDescriptionKey: SULocalizedString(@"Failed to resume installing update.", nil) }]];
|
||||
@@ -88,7 +88,7 @@
|
||||
[self notifyFinishLoadingAppcast];
|
||||
|
||||
SUAppcastItem *nonNullUpdateItem = updateItem;
|
||||
[self notifyFoundValidUpdateWithAppcastItem:nonNullUpdateItem preventsAutoupdate:NO systemDomain:systemDomain];
|
||||
[self notifyFoundValidUpdateWithAppcastItem:nonNullUpdateItem secondaryAppcastItem:secondaryUpdateItem preventsAutoupdate:NO systemDomain:systemDomain];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
assert(hostBundleIdentifier != nil);
|
||||
[SPUProbeInstallStatus probeInstallerUpdateItemForHostBundleIdentifier:hostBundleIdentifier completion:^(SPUInstallationInfo * _Nullable installationInfo) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self notifyResumableUpdateItem:installationInfo.appcastItem systemDomain:@(installationInfo.systemDomain)];
|
||||
[self notifyResumableUpdateItem:installationInfo.appcastItem secondaryUpdateItem:nil systemDomain:@(installationInfo.systemDomain)];
|
||||
});
|
||||
}];
|
||||
}
|
||||
@@ -109,12 +109,7 @@
|
||||
{
|
||||
self.completionBlock = completionBlock;
|
||||
|
||||
[self notifyResumableUpdateItem:resumableUpdate.updateItem systemDomain:nil];
|
||||
}
|
||||
|
||||
- (SUAppcastItem *)secondaryUpdateItem
|
||||
{
|
||||
return self.appcastDriver.secondaryUpdateItem;
|
||||
[self notifyResumableUpdateItem:resumableUpdate.updateItem secondaryUpdateItem:resumableUpdate.secondaryUpdateItem systemDomain:nil];
|
||||
}
|
||||
|
||||
- (void)didFailToFetchAppcastWithError:(NSError *)error
|
||||
@@ -142,7 +137,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)notifyFoundValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem preventsAutoupdate:(BOOL)preventsAutoupdate systemDomain:(NSNumber * _Nullable)systemDomain
|
||||
- (void)notifyFoundValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate systemDomain:(NSNumber * _Nullable)systemDomain
|
||||
{
|
||||
if (!self.aborted) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification
|
||||
@@ -153,13 +148,13 @@
|
||||
[self.updaterDelegate updater:self.updater didFindValidUpdate:updateItem];
|
||||
}
|
||||
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem preventsAutoupdate:preventsAutoupdate systemDomain:systemDomain];
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem preventsAutoupdate:preventsAutoupdate systemDomain:systemDomain];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem preventsAutoupdate:(BOOL)preventsAutoupdate
|
||||
- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryAppcastItem preventsAutoupdate:(BOOL)preventsAutoupdate
|
||||
{
|
||||
[self notifyFoundValidUpdateWithAppcastItem:updateItem preventsAutoupdate:preventsAutoupdate systemDomain:nil];
|
||||
[self notifyFoundValidUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryAppcastItem preventsAutoupdate:preventsAutoupdate systemDomain:nil];
|
||||
}
|
||||
|
||||
- (void)didNotFindUpdateWithLatestAppcastItem:(nullable SUAppcastItem *)latestAppcastItem hostToLatestAppcastItemComparisonResult:(NSComparisonResult)hostToLatestAppcastItemComparisonResult
|
||||
|
||||
Vendored
+3
-3
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol SPUCoreBasedUpdateDriverDelegate <NSObject>
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem preventsAutoupdate:(BOOL)preventsAutoupdate;
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryAppcastItem preventsAutoupdate:(BOOL)preventsAutoupdate;
|
||||
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently;
|
||||
|
||||
@@ -61,9 +61,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
- (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem inBackground:(BOOL)background;
|
||||
- (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem inBackground:(BOOL)background;
|
||||
|
||||
- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem preventsAutoupdate:(BOOL)preventsAutoupdate;
|
||||
- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem secondaryUpdate:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate;
|
||||
|
||||
- (void)extractDownloadedUpdate;
|
||||
|
||||
|
||||
Vendored
+15
-10
@@ -32,6 +32,7 @@
|
||||
@property (nonatomic, readonly) SPUInstallerDriver *installerDriver;
|
||||
@property (nonatomic, weak, readonly) id<SPUCoreBasedUpdateDriverDelegate> delegate;
|
||||
@property (nonatomic) SUAppcastItem *updateItem;
|
||||
@property (nonatomic) SUAppcastItem *secondaryUpdateItem;
|
||||
@property (nonatomic) id<SPUResumableUpdate> resumableUpdate;
|
||||
@property (nonatomic) SPUDownloadedUpdate *downloadedUpdateForRemoval;
|
||||
|
||||
@@ -53,6 +54,7 @@
|
||||
@synthesize installerDriver = _installerDriver;
|
||||
@synthesize delegate = _delegate;
|
||||
@synthesize updateItem = _updateItem;
|
||||
@synthesize secondaryUpdateItem = _secondaryUpdateItem;
|
||||
@synthesize host = _host;
|
||||
@synthesize resumingInstallingUpdate = _resumingInstallingUpdate;
|
||||
@synthesize silentInstall = _silentInstall;
|
||||
@@ -147,33 +149,34 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem preventsAutoupdate:(BOOL)preventsAutoupdate systemDomain:(NSNumber * _Nullable)systemDomain
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate systemDomain:(NSNumber * _Nullable)systemDomain
|
||||
{
|
||||
self.updateItem = updateItem;
|
||||
self.secondaryUpdateItem = secondaryUpdateItem;
|
||||
|
||||
if (self.resumingInstallingUpdate) {
|
||||
assert(systemDomain != nil);
|
||||
[self.installerDriver resumeInstallingUpdateWithUpdateItem:updateItem systemDomain:systemDomain.boolValue];
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem preventsAutoupdate:preventsAutoupdate];
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem preventsAutoupdate:preventsAutoupdate];
|
||||
} else {
|
||||
if (!self.preventsInstallerInteraction) {
|
||||
// Simple case - delegate allows interaction, so we should continue along
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem preventsAutoupdate:preventsAutoupdate];
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem preventsAutoupdate:preventsAutoupdate];
|
||||
} else {
|
||||
// Package type installations will always require installer interaction as long as we don't support running as root
|
||||
// If it's not a package type installation, we should be okay since we did an auth check before checking for updates above
|
||||
if (![updateItem.installationType isEqualToString:SPUInstallationTypeApplication]) {
|
||||
[self.delegate coreDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUNotAllowedInteractionError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"A new update is available but cannot be installed because interaction has been prevented."] }]];
|
||||
} else {
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem preventsAutoupdate:preventsAutoupdate];
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem preventsAutoupdate:preventsAutoupdate];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem inBackground:(BOOL)background
|
||||
- (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem inBackground:(BOOL)background
|
||||
{
|
||||
self.downloadDriver = [[SPUDownloadDriver alloc] initWithUpdateItem:updateItem host:self.host userAgent:self.userAgent httpHeaders:self.httpHeaders inBackground:background delegate:self];
|
||||
self.downloadDriver = [[SPUDownloadDriver alloc] initWithUpdateItem:updateItem secondaryUpdateItem:secondaryUpdateItem host:self.host userAgent:self.userAgent httpHeaders:self.httpHeaders inBackground:background delegate:self];
|
||||
|
||||
if ([self.updaterDelegate respondsToSelector:@selector((updater:willDownloadUpdate:withRequest:))]) {
|
||||
[self.updaterDelegate updater:self.updater
|
||||
@@ -222,9 +225,9 @@
|
||||
[self extractUpdate:downloadedUpdate];
|
||||
}
|
||||
|
||||
- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem preventsAutoupdate:(BOOL)preventsAutoupdate
|
||||
- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem secondaryUpdate:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate
|
||||
{
|
||||
self.resumableUpdate = [[SPUInformationalUpdate alloc] initWithAppcastItem:updateItem preventsAutoupdate:preventsAutoupdate];
|
||||
self.resumableUpdate = [[SPUInformationalUpdate alloc] initWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem preventsAutoupdate:preventsAutoupdate];
|
||||
}
|
||||
|
||||
- (void)extractDownloadedUpdate
|
||||
@@ -381,7 +384,7 @@
|
||||
|
||||
- (void)installerDidFailToApplyDeltaUpdate
|
||||
{
|
||||
SUAppcastItem *secondaryUpdateItem = self.basicDriver.secondaryUpdateItem;
|
||||
SUAppcastItem *secondaryUpdateItem = self.secondaryUpdateItem;
|
||||
assert(secondaryUpdateItem != nil);
|
||||
|
||||
BOOL backgroundDownload = self.downloadDriver.inBackground;
|
||||
@@ -390,7 +393,9 @@
|
||||
|
||||
// Fall back to the non-delta update. Note that we don't want to trigger another update was found event.
|
||||
self.updateItem = secondaryUpdateItem;
|
||||
[self downloadUpdateFromAppcastItem:secondaryUpdateItem inBackground:backgroundDownload];
|
||||
self.secondaryUpdateItem = nil;
|
||||
|
||||
[self downloadUpdateFromAppcastItem:secondaryUpdateItem secondaryAppcastItem:nil inBackground:backgroundDownload];
|
||||
}
|
||||
|
||||
- (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldShowUpdateImmediately error:(nullable NSError *)error
|
||||
|
||||
Vendored
+1
-1
@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SPUDownloadDriver : NSObject
|
||||
|
||||
- (instancetype)initWithUpdateItem:(SUAppcastItem *)updateItem host:(SUHost *)host userAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background delegate:(id<SPUDownloadDriverDelegate>)delegate;
|
||||
- (instancetype)initWithUpdateItem:(SUAppcastItem *)updateItem secondaryUpdateItem:(SUAppcastItem * _Nullable)secondaryUpdateItem host:(SUHost *)host userAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background delegate:(id<SPUDownloadDriverDelegate>)delegate;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host;
|
||||
|
||||
|
||||
Vendored
+5
-2
@@ -28,6 +28,7 @@
|
||||
@property (nonatomic) id<SPUDownloaderProtocol> downloader;
|
||||
@property (nonatomic) NSXPCConnection *connection;
|
||||
@property (nonatomic, readonly) SUAppcastItem *updateItem;
|
||||
@property (nonatomic, readonly) SUAppcastItem *secondaryUpdateItem;
|
||||
@property (nonatomic, readonly) SUHost *host;
|
||||
@property (nonatomic, copy) NSString *temporaryDirectory;
|
||||
@property (nonatomic, copy) NSString *downloadName;
|
||||
@@ -43,6 +44,7 @@
|
||||
@synthesize downloader = _downloader;
|
||||
@synthesize connection = _connection;
|
||||
@synthesize updateItem = _updateItem;
|
||||
@synthesize secondaryUpdateItem = _secondaryUpdateItem;
|
||||
@synthesize request = _request;
|
||||
@synthesize inBackground = _inBackground;
|
||||
@synthesize host = _host;
|
||||
@@ -106,11 +108,12 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithUpdateItem:(SUAppcastItem *)updateItem host:(SUHost *)host userAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background delegate:(id<SPUDownloadDriverDelegate>)delegate
|
||||
- (instancetype)initWithUpdateItem:(SUAppcastItem *)updateItem secondaryUpdateItem:(SUAppcastItem * _Nullable)secondaryUpdateItem host:(SUHost *)host userAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background delegate:(id<SPUDownloadDriverDelegate>)delegate
|
||||
{
|
||||
self = [self initWithHost:host];
|
||||
if (self != nil) {
|
||||
_updateItem = updateItem;
|
||||
_secondaryUpdateItem = secondaryUpdateItem;
|
||||
_delegate = delegate;
|
||||
|
||||
_inBackground = background;
|
||||
@@ -188,7 +191,7 @@
|
||||
SULog(SULogLevelError, @"Warning: Downloader's expected content length (%llu) != Appcast item's length (%llu)", self.expectedContentLength, self.updateItem.contentLength);
|
||||
}
|
||||
|
||||
SPUDownloadedUpdate *downloadedUpdate = [[SPUDownloadedUpdate alloc] initWithAppcastItem:self.updateItem downloadName:self.downloadName temporaryDirectory:self.temporaryDirectory];
|
||||
SPUDownloadedUpdate *downloadedUpdate = [[SPUDownloadedUpdate alloc] initWithAppcastItem:self.updateItem secondaryAppcastItem:self.secondaryUpdateItem downloadName:self.downloadName temporaryDirectory:self.temporaryDirectory];
|
||||
|
||||
[self.delegate downloadDriverDidDownloadUpdate:downloadedUpdate];
|
||||
});
|
||||
|
||||
Vendored
+1
-1
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SPUDownloadedUpdate : NSObject <SPUResumableUpdate>
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem downloadName:(NSString *)downloadName temporaryDirectory:(NSString *)temporaryDirectory;
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryItem downloadName:(NSString *)downloadName temporaryDirectory:(NSString *)temporaryDirectory;
|
||||
|
||||
@property (nonatomic, copy, readonly) NSString *downloadName;
|
||||
@property (nonatomic, copy, readonly) NSString *temporaryDirectory;
|
||||
|
||||
Vendored
+3
-1
@@ -16,15 +16,17 @@
|
||||
// If we ever enable auto-synthesize in the future, we'll still need this synthesize
|
||||
// because the property is declared in a protocol
|
||||
@synthesize updateItem = _updateItem;
|
||||
@synthesize secondaryUpdateItem = _secondaryUpdateItem;
|
||||
|
||||
@synthesize downloadName = _downloadName;
|
||||
@synthesize temporaryDirectory = _temporaryDirectory;
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem downloadName:(NSString *)downloadName temporaryDirectory:(NSString *)temporaryDirectory
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem downloadName:(NSString *)downloadName temporaryDirectory:(NSString *)temporaryDirectory
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_updateItem = updateItem;
|
||||
_secondaryUpdateItem = secondaryUpdateItem;
|
||||
_downloadName = [downloadName copy];
|
||||
_temporaryDirectory = [temporaryDirectory copy];
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SPUInformationalUpdate : NSObject <SPUResumableUpdate>
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem preventsAutoupdate:(BOOL)preventsAutoupdate;
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Vendored
+3
-1
@@ -16,13 +16,15 @@
|
||||
// If we ever enable auto-synthesize in the future, we'll still need this synthesize
|
||||
// because the property is declared in a protocol
|
||||
@synthesize updateItem = _updateItem;
|
||||
@synthesize secondaryUpdateItem = _secondaryUpdateItem;
|
||||
@synthesize preventsAutoupdate = _preventsAutoupdate;
|
||||
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem preventsAutoupdate:(BOOL)preventsAutoupdate
|
||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_updateItem = updateItem;
|
||||
_secondaryUpdateItem = secondaryUpdateItem;
|
||||
_preventsAutoupdate = preventsAutoupdate;
|
||||
}
|
||||
return self;
|
||||
|
||||
Vendored
+1
-1
@@ -54,7 +54,7 @@
|
||||
[self.basicDriver resumeUpdate:resumableUpdate completion:completionBlock];
|
||||
}
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)__unused appcastItem preventsAutoupdate:(BOOL)__unused preventsAutoupdate systemDomain:(NSNumber * _Nullable)__unused systemDomain
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)__unused appcastItem secondaryAppcastItem:(SUAppcastItem *)__unused secondaryAppcastItem preventsAutoupdate:(BOOL)__unused preventsAutoupdate systemDomain:(NSNumber * _Nullable)__unused systemDomain
|
||||
{
|
||||
// Stop as soon as we have an answer
|
||||
[self abortUpdate];
|
||||
|
||||
Vendored
+1
@@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol SPUResumableUpdate <NSObject>
|
||||
|
||||
@property (nonatomic, readonly) SUAppcastItem *updateItem;
|
||||
@property (nonatomic, readonly, nullable) SUAppcastItem *secondaryUpdateItem;
|
||||
@property (nonatomic, readonly) BOOL preventsAutoupdate;
|
||||
|
||||
@end
|
||||
|
||||
Vendored
+3
-3
@@ -105,7 +105,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem preventsAutoupdate:(BOOL)preventsAutoupdate
|
||||
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate
|
||||
{
|
||||
id <SPUUpdaterDelegate> updaterDelegate = self.updaterDelegate;
|
||||
if ([self.userDriver respondsToSelector:@selector(showUpdateFoundWithAppcastItem:userInitiated:state:reply:)]) {
|
||||
@@ -143,7 +143,7 @@
|
||||
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:!self.preventsInstallerInteraction];
|
||||
break;
|
||||
case SPUUserUpdateStateNotDownloaded:
|
||||
[self.coreDriver downloadUpdateFromAppcastItem:updateItem inBackground:NO];
|
||||
[self.coreDriver downloadUpdateFromAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem inBackground:NO];
|
||||
break;
|
||||
case SPUUserUpdateStateInformational:
|
||||
assert(false);
|
||||
@@ -235,7 +235,7 @@
|
||||
[self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey];
|
||||
switch (choice) {
|
||||
case SPUInstallUpdateChoice:
|
||||
[self.coreDriver downloadUpdateFromAppcastItem:updateItem inBackground:NO];
|
||||
[self.coreDriver downloadUpdateFromAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem inBackground:NO];
|
||||
break;
|
||||
case SPUSkipThisVersionChoice:
|
||||
[self.host setObject:[updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey];
|
||||
|
||||
Vendored
+1
-3
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)didFailToFetchAppcastWithError:(NSError *)error;
|
||||
- (void)didFinishLoadingAppcast:(SUAppcast *)appcast;
|
||||
- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)appcastItem preventsAutoupdate:(BOOL)preventsAutoupdate;
|
||||
- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)appcastItem secondaryAppcastItem:(SUAppcastItem *)secondaryAppcastItem preventsAutoupdate:(BOOL)preventsAutoupdate;
|
||||
- (void)didNotFindUpdateWithLatestAppcastItem:(nullable SUAppcastItem *)latestAppcastItem hostToLatestAppcastItemComparisonResult:(NSComparisonResult)hostToLatestAppcastItemComparisonResult;
|
||||
|
||||
@end
|
||||
@@ -28,8 +28,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)loadAppcastFromURL:(NSURL *)appcastURL userAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background includesSkippedUpdates:(BOOL)includesSkippedUpdates;
|
||||
|
||||
@property (nullable, nonatomic, readonly) SUAppcastItem *secondaryUpdateItem;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Vendored
+1
-4
@@ -27,7 +27,6 @@
|
||||
@property (nonatomic, copy) NSString *userAgent;
|
||||
@property (nullable, nonatomic, readonly, weak) id updater;
|
||||
@property (nullable, nonatomic, readonly, weak) id <SPUUpdaterDelegate> updaterDelegate;
|
||||
@property (nullable, nonatomic) SUAppcastItem *secondaryUpdateItem;
|
||||
@property (nullable, nonatomic, readonly, weak) id <SUAppcastDriverDelegate> delegate;
|
||||
|
||||
@end
|
||||
@@ -38,7 +37,6 @@
|
||||
@synthesize userAgent = _userAgent;
|
||||
@synthesize updater = _updater;
|
||||
@synthesize updaterDelegate = _updaterDelegate;
|
||||
@synthesize secondaryUpdateItem = _secondaryUpdateItem;
|
||||
@synthesize delegate = _delegate;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host updater:(id)updater updaterDelegate:(id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SUAppcastDriverDelegate>)delegate
|
||||
@@ -124,8 +122,7 @@
|
||||
}
|
||||
|
||||
if ([self itemContainsValidUpdate:item inBackground:background includesSkippedUpdates:includesSkippedUpdates]) {
|
||||
self.secondaryUpdateItem = secondaryItem;
|
||||
[self.delegate didFindValidUpdateWithAppcastItem:item preventsAutoupdate:[self itemPreventsAutoupdate:item]];
|
||||
[self.delegate didFindValidUpdateWithAppcastItem:item secondaryAppcastItem:secondaryItem preventsAutoupdate:[self itemPreventsAutoupdate:item]];
|
||||
} else {
|
||||
NSComparisonResult hostToLatestAppcastItemComparisonResult = (item != nil) ? [[self versionComparator] compareVersion:[self.host version] toVersion:[item versionString]] : 0;
|
||||
[self.delegate didNotFindUpdateWithLatestAppcastItem:item hostToLatestAppcastItemComparisonResult:hostToLatestAppcastItemComparisonResult];
|
||||
|
||||
Reference in new issue
Block a user