mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-27 05:04:27 +00:00
Merge showUpdateFount: methods into single one
Handling the different variations with different completion blocks is a pain when ultimately clients want to display a mostly unified user interface.
This commit is contained in:
1 parent
2d0b9ae356
commit
e64253be0b
13 files changed
+285
-340
No files matched your search
@@ -105,39 +105,34 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)__unused userInitiated reply:(void (^)(SPUUpdateAlertChoice))reply
|
||||
- (void)showUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)userInitiated state:(SPUUserUpdateState)state reply:(void (^)(SPUUserUpdateChoice))reply
|
||||
{
|
||||
[self showUpdateWithAppcastItem:appcastItem updateAdjective:@"new"];
|
||||
reply(SPUInstallUpdateChoice);
|
||||
}
|
||||
|
||||
- (void)showDownloadedUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)__unused userInitiated reply:(void (^)(SPUUpdateAlertChoice))reply
|
||||
{
|
||||
[self showUpdateWithAppcastItem:appcastItem updateAdjective:@"downloaded"];
|
||||
reply(SPUInstallUpdateChoice);
|
||||
}
|
||||
|
||||
- (void)showResumableUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)__unused userInitiated reply:(void (^)(SPUInstallUpdateStatus))reply
|
||||
{
|
||||
[self showUpdateWithAppcastItem:appcastItem updateAdjective:@"resumable"];
|
||||
|
||||
if (self.deferInstallation) {
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "Deferring Installation.\n");
|
||||
}
|
||||
reply(SPUDismissUpdateInstallation);
|
||||
} else {
|
||||
reply(SPUInstallAndRelaunchUpdateNow);
|
||||
switch (state) {
|
||||
case SPUUserUpdateStateNotDownloaded:
|
||||
[self showUpdateWithAppcastItem:appcastItem updateAdjective:@"new"];
|
||||
reply(SPUUserUpdateChoiceInstall);
|
||||
break;
|
||||
case SPUUserUpdateStateDownloaded:
|
||||
[self showUpdateWithAppcastItem:appcastItem updateAdjective:@"downloaded"];
|
||||
reply(SPUUserUpdateChoiceInstall);
|
||||
break;
|
||||
case SPUUserUpdateStateInstalling:
|
||||
if (self.deferInstallation) {
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "Deferring Installation.\n");
|
||||
}
|
||||
reply(SPUUserUpdateChoiceDismiss);
|
||||
} else {
|
||||
reply(SPUUserUpdateChoiceInstall);
|
||||
}
|
||||
break;
|
||||
case SPUUserUpdateStateInformational:
|
||||
fprintf(stderr, "Found information for new update: %s\n", appcastItem.infoURL.absoluteString.UTF8String);
|
||||
reply(SPUUserUpdateChoiceDismiss);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showInformationalUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)__unused userInitiated reply:(void (^)(SPUInformationalUpdateAlertChoice))reply
|
||||
{
|
||||
fprintf(stderr, "Found information for new update: %s\n", appcastItem.infoURL.absoluteString.UTF8String);
|
||||
|
||||
reply(SPUDismissInformationalNoticeChoice);
|
||||
}
|
||||
|
||||
- (void)showUpdateReleaseNotesWithDownloadData:(SPUDownloadData *)downloadData
|
||||
{
|
||||
if (self.verbose) {
|
||||
@@ -225,15 +220,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showReadyToInstallAndRelaunch:(void (^)(SPUInstallUpdateStatus))installUpdateHandler
|
||||
- (void)showReadyToInstallAndRelaunch:(void (^)(SPUUserUpdateChoice))installUpdateHandler
|
||||
{
|
||||
if (self.deferInstallation) {
|
||||
if (self.verbose) {
|
||||
fprintf(stderr, "Deferring Installation.\n");
|
||||
}
|
||||
installUpdateHandler(SPUDismissUpdateInstallation);
|
||||
installUpdateHandler(SPUUserUpdateChoiceDismiss);
|
||||
} else {
|
||||
installUpdateHandler(SPUInstallAndRelaunchUpdateNow);
|
||||
installUpdateHandler(SPUUserUpdateChoiceInstall);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user