Wow, big mistakes. Critical fixes to the unarchiver refactoring I just finished, fixing a double-retain, a file added to the wrong target, and a crash on the use of any kind of archive except .dmg. Really sorry, guys.
The relaunch tool sadly now polls for the host app being closed, rather than registering for notifications. But there was some race condition which had problems with the latter.
Refactored Sparkle's unarchiving system into SUUnarchiver, a factory for SUPipedUnarchiver and SUDiskImageUnarchiver. I removed that nasty cleanUp call by now copying out the contents of the DMG into the /tmp directory and unmounting. Nice!
This changed a fair amount so please test with your build and let me know if it explodes things. Works in my tests, though.
Basically, because I foolishly don't "[self abortUpdate]" on failure in the UI-based update driver, the SUUpdater instance thought an update was still in progress when it wasn't. This only affected user-initiated updates (SUScheduledUpdateDriver overrides that method), but it still was a serious issue.
Finally adding real delegate support. The following methods are implemented; the comments document them.
If you have suggestions for other methods that would be useful, feel free to suggest them.
// Use this to override the default behavior for Sparkle prompting the user about automatic update checks.
- (BOOL)shouldPromptForPermissionToCheckForUpdates;
// Implement this if you want to do some special handling with the appcast once it finishes loading.
- (void)appcastDidFinishLoading:(SUAppcast *)appcast;
// If you're using special logic or extensions in your appcast, implement this to use your own logic for finding
// a valid update, if any, in the given appcast.
- (SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast;
// Sent when a valid update is found by the update driver.
- (void)didFindValidUpdate:(SUAppcastItem *)update;
// Sent when the user makes a choice in the update alert dialog (install now / remind me later / skip this version).
- (void)userChoseAction:(SUUpdateAlertChoice)action forUpdate:(SUAppcastItem *)update;
// Sent immediately before installing the specified update.
- (void)updateWillInstall:(SUAppcastItem *)update;
// Return YES to delay the relaunch until you do some processing; invoke the given NSInvocation to continue.
- (BOOL)shouldPostponeRelaunchForUpdate:(SUAppcastItem *)update untilInvoking:(NSInvocation *)invocation;
// Called immediately before relaunching.
- (void)updaterWillRelaunchApplication;
Sparkle now gies visual indication that it's checking for updates when hte update's user initiated. ie: it pops up a status controller saying "checking for updates..."
What was SUUserInitiatedUpdateDriver is now SUUIBasedUpdateDriver; SUUserInitiatedUpdateDriver now is a subclass of that, along with SUScheduledUpdateDriver. This is a happy little refactoring that let me remove some redundant code.