From 544c6424834c8ec1f4929a7b7e7b42d8d70a5423 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 6 Oct 2024 21:30:07 -0700 Subject: [PATCH] Deprecate custom version comparators (#2639) --- Sparkle/SPUUpdaterDelegate.h | 2 +- Sparkle/SUAppcastDriver.m | 3 +++ Sparkle/SUUpdater.m | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Sparkle/SPUUpdaterDelegate.h b/Sparkle/SPUUpdaterDelegate.h index 84af936352..e3bb0874c6 100644 --- a/Sparkle/SPUUpdaterDelegate.h +++ b/Sparkle/SPUUpdaterDelegate.h @@ -386,7 +386,7 @@ SU_EXPORT extern NSString *const SUSystemProfilerPreferredLanguageKey; @param updater The updater instance. @return The custom version comparator or @c nil if you don't want to be delegated this task. */ -- (nullable id)versionComparatorForUpdater:(SPUUpdater *)updater; +- (nullable id)versionComparatorForUpdater:(SPUUpdater *)updater __deprecated_msg("Custom version comparators are deprecated because they are incompatible with how the system compares different versions of an app."); /** Called when a background update will be scheduled after a delay. diff --git a/Sparkle/SUAppcastDriver.m b/Sparkle/SUAppcastDriver.m index 22885e2306..9faea12b44 100644 --- a/Sparkle/SUAppcastDriver.m +++ b/Sparkle/SUAppcastDriver.m @@ -429,11 +429,14 @@ + (SUAppcastItem *)bestItemFromAppcastItems:(NSArray *)appcastItems getDeltaItem { id comparator = nil; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" // Give the delegate a chance to provide a custom version comparator id updaterDelegate = _updaterDelegate; if ([updaterDelegate respondsToSelector:@selector((versionComparatorForUpdater:))]) { comparator = [updaterDelegate versionComparatorForUpdater:_updater]; } +#pragma clang diagnostic pop // If we don't get a comparator from the delegate, use the default comparator if (comparator == nil) { diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index b151c052c5..62ee37a565 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -460,6 +460,8 @@ - (void)updaterWillRelaunchApplication:(SPUUpdater *)__unused updater } } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" - (id)versionComparatorForUpdater:(SPUUpdater *)__unused updater { id versionComparator; @@ -468,6 +470,7 @@ - (void)updaterWillRelaunchApplication:(SPUUpdater *)__unused updater } return versionComparator; } +#pragma clang diagnostic pop // Private SPUUpdater API that allows us to defer providing an application path to relaunch - (NSString * _Nullable)_pathToRelaunchForUpdater:(SPUUpdater *)__unused updater