mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-26 04:57:54 +00:00
Allow delegate methods that return an object to return nil
Returning nil from these delegate methods is equivalent to not implementing the delegate method. The caller should be able to make this kind of decision when implementing an optional delegate method.
This commit is contained in:
1 parent
578e78876c
commit
796967cf24
2 files changed
+16
-5
No files matched your search
Vendored
+10
-3
@@ -162,11 +162,15 @@
|
||||
if ([[self.updater delegate] respondsToSelector:@selector(bestValidUpdateInAppcast:forUpdater:)]) // Does the delegate want to handle it?
|
||||
{
|
||||
item = [[self.updater delegate] bestValidUpdateInAppcast:ac forUpdater:(id)self.updater];
|
||||
}
|
||||
|
||||
if (item != nil) // Does the delegate want to handle it?
|
||||
{
|
||||
if ([item isDeltaUpdate]) {
|
||||
self.nonDeltaUpdateItem = [[self.updater delegate] bestValidUpdateInAppcast:[ac copyWithoutDeltaUpdates] forUpdater:(id)self.updater];
|
||||
}
|
||||
}
|
||||
else // If not, we'll take care of it ourselves.
|
||||
}
|
||||
else // If not, we'll take care of it ourselves.
|
||||
{
|
||||
// Find the best supported update
|
||||
SUAppcastItem *deltaUpdateItem = nil;
|
||||
@@ -525,7 +529,10 @@
|
||||
|
||||
NSString *pathToRelaunch = [self.host bundlePath];
|
||||
if ([updaterDelegate respondsToSelector:@selector(pathToRelaunchForUpdater:)]) {
|
||||
pathToRelaunch = [updaterDelegate pathToRelaunchForUpdater:(id)self.updater];
|
||||
NSString *delegateRelaunchPath = [updaterDelegate pathToRelaunchForUpdater:(id)self.updater];
|
||||
if (delegateRelaunchPath != nil) {
|
||||
pathToRelaunch = delegateRelaunchPath;
|
||||
}
|
||||
}
|
||||
|
||||
[NSTask launchedTaskWithLaunchPath:relaunchToolPath arguments:@[[self.host bundlePath],
|
||||
|
||||
Vendored
+6
-2
@@ -435,8 +435,12 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
|
||||
// A value in the user defaults overrides one in the Info.plist (so preferences panels can be created wherein users choose between beta / release feeds).
|
||||
NSString *appcastString = [self.host objectForKey:SUFeedURLKey];
|
||||
if ([self.delegate respondsToSelector:@selector(feedURLStringForUpdater:)])
|
||||
appcastString = [self.delegate feedURLStringForUpdater:self];
|
||||
if ([self.delegate respondsToSelector:@selector(feedURLStringForUpdater:)]) {
|
||||
NSString *delegateAppcastString = [self.delegate feedURLStringForUpdater:self];
|
||||
if (delegateAppcastString != nil) {
|
||||
appcastString = delegateAppcastString;
|
||||
}
|
||||
}
|
||||
if (!appcastString) // Can't find an appcast string!
|
||||
[NSException raise:@"SUNoFeedURL" format:@"You must specify the URL of the appcast as the %@ key in either the Info.plist or the user defaults!", SUFeedURLKey];
|
||||
NSCharacterSet *quoteSet = [NSCharacterSet characterSetWithCharactersInString:@"\"\'"]; // Some feed publishers add quotes; strip 'em.
|
||||
|
||||
Reference in new issue
Block a user