Add fallback to legacy showUpdateNotFoundWithAcknowledgement method

This commit is contained in:
Zorg committed 2021-02-06 23:46:06 -08:00
1 parent c5def52133
commit 13a36cb904
2 files changed
+21 -5

No files matched your search

+17 -5
View File
@@ -274,11 +274,23 @@
NSError *nonNullError = error;
if (error.code == SUNoUpdateError) {
[self.userDriver showUpdateNotFoundWithError:(NSError * _Nonnull)error acknowledgement:^{
dispatch_async(dispatch_get_main_queue(), ^{
abortUpdate();
});
}];
if ([self.userDriver respondsToSelector:@selector(showUpdateNotFoundWithError:acknowledgement:)]) {
[self.userDriver showUpdateNotFoundWithError:(NSError * _Nonnull)error acknowledgement:^{
dispatch_async(dispatch_get_main_queue(), ^{
abortUpdate();
});
}];
} else if ([self.userDriver respondsToSelector:@selector(showUpdateNotFoundWithAcknowledgement:)]) {
// Eventually we should remove this fallback once clients adopt -showUpdateNotFoundWithError:acknowledgement:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self.userDriver showUpdateNotFoundWithAcknowledgement:^{
#pragma clang diagnostic pop
dispatch_async(dispatch_get_main_queue(), ^{
abortUpdate();
});
}];
}
} else if (error.code == SUInstallationCanceledError || error.code == SUInstallationAuthorizeLaterError) {
abortUpdate();
} else {
+4
View File
@@ -289,6 +289,10 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
*/
- (void)dismissUpdateInstallation;
@optional
- (void)showUpdateNotFoundWithAcknowledgement:(void (^)(void))acknowledgement __deprecated_msg("Implement -showUpdateNotFoundWithError:acknowledgement: instead");
@end
NS_ASSUME_NONNULL_END