How to programatically disable auto-updates

Asked by Frank Reiff

I've got a special kind of problem with Sparkle 1.5b6.

I have an app that let's you create "droplets".

Essentially this works as follows:

1) copy the application
2) store some settings inside the copied application bundle that will cause it start up as a "droplet" and apply these settings automatically

The problem with Sparkle is that I need to be able to disable automatic updates for the droplets, which of course share the same info.plist, defaults, etc than the "main" application.

I've tried various ways of doing this:

1) change the info.plist for the "droplet" application

of course this won't work because the defaults (which are shared) will override the setting.

2) use the setAutomaticallyChecksForUpdates method to disable the feature on startup

The problem here is that I'm not sure when to do this (the updater gets initialized from the nib file potentially before the main controller, so there might be a race condition there) and I suspect that this will write the new settings to the (shared) defaults as well.. right?

I had hoped that the delegate would have a method somewhere along the lines of

- (BOOL) willCheckForUpdates;

where I could block the call, but that doesn't seem to be the case.

I can only think of two more ways of doing this:

1) I am implementing the version comparator, so perhaps I could do something like:

if( isDroplet) return NSOrderedSame;

That would block all updates. Right?

2) I could also create a separate defaults domain for the droplets..

BUT surely there's a better way of doing all this and I'm just overlooking it?

Any help would be greatly appreciated.

Best regards,

Frank

Question information

Language:
English Edit question
Status:
Solved
For:
Sparkle Edit question
Assignee:
No assignee Edit question
Solved by:
Andy Matuschak
Solved:
Last query:
Last reply:
Revision history for this message
Best Andy Matuschak (andymatuschak) said :
#1

Oh jeez. Yeah, the API is not so good for that, huh? You're right: calling setAutomaticallyChecksForUpdates will write out that new setting to the shared defaults. Sparkle makes the (probably reasonable) assumption that you won't have distinct clients with the same bundle ID wanting distinct settings.

I can imagine other OS X services being confused as well, so it really might be in your best interest to give each droplet its own CFBundleIdentifier. If you don't want to do that, I recommend overriding this method to return nil if (isDroplet):
- (SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forUpdater:(SUUpdater *)bundle;

Revision history for this message
Frank Reiff (reiff) said :
#2

Thanks for the advice.

Best regards,

Frank