Modified Sparkle to accomodate helper-parent update

This commit is contained in:
Marcus Ososbase committed 2018-02-22 06:00:46 -05:00
1 parent 612120a933
commit 680d66378d
2 files changed
+34 -1

No files matched your search

+26 -1
View File
@@ -593,7 +593,32 @@
// Note: this is overridden by the automatic update driver to not terminate in some cases
- (void)terminateApp
{
[NSApp terminate:self];
BOOL isMainBundle = [self.host.bundle isEqualTo:[NSBundle mainBundle]];
if (isMainBundle) {
[NSApp terminate:self];
}
else {
NSString *bundleID = self.host.bundle.bundleIdentifier;
if (bundleID.length > 0) {
NSArray *apps = [NSRunningApplication runningApplicationsWithBundleIdentifier:bundleID];
for (NSRunningApplication *app in apps) {
[app terminate];
}
// Notify the mainBundle host the target has been terminated
id<SUUpdaterPrivate> updater = self.updater;
id<SUUpdaterDelegate> updaterDelegate = [updater delegate];
if ([updaterDelegate respondsToSelector:@selector(updater:didTerminateTarget:)]) {
[updaterDelegate updater:self.updater didTerminateTarget:bundleID];
}
}
else
{
// Shouldn't happen
[NSApp terminate:self];
}
}
}
- (void)cleanUpDownload
+8
View File
@@ -285,6 +285,14 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey;
*/
- (void)updater:(SUUpdater *)updater willInstallUpdateOnQuit:(SUAppcastItem *)item immediateInstallationBlock:(void (^)()) restartBlock;
/*!
Called when the update target is not from the host mainBundle. For example, a helper app updating its parent
\param updater the SUUpdater instance.
\param targetBundleID the bundle ID of the terminated parent app
*/
- (void)updater:(SUUpdater *)updater didTerminateTarget: (NSString *)targetBundleID;
/*!
Calls after an update that was scheduled to be silently installed on quit has been canceled.