Create alert using NSError for update not found error

This commit is contained in:
Zorg committed 2021-02-06 23:00:44 -08:00
1 parent 2b9a02c825
commit a9254d1e02
4 files changed
+11 -9

No files matched your search

+2 -1
View File
@@ -169,7 +169,8 @@
errorWithDomain:SUSparkleErrorDomain
code:SUNoUpdateError
userInfo:@{
NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"You already have the newest version of %@.", "'Error' message when the user checks for updates but is already current or the feed doesn't contain any updates. (not necessarily shown in UI)"), self.host.name]
NSLocalizedDescriptionKey: SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates."),
NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]]
}
];
[self.delegate basicDriverIsRequestingAbortUpdateWithError:notFoundError];
+4 -5
View File
@@ -272,16 +272,15 @@
[self.coreComponent acceptAcknowledgement];
}
- (void)showUpdateNotFoundWithAcknowledgement:(void (^)(void))acknowledgement
//- (void)showUpdateNotFoundWithAcknowledgement:(void (^)(void))acknowledgement
- (void)showUpdateNotFoundWithError:(NSError *)error acknowledgement:(void (^)(void))acknowledgement
{
assert(NSThread.isMainThread);
[self.coreComponent registerAcknowledgement:acknowledgement];
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
alert.informativeText = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
[alert addButtonWithTitle:SULocalizedString(@"OK", nil)];
NSAlert *alert = [NSAlert alertWithError:error];
alert.alertStyle = NSAlertStyleInformational;
[self showAlert:alert];
[self.coreComponent acceptAcknowledgement];
+1 -1
View File
@@ -274,7 +274,7 @@
NSError *nonNullError = error;
if (error.code == SUNoUpdateError) {
[self.userDriver showUpdateNotFoundWithAcknowledgement:^{
[self.userDriver showUpdateNotFoundWithError:(NSError * _Nonnull)error acknowledgement:^{
dispatch_async(dispatch_get_main_queue(), ^{
abortUpdate();
});
+4 -2
View File
@@ -171,9 +171,10 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
*
* Let the user know a new update was not found after they tried initiating an update check.
*
* @param acknowledgement Acknowledge to the updater that no update found was shown.
* @param error The error associated with why a new update was not found.
* @param acknowledgement Acknowledge to the updater that no update found error was shown.
*/
- (void)showUpdateNotFoundWithAcknowledgement:(void (^)(void))acknowledgement;
- (void)showUpdateNotFoundWithError:(NSError *)error acknowledgement:(void (^)(void))acknowledgement;
/*!
* Show the user an update error occurred
@@ -181,6 +182,7 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
* Let the user know that the updater failed with an error. This will not be invoked without the user having been
* aware that an update was in progress.
*
* @param error The error associated with what update error occurred..
* @param acknowledgement Acknowledge to the updater that the error was shown.
*/
- (void)showUpdaterError:(NSError *)error acknowledgement:(void (^)(void))acknowledgement;