Pass majorUpdate information to user driver

We unify the user driver method showing the update to take a generic state object now. The current fields of the state object are its current stage, if it's user initiated, and if the update is a major one.

We also remove deprecated code paths that were complex to support and will otherwise generate in compile errors if people adopt the new API.
This commit is contained in:
Zorg committed 2021-05-09 22:42:42 -07:00
1 parent a79f6b2a85
commit d193f2e28b
16 files changed
+246 -326

No files matched your search

+6 -6
View File
@@ -97,18 +97,18 @@
}
}
- (void)showUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)userInitiated state:(SPUUserUpdateState)state reply:(void (^)(SPUUserUpdateChoice))reply
- (void)showUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)userInitiated state:(SPUUserUpdateState *)state reply:(void (^)(SPUUserUpdateChoice))reply
{
switch (state) {
case SPUUserUpdateStateNotDownloaded:
switch (state.stage) {
case SPUUserUpdateStageNotDownloaded:
[self showUpdateWithAppcastItem:appcastItem updateAdjective:@"new"];
reply(SPUUserUpdateChoiceInstall);
break;
case SPUUserUpdateStateDownloaded:
case SPUUserUpdateStageDownloaded:
[self showUpdateWithAppcastItem:appcastItem updateAdjective:@"downloaded"];
reply(SPUUserUpdateChoiceInstall);
break;
case SPUUserUpdateStateInstalling:
case SPUUserUpdateStageInstalling:
if (self.deferInstallation) {
if (self.verbose) {
fprintf(stderr, "Deferring Installation.\n");
@@ -118,7 +118,7 @@
reply(SPUUserUpdateChoiceInstall);
}
break;
case SPUUserUpdateStateInformational:
case SPUUserUpdateStageInformational:
fprintf(stderr, "Found information for new update: %s\n", appcastItem.infoURL.absoluteString.UTF8String);
reply(SPUUserUpdateChoiceDismiss);
break;