Merge branch '2.x' into appcast-item-nullability

This commit is contained in:
Zorg committed 2021-05-02 11:29:39 -07:00
commit d84a79cfc2
9 files changed
+60 -25

No files matched your search

+4
View File
@@ -437,6 +437,10 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
});
}
});
} else if (identifier == SPUCancelInstallation) {
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:0 error:nil];
});
} else if (identifier == SPUUpdaterAlivePong) {
self.receivedUpdaterPong = YES;
}
+2 -1
View File
@@ -31,7 +31,8 @@ typedef NS_ENUM(int32_t, SPUUpdaterMessageType)
SPUInstallationData = 0,
SPUSentUpdateAppcastItemData = 1,
SPUResumeInstallationToStage2 = 2,
SPUUpdaterAlivePong = 3
SPUUpdaterAlivePong = 3,
SPUCancelInstallation = 4
};
BOOL SPUInstallerMessageTypeIsLegal(SPUInstallerMessageType oldMessageType, SPUInstallerMessageType newMessageType);
+3 -1
View File
@@ -331,9 +331,11 @@
{
switch (response) {
case SPUUserUpdateChoiceDismiss:
case SPUUserUpdateChoiceSkip:
[self.delegate coreDriverIsRequestingAbortUpdateWithError:nil];
break;
case SPUUserUpdateChoiceSkip:
[self.installerDriver cancelUpdate];
break;
case SPUUserUpdateChoiceInstall:
[self.installerDriver installWithToolAndRelaunch:YES displayingUserInterface:displayingUserInterface];
break;
+2
View File
@@ -40,6 +40,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI;
- (void)cancelUpdate;
- (void)abortInstall;
@end
+13 -2
View File
@@ -141,8 +141,6 @@
assert(installationType != nil);
[self.installerConnection setServiceName:serviceName systemDomain:self.systemDomain];
[self sendInstallationData];
}
// This can be called multiple times (eg: if a delta update fails, this may be called again with a regular update item)
@@ -482,6 +480,7 @@
case SUInstallerLauncherSuccess:
self.systemDomain = systemDomain;
[self setUpConnection];
[self sendInstallationData];
completionHandler(nil);
break;
}
@@ -534,6 +533,18 @@
// the installer will send us SPUInstallationFinishedStage2 when stage 2 is done
}
- (void)cancelUpdate
{
// Set up connection to the installer if one is not set up already
[self setUpConnection];
self.aborted = YES;
[self.installerConnection handleMessageWithIdentifier:SPUCancelInstallation data:[NSData data]];
[self.delegate installerIsRequestingAbortInstallWithError:nil];
}
- (void)abortInstall
{
self.aborted = YES;
+30 -14
View File
@@ -179,14 +179,14 @@
// Rule out invalid choices
SPUUserUpdateChoice validatedChoice;
if ((state == SPUUserUpdateStateInstalling && userChoice == SPUUserUpdateChoiceSkip) || (state == SPUUserUpdateStateInformational && userChoice == SPUUserUpdateChoiceInstall)) {
if (state == SPUUserUpdateStateInformational && userChoice == SPUUserUpdateChoiceInstall) {
validatedChoice = SPUUserUpdateChoiceDismiss;
} else {
validatedChoice = userChoice;
}
switch (validatedChoice) {
case SPUUserUpdateChoiceInstall:
case SPUUserUpdateChoiceInstall: {
[self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey];
switch (state) {
@@ -204,29 +204,26 @@
break;
}
break;
case SPUUserUpdateChoiceSkip:
}
case SPUUserUpdateChoiceSkip: {
[self.host setObject:[updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey];
if ([self.updaterDelegate respondsToSelector:@selector(updater:userDidSkipThisVersion:)]) {
[self.updaterDelegate updater:self.updater userDidSkipThisVersion:updateItem];
}
// Informational updates can be resumed too, so make sure we check
// self.resumingDownloadedUpdate instead of the state we pass to user driver
if (self.resumingDownloadedUpdate) {
[self.coreDriver clearDownloadedUpdate];
}
[self.delegate uiDriverIsRequestingAbortUpdateWithError:nil];
break;
case SPUUserUpdateChoiceDismiss:
switch (state) {
case SPUUserUpdateStateDownloaded:
case SPUUserUpdateStateNotDownloaded:
case SPUUserUpdateStateInformational:
[self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey];
// Informational updates can be resumed too, so make sure we check
// self.resumingDownloadedUpdate instead of the state we pass to user driver
if (self.resumingDownloadedUpdate) {
[self.coreDriver clearDownloadedUpdate];
}
[self.delegate uiDriverIsRequestingAbortUpdateWithError:nil];
break;
case SPUUserUpdateStateInstalling:
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:!self.preventsInstallerInteraction];
@@ -234,6 +231,25 @@
}
break;
}
case SPUUserUpdateChoiceDismiss: {
[self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey];
switch (state) {
case SPUUserUpdateStateDownloaded:
case SPUUserUpdateStateNotDownloaded:
case SPUUserUpdateStateInformational: {
[self.delegate uiDriverIsRequestingAbortUpdateWithError:nil];
break;
}
case SPUUserUpdateStateInstalling: {
[self.coreDriver finishInstallationWithResponse:validatedChoice displayingUserInterface:!self.preventsInstallerInteraction];
break;
}
}
break;
}
}
});
}];
+3
View File
@@ -423,6 +423,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
if (self.sessionInProgress) {
SULog(SULogLevelError, @"Error: -checkForUpdatesInBackground called but .sessionInProgress == YES");
return;
}
self.sessionInProgress = YES;
@@ -488,6 +489,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
if (self.sessionInProgress) {
SULog(SULogLevelError, @"Error: -checkForUpdates called but .sessionInProgress == YES");
return;
}
if (self.driver != nil) {
@@ -529,6 +531,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
if (self.sessionInProgress) {
SULog(SULogLevelError, @"Error: -checkForUpdateInformation called but .sessionInProgress == YES");
return;
}
self.sessionInProgress = YES;
+3 -4
View File
@@ -79,7 +79,7 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
* If the state is SPUUserUpdateStateInstalling, the installing update is also preserved after dismissing. In this state however, the update will also still be installed after the application is terminated.
*
* A reply of SPUUserUpdateChoiceSkip skips this particular version and won't notify the user again, unless they initiate an update check themselves.
* If the state is SPUUserUpdateStateInstalling, the update cannot be skipped, only dismissed or installed.
* If the state is SPUUserUpdateStateInstalling, the installation is also canceled when the update is skipped.
*/
- (void)showUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)userInitiated state:(SPUUserUpdateState)state reply:(void (^)(SPUUserUpdateChoice))reply;
@@ -194,10 +194,9 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
* @param reply
* A reply of SPUUserUpdateChoiceInstall installs the update the new update immediately. The application is relaunched only if it is still running by the time this reply is invoked. If the application terminates on its own, Sparkle will attempt to automatically install the update.
*
* A reply of SPUUserUpdateChoiceDismiss dismisses the update installation for the time being. Note the update may still be installed automatically after
* the application terminates.
* A reply of SPUUserUpdateChoiceDismiss dismisses the update installation for the time being. Note the update may still be installed automatically after the application terminates.
*
* A reply of SPUUserUpdateChoiceSkip acts the same as dismissing. This update which has started installing cannot be skipped.
* A reply of SPUUserUpdateChoiceSkip cancels the current update that has begun installing and dismisses the update. In this circumstance, the update is canceled but this update version is not skipped in the future.
*
* Before this point, -showInstallingUpdate will be called.
*/
-3
View File
@@ -363,9 +363,6 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
}
if (self.state == SPUUserUpdateStateInstalling) {
// An already downloaded & resumable update can't be skipped
self.skipButton.hidden = YES;
// We're going to be relaunching pretty instantaneously
self.installButton.title = SULocalizedString(@"Install and Relaunch", nil);