diff --git a/Sparkle/SPUStatusCompletionResults.h b/Sparkle/SPUStatusCompletionResults.h index 38d5a6a4..98328381 100644 --- a/Sparkle/SPUStatusCompletionResults.h +++ b/Sparkle/SPUStatusCompletionResults.h @@ -19,12 +19,12 @@ #endif typedef NS_ENUM(NSUInteger, SPUUserInitiatedCheckStatus) { - SPUUserInitiatedCheckDone, + SPUUserInitiatedCheckDone __deprecated_msg("Deprecated because SPUUserInitiatedCheckDone has no effect. Just don't reply with this status."), SPUUserInitiatedCheckCanceled }; typedef NS_ENUM(NSUInteger, SPUDownloadUpdateStatus) { - SPUDownloadUpdateDone, + SPUDownloadUpdateDone __deprecated_msg("Deprecated because SPUDownloadUpdateDone has no effect. Just don't reply with this status."), SPUDownloadUpdateCanceled }; diff --git a/Sparkle/SPUUIBasedUpdateDriver.m b/Sparkle/SPUUIBasedUpdateDriver.m index 989d3611..9fd4eafc 100644 --- a/Sparkle/SPUUIBasedUpdateDriver.m +++ b/Sparkle/SPUUIBasedUpdateDriver.m @@ -203,7 +203,11 @@ { [self.userDriver showDownloadInitiatedWithCompletion:^(SPUDownloadUpdateStatus downloadCompletionStatus) { switch (downloadCompletionStatus) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" case SPUDownloadUpdateDone: + // Note this status is documented to have no effect +#pragma clang diagnostic pop break; case SPUDownloadUpdateCanceled: dispatch_async(dispatch_get_main_queue(), ^{ diff --git a/Sparkle/SPUUserDriver.h b/Sparkle/SPUUserDriver.h index 31c6e7e3..a3ae4f63 100644 --- a/Sparkle/SPUUserDriver.h +++ b/Sparkle/SPUUserDriver.h @@ -28,18 +28,7 @@ NS_ASSUME_NONNULL_BEGIN This protocol is used for implementing a user interface for the Sparkle updater. Sparkle's internal drivers tell an object that implements this protocol what actions to take and show to the user. - Every method in this protocol is required (i.e, not optional) and has a void return type and can optionally take a single parameter block, which waits for - a response back from the user driver. Note that every parameter block, or reply, *must* be responded to eventually - - that is, none can be ignored. Furthermore, they can only be replied to *once* - a reply or completion block should be considered - invalidated after it's once used. The faster a reply can be made, the more Sparkle may be able to idle, and so the better. Every method in this protocol can be assumed to be called from the main thread. - - It may be possible for an action that says to invalidate or dismiss something to be called multiple times in succession, and the implementor may choose to ignore further requests. (TODO: This should be verified if this actually can happen in practice). - - Note: Once upon a time, when first developing the user driver API, I had the user driver exist in a separate process from the rest of the framework (this is no longer supported). - If you're familiar with how the higher level XPC APIs work, this explains why some of the decisions above were made - (reply block executed on any thread, reply block replied only once, single reply block, void return types, idleness, no optional methods, ...) - This is somewhat of an artifact now, but I think most of these set of restrictions still enforces a well designed API. */ SU_EXPORT @protocol SPUUserDriver @@ -66,9 +55,8 @@ SU_EXPORT @protocol SPUUserDriver * * Respond to the user initiating an update check. Sparkle uses this to show the user a window with an indeterminate progress bar. * - * @param updateCheckStatusCompletion A reply indicating whether the initiated update check is done or canceled. - * Attempts to canceling can be made before -dismissUserInitiatedUpdateCheck is invoked. Replying with SPUUserInitiatedCheckDone - * on the other hand should not be done until -dismissUserInitiatedUpdateCheck is invoked. + * @param updateCheckStatusCompletion A reply that can be used to cancel the update check with SPUUserInitiatedCheckCanceled. + * Attempts to canceling can be made before -dismissUserInitiatedUpdateCheck is invoked. */ - (void)showUserInitiatedUpdateCheckWithCompletion:(void (^)(SPUUserInitiatedCheckStatus))updateCheckStatusCompletion; @@ -76,7 +64,6 @@ SU_EXPORT @protocol SPUUserDriver * Dismiss the user initiated update check from the user * * Dismiss whatever was started in -showUserInitiatedUpdateCheckWithCompletion: - * This is an appropriate time to reply with SPUUserInitiatedCheckDone if not having done so already */ - (void)dismissUserInitiatedUpdateCheck; @@ -194,8 +181,6 @@ SU_EXPORT @protocol SPUUserDriver * * @param downloadUpdateStatusCompletion A reply of SPUDownloadUpdateCanceled can be used to cancel * the download at any point before -showDownloadDidStartExtractingUpdate is invoked. - * A reply of SPUDownloadUpdateDone signifies that the download is done, which should not be invoked until - * -showDownloadDidStartExtractingUpdate */ - (void)showDownloadInitiatedWithCompletion:(void (^)(SPUDownloadUpdateStatus))downloadUpdateStatusCompletion; @@ -219,7 +204,6 @@ SU_EXPORT @protocol SPUUserDriver /*! * Show the user that the update finished downloading and started extracting * - * This is an appropriate time to reply with SPUDownloadUpdateDone if not done so already * Sparkle uses this to show an indeterminate progress bar. * * Note that an update can resume at this point after having been downloaded before, diff --git a/Sparkle/SPUUserDriverCoreComponent.m b/Sparkle/SPUUserDriverCoreComponent.m index b9f8db91..b1042077 100644 --- a/Sparkle/SPUUserDriverCoreComponent.m +++ b/Sparkle/SPUUserDriverCoreComponent.m @@ -67,10 +67,7 @@ - (void)completeUpdateCheckStatus { - if (self.updateCheckStatusCompletion != nil) { - self.updateCheckStatusCompletion(SPUUserInitiatedCheckDone); - self.updateCheckStatusCompletion = nil; - } + self.updateCheckStatusCompletion = nil; } #pragma mark Download Status @@ -90,10 +87,7 @@ - (void)completeDownloadStatus { - if (self.downloadStatusCompletion != nil) { - self.downloadStatusCompletion(SPUDownloadUpdateDone); - self.downloadStatusCompletion = nil; - } + self.downloadStatusCompletion = nil; } #pragma mark Simple Acknoledgments diff --git a/Sparkle/SPUUserInitiatedUpdateDriver.m b/Sparkle/SPUUserInitiatedUpdateDriver.m index dd1b0064..3c5cc1b6 100644 --- a/Sparkle/SPUUserInitiatedUpdateDriver.m +++ b/Sparkle/SPUUserInitiatedUpdateDriver.m @@ -52,7 +52,11 @@ [self.userDriver showUserInitiatedUpdateCheckWithCompletion:^(SPUUserInitiatedCheckStatus completionStatus) { switch (completionStatus) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" case SPUUserInitiatedCheckDone: + // Note this status is documented to have no effect +#pragma clang diagnostic pop break; case SPUUserInitiatedCheckCanceled: dispatch_async(dispatch_get_main_queue(), ^{