Skip to content

Commit

Permalink
Deprecate custom version comparators (#2639)
Browse files Browse the repository at this point in the history
  • Loading branch information
zorgiepoo authored Oct 7, 2024
1 parent ad3c8b5 commit 544c642
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sparkle/SPUUpdaterDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<SUVersionComparison>)versionComparatorForUpdater:(SPUUpdater *)updater;
- (nullable id<SUVersionComparison>)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.
Expand Down
3 changes: 3 additions & 0 deletions Sparkle/SUAppcastDriver.m
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,14 @@ + (SUAppcastItem *)bestItemFromAppcastItems:(NSArray *)appcastItems getDeltaItem
{
id<SUVersionComparison> comparator = nil;

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// Give the delegate a chance to provide a custom version comparator
id<SPUUpdaterDelegate> 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) {
Expand Down
3 changes: 3 additions & 0 deletions Sparkle/SUUpdater.m
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,8 @@ - (void)updaterWillRelaunchApplication:(SPUUpdater *)__unused updater
}
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
- (id<SUVersionComparison>)versionComparatorForUpdater:(SPUUpdater *)__unused updater
{
id<SUVersionComparison> versionComparator;
Expand All @@ -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
Expand Down

0 comments on commit 544c642

Please sign in to comment.