mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-26 04:57:54 +00:00
Create alert using NSError for update not found error
This commit is contained in:
1 parent
2b9a02c825
commit
a9254d1e02
4 files changed
+11
-9
No files matched your search
Vendored
+2
-1
@@ -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];
|
||||
|
||||
Vendored
+4
-5
@@ -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];
|
||||
|
||||
Vendored
+1
-1
@@ -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();
|
||||
});
|
||||
|
||||
Vendored
+4
-2
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user