Update documentation for -bestValidUpdateInAppcast:forUpdater:

This method will not be invoked for appcast with zero items. Clients must pick best item and cannot pick "no items."
This commit is contained in:
Zorg committed 2021-05-02 23:09:45 -07:00
1 parent 5a3b71b96a
commit 3d2dc8a7f6
2 files changed
+6 -1

No files matched your search

+4
View File
@@ -172,6 +172,10 @@ typedef NS_ENUM(NSInteger, SPUUpdateCheck)
Also do not return a non-top level item from the appcast such as a delta item. Delta items will be ignored.
Sparkle picks the delta item from your selection if the appropriate one is available.
This method will not be invoked with an appcast that has zero items. Pick the best item from the appcast.
If an item is available that has the same version as the application or bundle to update,
do not pick an item that is worse than that version.
This method may be called multiple times for different selections and filters. This method should be efficient.
\param appcast The appcast that was downloaded from the remote server.
+2 -1
View File
@@ -120,8 +120,9 @@
- (SUAppcastItem *)retrieveBestAppcastItemFromAppcast:(SUAppcast *)appcast versionComparator:(id<SUVersionComparison>)versionComparator secondaryUpdate:(SUAppcastItem * __autoreleasing _Nullable *)secondaryAppcastItem
{
// Find the best valid update in the appcast by asking the delegate
// Don't ask the delegate if the appcast has no items though
SUAppcastItem *regularItemFromDelegate;
if ([self.updaterDelegate respondsToSelector:@selector((bestValidUpdateInAppcast:forUpdater:))]) {
if (appcast.items.count > 0 && [self.updaterDelegate respondsToSelector:@selector((bestValidUpdateInAppcast:forUpdater:))]) {
SUAppcastItem *candidateItem = [self.updaterDelegate bestValidUpdateInAppcast:appcast forUpdater:(id _Nonnull)self.updater];
assert(!candidateItem.deltaUpdate);