From 48ab89338b7f9ed182df767542c07cf439a823a0 Mon Sep 17 00:00:00 2001 From: Dmytro Tretiakov Date: Thu, 7 Aug 2014 16:03:02 +0300 Subject: [PATCH] Implemented updaters queue. --- Installation XPC Service/SUXPCInstaller.h | 2 +- Installation XPC Service/SUXPCInstaller.m | 7 +- SUAppDelegate.h | 19 + SUAppDelegate.m | 27 + SUAutomaticUpdateDriver.m | 16 +- SUBasicUpdateDriver.h | 4 +- SUBasicUpdateDriver.m | 93 +- SUConstants.h | 22 + SUProbingUpdateDriver.m | 4 +- SUScheduledUpdateDriver.m | 9 +- SUUIBasedUpdateDriver.m | 27 +- SUUpdateDriver.h | 8 +- SUUpdateDriver.m | 20 +- SUUpdater.h | 9 +- SUUpdater.m | 60 +- SUUpdaterQueue.h | 21 + SUUpdaterQueue.m | 393 +++++++ SUUpdater_Private.h | 10 + SUUserInitiatedUpdateDriver.m | 8 +- Sparkle.h | 1 + Sparkle.xcodeproj/project.pbxproj | 16 +- .../English.lproj/MainMenu.nib/classes.nib | 43 - .../English.lproj/MainMenu.nib/designable.nib | 1028 +++-------------- .../English.lproj/MainMenu.nib/info.nib | 21 - .../MainMenu.nib/keyedobjects.nib | Bin 22110 -> 18084 bytes finish_installation.m | 171 +-- 26 files changed, 956 insertions(+), 1083 deletions(-) create mode 100644 SUAppDelegate.h create mode 100644 SUAppDelegate.m create mode 100644 SUUpdaterQueue.h create mode 100644 SUUpdaterQueue.m delete mode 100644 Test Application/English.lproj/MainMenu.nib/classes.nib delete mode 100644 Test Application/English.lproj/MainMenu.nib/info.nib diff --git a/Installation XPC Service/SUXPCInstaller.h b/Installation XPC Service/SUXPCInstaller.h index 52cdd1f0..0d179a0b 100644 --- a/Installation XPC Service/SUXPCInstaller.h +++ b/Installation XPC Service/SUXPCInstaller.h @@ -15,7 +15,7 @@ + (BOOL)copyPathContent:(NSString *)src toDirectory:(NSString *)dstDir error:(NSError **)outError; // dstDir will be created if absent -+ (void)launchTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments completionHandler:(void (^)(void))completionHandler; ++ (void)launchTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments; + (void)launchTaskWithPath:(NSString *)launchPath arguments:(NSArray *)arguments diff --git a/Installation XPC Service/SUXPCInstaller.m b/Installation XPC Service/SUXPCInstaller.m index 6027620f..5bea603a 100644 --- a/Installation XPC Service/SUXPCInstaller.m +++ b/Installation XPC Service/SUXPCInstaller.m @@ -154,17 +154,16 @@ return (nil == error); } -+ (void)launchTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments completionHandler:(void (^)(void))completionHandler ++ (void)launchTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments { - void (^handler)(int, NSData *) = completionHandler != nil ? ^(int r, NSData *d) { completionHandler(); } : nil; [self launchTaskWithPath:path arguments:arguments environment:nil currentDirectoryPath:nil inputData:nil waitForTaskResult:NO - waitUntilDone:NO - completionHandler:handler]; + waitUntilDone:YES + completionHandler:nil]; } + (void)launchTaskWithPath:(NSString *)launchPath diff --git a/SUAppDelegate.h b/SUAppDelegate.h new file mode 100644 index 00000000..0036dd26 --- /dev/null +++ b/SUAppDelegate.h @@ -0,0 +1,19 @@ +// +// SUAppDelegate.h +// Sparkle +// +// Created by Dmytro Tretiakov on 8/1/14. +// +// + +#import + +@class SUUpdater; +@class SUUpdaterQueue; + +@interface SUAppDelegate : NSObject + +@property (nonatomic, retain) IBOutlet SUUpdater *updater; +@property (nonatomic, retain) SUUpdaterQueue *updaterQueue; + +@end diff --git a/SUAppDelegate.m b/SUAppDelegate.m new file mode 100644 index 00000000..5b1f2655 --- /dev/null +++ b/SUAppDelegate.m @@ -0,0 +1,27 @@ +// +// SUAppDelegate.m +// Sparkle +// +// Created by Dmytro Tretiakov on 8/1/14. +// +// + +#import "SUAppDelegate.h" +#import + +@implementation SUAppDelegate + +- (void)dealloc +{ + self.updater = nil; + self.updaterQueue = nil; + [super dealloc]; +} + +- (void)applicationDidFinishLaunching:(NSNotification *)notification +{ + self.updaterQueue = [[[SUUpdaterQueue alloc] init] autorelease]; + [self.updaterQueue addUpdater:self.updater]; +} + +@end diff --git a/SUAutomaticUpdateDriver.m b/SUAutomaticUpdateDriver.m index 67da9326..b50e2979 100644 --- a/SUAutomaticUpdateDriver.m +++ b/SUAutomaticUpdateDriver.m @@ -55,8 +55,14 @@ static NSString * const kSUAutomaticUpdateParamName = @"autoupdate"; #endif // SPARKLE_IS_COMPATIBLE_WITH_DEVMATE // ------------------------------------------------------------------- +- (BOOL)shouldShowUI +{ + return showErrors; +} + - (void)unarchiverDidFinish:(SUUnarchiver *)ua { + showErrors = YES; alert = [[SUAutomaticUpdateAlert alloc] initWithAppcastItem:updateItem host:host delegate:self]; // If the app is a menubar app or the like, we need to focus it first and alter the @@ -95,19 +101,13 @@ static NSString * const kSUAutomaticUpdateParamName = @"autoupdate"; case SUDoNotInstallChoice: [host setObject:[updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey]; - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortCanceledByUser]; break; } } - (BOOL)shouldInstallSynchronously { return postponingInstallation; } -- (void)installWithToolAndRelaunch:(BOOL)relaunch -{ - showErrors = YES; - [super installWithToolAndRelaunch:relaunch]; -} - - (void)applicationWillTerminate:(NSNotification *)note { [self installWithToolAndRelaunch:NO]; @@ -118,7 +118,7 @@ static NSString * const kSUAutomaticUpdateParamName = @"autoupdate"; if (showErrors) [super abortUpdateWithError:error]; else - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortGotError]; } @end diff --git a/SUBasicUpdateDriver.h b/SUBasicUpdateDriver.h index 1a32b2b0..1d18ddf3 100644 --- a/SUBasicUpdateDriver.h +++ b/SUBasicUpdateDriver.h @@ -49,11 +49,9 @@ - (void)installWithToolAndRelaunch:(BOOL)relaunch; - (void)installerForHost:(SUHost *)host failedWithError:(NSError *)error; - -- (void)installWithToolAndRelaunch:(BOOL)relaunch; - (void)cleanUpDownload; -- (void)abortUpdate; +- (void)abortUpdate:(SUUpdateAbortReason)reason; - (void)abortUpdateWithError:(NSError *)error; @end diff --git a/SUBasicUpdateDriver.m b/SUBasicUpdateDriver.m index b2e018ee..1bc916e2 100644 --- a/SUBasicUpdateDriver.m +++ b/SUBasicUpdateDriver.m @@ -355,7 +355,7 @@ NSArray *SUGetAllDevMateURLHosts(void) if (![updater mayUpdateAndRestart]) { - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortForbiddenByDelegate]; return; } @@ -376,22 +376,35 @@ NSArray *SUGetAllDevMateURLHosts(void) if ([[updater delegate] respondsToSelector:@selector(updater:willInstallUpdate:)]) [[updater delegate] updater:updater willInstallUpdate:updateItem]; - BOOL isAlreadyInstalled = NO; - if ([[updater delegate] respondsToSelector:@selector(updater:overrideInstallUpdate:downloadPath:)]) + SUFinishUpdateTask finishTasks = SUFinishUpdateWithDefaultInstallation; + + BOOL shouldRelaunch = YES; + if ([[updater delegate] respondsToSelector:@selector(updater:overrideInstallUpdate:downloadPath:shouldRelaunch:)] && + [[updater delegate] updater:updater overrideInstallUpdate:updateItem downloadPath:tempDir shouldRelaunch:&shouldRelaunch]) { - isAlreadyInstalled = [[updater delegate] updater:updater overrideInstallUpdate:updateItem downloadPath:tempDir]; + finishTasks = finishTasks & (~SUFinishUpdateWithInstall); + relaunch = relaunch && shouldRelaunch; + } + if (!relaunch) + { + finishTasks = finishTasks & (~SUFinishUpdateWithRelaunch); } + if (SUFinishUpdateAbort == finishTasks) + { + [self abortUpdate:SUUpdateAbortTasksFinished]; + return; + } + // Copy the relauncher into a temporary directory so we can get to it after the new version's installed. NSString *relaunchPathToCopy = [SPARKLE_BUNDLE pathForResource:@"finish_installation" ofType:@"app"]; NSString *targetPath = [[host appSupportPath] stringByAppendingPathComponent:[relaunchPathToCopy lastPathComponent]]; // Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems. NSError *error = nil; -#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 - [[NSFileManager defaultManager] createDirectoryAtPath: [targetPath stringByDeletingLastPathComponent] attributes: [NSDictionary dictionary]]; -#else - [[NSFileManager defaultManager] createDirectoryAtPath: [targetPath stringByDeletingLastPathComponent] withIntermediateDirectories: YES attributes: [NSDictionary dictionary] error: &error]; -#endif + [[NSFileManager defaultManager] createDirectoryAtPath:[targetPath stringByDeletingLastPathComponent] + withIntermediateDirectories:YES + attributes:[NSDictionary dictionary] + error:&error]; // Only the paranoid survive: if there's already a stray copy of relaunch there, we would have problems. BOOL copiedRelaunchTool = NO; @@ -403,21 +416,37 @@ NSArray *SUGetAllDevMateURLHosts(void) { copiedRelaunchTool = [SUPlainInstaller copyPathWithAuthentication:relaunchPathToCopy overPath:targetPath temporaryName:nil error:&error]; } - [self finishRelaunchAfterSuccessfulCopying:copiedRelaunchTool fromPath:relaunchPathToCopy toPath:targetPath isInstalled:isAlreadyInstalled relaunch:relaunch]; + [self finishRelaunchAfterSuccessfulCopying:copiedRelaunchTool fromPath:relaunchPathToCopy toPath:targetPath finishTaskMask:finishTasks]; } -- (void)finishRelaunchAfterSuccessfulCopying:(BOOL)copiedRelaunchTool fromPath:(NSString *)relaunchPathToCopy toPath:(NSString *)targetPath isInstalled:(BOOL)isInstalled relaunch:(BOOL)relaunch +- (void)finishRelaunchAfterSuccessfulCopying:(BOOL)copiedRelaunchTool fromPath:(NSString *)relaunchPathToCopy toPath:(NSString *)targetPath finishTaskMask:(SUFinishUpdateTask)taskMask { - NSError *error = nil; - if( copiedRelaunchTool ) + if (copiedRelaunchTool) + { relaunchPath = [targetPath retain]; + } else + { [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil), NSLocalizedDescriptionKey, [NSString stringWithFormat:@"Couldn't copy relauncher (%@) to temporary path (%@)! %@", relaunchPathToCopy, targetPath, (error ? [error localizedDescription] : @"")], NSLocalizedFailureReasonErrorKey, nil]]]; + } - [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterWillRestartNotification object:self]; - if ([[updater delegate] respondsToSelector:@selector(updaterWillRelaunchApplication:)]) - [[updater delegate] updaterWillRelaunchApplication:updater]; + NSString *pathToRelaunch = @""; + BOOL shouldFinishUpdateWithRelaunch = (taskMask & SUFinishUpdateWithRelaunch) != 0; + if (shouldFinishUpdateWithRelaunch) + { + [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterWillRestartNotification object:self]; + if ([[updater delegate] respondsToSelector:@selector(updaterWillRelaunchApplication:)]) + { + [[updater delegate] updaterWillRelaunchApplication:updater]; + } + + pathToRelaunch = [host bundlePath]; + if ([[updater delegate] respondsToSelector:@selector(pathToRelaunchForUpdater:)]) + { + pathToRelaunch = [[updater delegate] pathToRelaunchForUpdater:updater]; + } + } if(!relaunchPath || ![[NSFileManager defaultManager] fileExistsAtPath:relaunchPath]) { @@ -425,23 +454,29 @@ NSArray *SUGetAllDevMateURLHosts(void) [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:SULocalizedString(@"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@.", nil), [host name]], NSLocalizedDescriptionKey, [NSString stringWithFormat:@"Couldn't find the relauncher (expected to find it at %@)", relaunchPath], NSLocalizedFailureReasonErrorKey, nil]]]; // We intentionally don't abandon the update here so that the host won't initiate another. return; - } - - NSString *pathToRelaunch = [host bundlePath]; - if ([[updater delegate] respondsToSelector:@selector(pathToRelaunchForUpdater:)]) - pathToRelaunch = [[updater delegate] pathToRelaunchForUpdater:updater]; + } + NSString *relaunchToolPath = [relaunchPath stringByAppendingPathComponent: @"/Contents/MacOS/finish_installation"]; - NSArray *arguments = [NSArray arrayWithObjects:[host bundlePath], pathToRelaunch, [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], tempDir, relaunch ? @"1" : @"0", isInstalled ? @"1" : @"0", nil]; + NSArray *arguments = [NSArray arrayWithObjects: + [host bundlePath], + pathToRelaunch, + [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]], + tempDir, + [NSString stringWithFormat:@"%lu", taskMask], + nil]; + if (SUShouldUseXPCInstaller()) { - [SUXPCInstaller launchTaskWithLaunchPath:relaunchToolPath arguments:arguments completionHandler:^{ - [NSApp terminate:self]; - }]; + [SUXPCInstaller launchTaskWithLaunchPath:relaunchToolPath arguments:arguments]; } else { [NSTask launchedTaskWithLaunchPath:relaunchToolPath arguments:arguments]; - [NSApp terminate:self]; + } + + if (shouldFinishUpdateWithRelaunch) + { + [NSApp terminate:nil]; } } @@ -473,12 +508,12 @@ NSArray *SUGetAllDevMateURLHosts(void) [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:SULocalizedString(@"An error occurred while installing the update. Please try again later.", nil), NSLocalizedDescriptionKey, [error localizedDescription], NSLocalizedFailureReasonErrorKey, nil]]]; } -- (void)abortUpdate +- (void)abortUpdate:(SUUpdateAbortReason)reason { [[self retain] autorelease]; // In case the notification center was the last one holding on to us. [self cleanUpDownload]; [[NSNotificationCenter defaultCenter] removeObserver:self]; - [super abortUpdate]; + [super abortUpdate:reason]; } - (void)abortUpdateWithError:(NSError *)error @@ -489,7 +524,7 @@ NSArray *SUGetAllDevMateURLHosts(void) SULog(@"Sparkle Error (continued): %@", [error localizedFailureReason]); if (download) [download cancel]; - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortGotError]; } - (void)dealloc diff --git a/SUConstants.h b/SUConstants.h index 6612515e..c0ed8e83 100644 --- a/SUConstants.h +++ b/SUConstants.h @@ -39,6 +39,28 @@ extern NSString *const SUUpdaterWillRestartNotification; extern NSString *const SUTechnicalErrorInformationKey; +// ----------------------------------------------------------------------------- +// Typedefs: +// ----------------------------------------------------------------------------- + +typedef NS_OPTIONS(NSUInteger, SUFinishUpdateTask) +{ + SUFinishUpdateAbort = 0, + SUFinishUpdateWithInstall = 1 << 0, + SUFinishUpdateWithRelaunch = 1 << 1, + SUFinishUpdateWithDefaultInstallation = SUFinishUpdateWithInstall | SUFinishUpdateWithRelaunch +}; + +typedef NS_ENUM(NSUInteger, SUUpdateAbortReason) +{ + SUUpdateAbortUndefined = 0, + SUUpdateAbortForbiddenByDelegate, + SUUpdateAbortTasksFinished, // installed and relaunched by delegate + SUUpdateAbortCanceledByUser, + SUUpdateAbortDidNotFind, + SUUpdateAbortGotError +}; + // ----------------------------------------------------------------------------- // PList keys:: // ----------------------------------------------------------------------------- diff --git a/SUProbingUpdateDriver.m b/SUProbingUpdateDriver.m index 64bd5b56..f14710fc 100644 --- a/SUProbingUpdateDriver.m +++ b/SUProbingUpdateDriver.m @@ -17,14 +17,14 @@ { if ([[updater delegate] respondsToSelector:@selector(updater:didFindValidUpdate:)]) [[updater delegate] updater:updater didFindValidUpdate:updateItem]; - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortTasksFinished]; } - (void)didNotFindUpdate { if ([[updater delegate] respondsToSelector:@selector(updaterDidNotFindUpdate:)]) [[updater delegate] updaterDidNotFindUpdate:updater]; - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortDidNotFind]; } @end diff --git a/SUScheduledUpdateDriver.m b/SUScheduledUpdateDriver.m index 2d4b0750..f0d3d0fc 100644 --- a/SUScheduledUpdateDriver.m +++ b/SUScheduledUpdateDriver.m @@ -15,6 +15,11 @@ @implementation SUScheduledUpdateDriver +- (BOOL)shouldShowUI +{ + return showErrors; +} + - (void)didFindValidUpdate { showErrors = YES; // We only start showing errors after we present the UI for the first time. @@ -25,7 +30,7 @@ { if ([[updater delegate] respondsToSelector:@selector(updaterDidNotFindUpdate:)]) [[updater delegate] updaterDidNotFindUpdate:updater]; - [self abortUpdate]; // Don't tell the user that no update was found; this was a scheduled update. + [self abortUpdate:SUUpdateAbortDidNotFind]; // Don't tell the user that no update was found; this was a scheduled update. } - (void)abortUpdateWithError:(NSError *)error @@ -33,7 +38,7 @@ if (showErrors) [super abortUpdateWithError:error]; else - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortGotError]; } @end diff --git a/SUUIBasedUpdateDriver.m b/SUUIBasedUpdateDriver.m index 673ac615..86f1f1a4 100644 --- a/SUUIBasedUpdateDriver.m +++ b/SUUIBasedUpdateDriver.m @@ -17,6 +17,11 @@ @implementation SUUIBasedUpdateDriver +- (BOOL)shouldShowUI +{ + return YES; +} + - (void)didFindValidUpdate { updateAlert = [[SUUpdateAlert alloc] initWithAppcastItem:updateItem host:host]; @@ -53,7 +58,7 @@ NSAlert *alert = [NSAlert alertWithMessageText:SULocalizedString(@"You're up-to-date!", nil) defaultButton:SULocalizedString(@"OK", nil) alternateButton:nil otherButton:nil informativeTextWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [host name], [host displayVersion]]; [self showModalAlert:alert]; - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortDidNotFind]; } - (void)applicationDidBecomeActive:(NSNotification *)aNotification @@ -83,16 +88,16 @@ case SUOpenInfoURLChoice: [[NSWorkspace sharedWorkspace] openURL: [updateItem infoURL]]; - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortCanceledByUser]; break; case SUSkipThisVersionChoice: [host setObject:[updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey]; - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortCanceledByUser]; break; case SURemindMeLaterChoice: - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortCanceledByUser]; break; } } @@ -129,7 +134,7 @@ { if (download) [download cancel]; - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortCanceledByUser]; } - (void)extractUpdate @@ -206,6 +211,7 @@ - (void)abortUpdateWithError:(NSError *)error { + abortReason = SUUpdateAbortGotError; NSAlert *alert = [NSAlert alertWithMessageText:SULocalizedString(@"Update Error!", nil) defaultButton:SULocalizedString(@"Cancel Update", nil) alternateButton:nil @@ -215,7 +221,7 @@ [super abortUpdateWithError:error]; } -- (void)abortUpdate +- (void)abortUpdate:(SUUpdateAbortReason)reason { if (statusController) { @@ -223,11 +229,18 @@ [statusController autorelease]; statusController = nil; } - [super abortUpdate]; + [super abortUpdate:reason]; } - (void)showModalAlert:(NSAlert *)alert { + if ([[updater delegate] respondsToSelector:@selector(updater:mayShowModalAlert:)] && + ![[updater delegate] updater:updater mayShowModalAlert:alert]) + { + // delegate forbids to show this alert! + return; + } + if ([[updater delegate] respondsToSelector:@selector(updaterWillShowModalAlert:)]) [[updater delegate] updaterWillShowModalAlert: updater]; diff --git a/SUUpdateDriver.h b/SUUpdateDriver.h index 9e8a73e2..82bfe69a 100644 --- a/SUUpdateDriver.h +++ b/SUUpdateDriver.h @@ -20,15 +20,17 @@ extern NSString * const SUUpdateDriverFinishedNotification; SUUpdater *updater; NSURL *appcastURL; - BOOL finished; + SUUpdateAbortReason abortReason; } -- initWithUpdater:(SUUpdater *)updater; +- (id)initWithUpdater:(SUUpdater *)updater; - (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)host; -- (void)abortUpdate; +- (void)abortUpdate:(SUUpdateAbortReason)reason; - (BOOL)finished; - (SUHost*)host; - (void)setHost:(SUHost*)newHost; +- (SUUpdateAbortReason)abortReason; +- (BOOL)shouldShowUI; // can change it's value @end diff --git a/SUUpdateDriver.m b/SUUpdateDriver.m index e1bae4ee..662e5c6a 100644 --- a/SUUpdateDriver.m +++ b/SUUpdateDriver.m @@ -23,17 +23,31 @@ NSString * const SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished"; - (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)h { + abortReason = SUUpdateAbortUndefined; appcastURL = [URL copy]; host = [h retain]; } -- (void)abortUpdate +- (void)abortUpdate:(SUUpdateAbortReason)reason { - [self setValue:[NSNumber numberWithBool:YES] forKey:@"finished"]; + abortReason = reason; [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdateDriverFinishedNotification object:self]; } -- (BOOL)finished { return finished; } +- (BOOL)finished +{ + return abortReason != SUUpdateAbortUndefined; +} + +- (SUUpdateAbortReason)abortReason +{ + return abortReason; +} + +- (BOOL)shouldShowUI +{ + return NO; +} - (void)dealloc { diff --git a/SUUpdater.h b/SUUpdater.h index b09cf902..b1728f9d 100644 --- a/SUUpdater.h +++ b/SUUpdater.h @@ -85,7 +85,7 @@ @interface NSObject (SUUpdaterDelegateInformalProtocol) // Use this to keep Sparkle from popping up e.g. while your setup assistant is showing: -- (BOOL)updaterMayCheckForUpdates:(SUUpdater *)bundle; +- (BOOL)updaterMayCheckForUpdates:(SUUpdater *)updater; // This method allows you to add extra parameters to the appcast URL, potentially based on whether or not Sparkle will also be sending along the system profile. This method should return an array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user. - (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile; @@ -113,7 +113,7 @@ - (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update; // Override to handle update manually -- (BOOL)updater:(SUUpdater *)updater overrideInstallUpdate:(SUAppcastItem *)update downloadPath:(NSString *)downloadPath; +- (BOOL)updater:(SUUpdater *)updater overrideInstallUpdate:(SUAppcastItem *)update downloadPath:(NSString *)downloadPath shouldRelaunch:(BOOL *)outShouldRelaunch; // Return YES to delay the relaunch until you do some processing; invoke the given NSInvocation to continue. // This is not called if the user didn't relaunch on the previous update, in that case it will immediately @@ -140,8 +140,9 @@ // Called before and after, respectively, an updater shows a modal alert window, to give the host // the opportunity to hide attached windows etc. that may get in the way: --(void) updaterWillShowModalAlert:(SUUpdater *)updater; --(void) updaterDidShowModalAlert:(SUUpdater *)updater; +- (BOOL)updater:(SUUpdater *)updater mayShowModalAlert:(NSAlert *)alertToShow; +- (void)updaterWillShowModalAlert:(SUUpdater *)updater; +- (void)updaterDidShowModalAlert:(SUUpdater *)updater; @end diff --git a/SUUpdater.m b/SUUpdater.m index c8d6b13e..17b03986 100644 --- a/SUUpdater.m +++ b/SUUpdater.m @@ -7,6 +7,7 @@ // #import "SUUpdater.h" +#import "SUUpdater_Private.h" #import "SUHost.h" #import "SUUpdatePermissionPrompt.h" @@ -21,7 +22,8 @@ #include -@interface SUUpdater (Private) +@interface SUUpdater () + - (id)initForBundle:(NSBundle *)bundle; - (void)startUpdateCycle; - (void)checkForUpdatesWithDriver:(SUUpdateDriver *)updateDriver; @@ -32,8 +34,8 @@ - (void)updateDriverDidFinish:(NSNotification *)note; - (NSURL *)parameterizedFeedURL; --(void) notifyWillShowModalAlert; --(void) notifyDidShowModalAlert; +-(void)notifyWillShowModalAlert; +-(void)notifyDidShowModalAlert; @end @@ -107,13 +109,30 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault BOOL hasPublicDSAKey = [host publicDSAKey] != nil; BOOL isMainBundle = [bundle isEqualTo:[NSBundle mainBundle]]; BOOL hostIsCodeSigned = [SUCodeSigningVerifier hostApplicationIsCodeSigned]; - if (!isMainBundle && !hasPublicDSAKey) { + NSAlert *warnAlert = nil; + if (!isMainBundle && !hasPublicDSAKey) + { + warnAlert = [NSAlert alertWithMessageText:SULocalizedString(@"Insecure update error!", nil) + defaultButton:SULocalizedString(@"OK", nil) + alternateButton:nil + otherButton:nil + informativeTextWithFormat:SULocalizedString(@"For security reasons, you need to sign your updates with a DSA key. See Sparkle's documentation for more information.", nil)]; + } + else if (isMainBundle && !(hasPublicDSAKey || hostIsCodeSigned)) + { + warnAlert = [NSAlert alertWithMessageText:SULocalizedString(@"Insecure update error!", nil) + defaultButton:SULocalizedString(@"OK", nil) + alternateButton:nil + otherButton:nil + informativeTextWithFormat:SULocalizedString(@"For security reasons, you need to code sign your application or sign your updates with a DSA key. See Sparkle's documentation for more information.", nil)]; + } + + if (warnAlert != nil && + (![[self delegate] respondsToSelector:@selector(updater:mayShowModalAlert:)] || + [[self delegate] updater:self mayShowModalAlert:warnAlert])) + { [self notifyWillShowModalAlert]; - NSRunAlertPanel(@"Insecure update error!", @"For security reasons, you need to sign your updates with a DSA key. See Sparkle's documentation for more information.", @"OK", nil, nil); - [self notifyDidShowModalAlert]; - } else if (isMainBundle && !(hasPublicDSAKey || hostIsCodeSigned)) { - [self notifyWillShowModalAlert]; - NSRunAlertPanel(@"Insecure update error!", @"For security reasons, you need to code sign your application or sign your updates with a DSA key. See Sparkle's documentation for more information.", @"OK", nil, nil); + [warnAlert runModal]; [self notifyDidShowModalAlert]; } #endif @@ -204,9 +223,15 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault - (void)updateDriverDidFinish:(NSNotification *)note { - if ([note object] == driver && [driver finished]) + if ([note object] == driver && (!driver || [driver finished])) { - [driver release]; driver = nil; + if ([[self delegate] respondsToSelector:@selector(updaterDidEndUpdateProcess:)]) + { + [[self delegate] updaterDidEndUpdateProcess:self]; + } + + [driver release]; + driver = nil; [self scheduleNextUpdateCheck]; } } @@ -336,6 +361,11 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault if ([self updateInProgress]) { return; } if (checkTimer) { [checkTimer invalidate]; [checkTimer release]; checkTimer = nil; } // UK 2009-03-16 Timer is non-repeating, may have invalidated itself, so we had to retain it. + if ([[self delegate] respondsToSelector:@selector(updaterWillStartUpdateProcess:)]) + { + [[self delegate] updaterWillStartUpdateProcess:self]; + } + SUClearLog(); SULog( @"===== %@ =====", [[NSFileManager defaultManager] displayNameAtPath: [[NSBundle mainBundle] bundlePath]] ); @@ -345,7 +375,7 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault if( [delegate respondsToSelector: @selector(updaterMayCheckForUpdates:)] && ![delegate updaterMayCheckForUpdates: self] ) { - [self scheduleNextUpdateCheck]; + [self updateDriverDidFinish:nil]; return; } @@ -354,7 +384,7 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault // If we're not given a driver at all, just schedule the next update check and bail. if (!driver) { - [self scheduleNextUpdateCheck]; + [self updateDriverDidFinish:nil]; return; } @@ -362,7 +392,7 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault if( theFeedURL ) // Use a NIL URL to cancel quietly. [driver checkForUpdatesAtURL: theFeedURL host:host]; else - [driver abortUpdate]; + [driver abortUpdate:SUUpdateAbortGotError]; } - (void)registerAsObserver @@ -580,7 +610,9 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault } - (id)delegate { return delegate; } +- (SUHost *)host { return host; } - (NSBundle *)hostBundle { return [host bundle]; } +- (SUBasicUpdateDriver *)driver { return (SUBasicUpdateDriver *)driver; } #pragma mark - DevMate Interaction diff --git a/SUUpdaterQueue.h b/SUUpdaterQueue.h new file mode 100644 index 00000000..90f686f7 --- /dev/null +++ b/SUUpdaterQueue.h @@ -0,0 +1,21 @@ +// +// SUUpdaterQueue.h +// Sparkle +// +// Created by Dmytro Tretiakov on 7/31/14. +// +// + +#import + +@class SUUpdater; + +@interface SUUpdaterQueue : NSObject + +- (void)addUpdater:(SUUpdater *)updater; +- (void)removeUpdater:(SUUpdater *)updater; + +- (void)checkForUpdates; +- (void)checkForUpdatesInBackground; + +@end diff --git a/SUUpdaterQueue.m b/SUUpdaterQueue.m new file mode 100644 index 00000000..c64f0a56 --- /dev/null +++ b/SUUpdaterQueue.m @@ -0,0 +1,393 @@ +// +// SUUpdaterQueue.m +// Sparkle +// +// Created by Dmytro Tretiakov on 7/31/14. +// +// + +#import "SUUpdaterQueue.h" +#import "SUUpdater.h" +#import "SUUpdater_Private.h" +#import "SUConstants.h" +#import "SUUserInitiatedUpdateDriver.h" + +@interface SUDelegateProxy : NSProxy + +@property (nonatomic, assign) id realDelegate; +@property (nonatomic, assign) SUUpdaterQueue *updaterQueue; + +@end + +@implementation SUDelegateProxy + ++ (BOOL)shouldRedirectToUpdaterQueue:(SEL)aSelector +{ + if (nil == aSelector) + return NO; + + static NSSet *sSelectorsToRedirect = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + sSelectorsToRedirect = [[NSSet alloc] initWithObjects: + NSStringFromSelector(@selector(updaterWillStartUpdateProcess:)), + NSStringFromSelector(@selector(updaterDidEndUpdateProcess:)), + NSStringFromSelector(@selector(updaterMayCheckForUpdates:)), + NSStringFromSelector(@selector(updater:mayShowModalAlert:)), + nil]; + }); + + return [sSelectorsToRedirect containsObject:NSStringFromSelector(aSelector)]; +} + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector +{ + NSMethodSignature *signature = [self.realDelegate methodSignatureForSelector:selector]; + if (!signature) + { + signature = [self.updaterQueue methodSignatureForSelector:selector]; + } + if (!signature) + { + signature = [self methodSignatureForSelector:selector]; + } + return signature; +} + +- (BOOL)respondsToSelector:(SEL)aSelector +{ + BOOL result = NO; + + if ([SUDelegateProxy shouldRedirectToUpdaterQueue:aSelector]) + { + result = YES; + } + else + { + result = [self.realDelegate respondsToSelector:aSelector]; + } + + return result; +} + +- (void)forwardInvocation:(NSInvocation *)anInvocation +{ + if ([SUDelegateProxy shouldRedirectToUpdaterQueue:[anInvocation selector]]) + { + [anInvocation invokeWithTarget:self.updaterQueue]; + } + else if ([self.realDelegate respondsToSelector:anInvocation.selector]) + { + [anInvocation invokeWithTarget:self.realDelegate]; + } +} + +- (BOOL)isKindOfClass:(Class)aClass +{ + if (self.realDelegate) + return [self.realDelegate isKindOfClass:aClass]; + return NO; +} + +@end + +#pragma mark - + +@interface SUUpdaterQueue () +{ + NSMutableArray *_updaters; + NSMutableDictionary *_delegatesMap; +} + +@property (readonly) NSMutableArray *updaters; +@property (readonly) NSMutableDictionary *delegatesMap; +@property (retain) SUUpdater *currentUpdater; +@property (assign) BOOL currentUpdaterInProcess; +@property (assign) BOOL shouldContinueCheck; +@property (nonatomic, retain) NSMutableArray *resultUIDrivers; + +@end + +@implementation SUUpdaterQueue + +- (void)dealloc +{ + for (SUUpdater *updater in self.updaters) + { + [self removeUpdater:updater]; + } + [_updaters release]; + [_delegatesMap release]; + self.currentUpdater = nil; + self.resultUIDrivers = nil; + + [super dealloc]; +} + +- (NSMutableArray *)updaters +{ + if (nil == _updaters) + { + @synchronized (self) + { + _updaters = _updaters ? : [[NSMutableArray alloc] init]; + } + } + + return [[_updaters retain] autorelease]; +} + +- (NSMutableDictionary *)delegatesMap +{ + if (nil == _delegatesMap) + { + @synchronized (self) + { + _delegatesMap = _delegatesMap ? : [[NSMutableDictionary alloc] init]; + } + } + + return [[_delegatesMap retain] autorelease]; +} + +#pragma mark - + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + if ([object isKindOfClass:[SUUpdater class]]) + { + [self updateUpdaterDelegate:object]; + } +} + +- (void)updateUpdaterDelegate:(SUUpdater *)updater +{ + if ([SUDelegateProxy class] == [[updater delegate] class] && + self == [[updater delegate] updaterQueue]) + { + return; + } + + @synchronized (self.delegatesMap) + { + id realDelegate = [updater delegate]; + SUDelegateProxy *proxy = [[SUDelegateProxy alloc] autorelease]; + proxy.realDelegate = realDelegate; + proxy.updaterQueue = self; + [updater setDelegate:proxy]; + + NSString *updaterKey = [self mapKeyForUpdater:updater]; + [self.delegatesMap setObject:proxy forKey:updaterKey]; + } +} + +- (NSString *)mapKeyForUpdater:(SUUpdater *)updater +{ + return [NSString stringWithFormat:@"%p", updater]; +} + +- (id)realDelegateForUpdater:(SUUpdater *)updater +{ + if (nil == updater) + return nil; + + id delegate = nil; + @synchronized (self.delegatesMap) + { + delegate = [self.delegatesMap objectForKey:[self mapKeyForUpdater:updater]]; + } + + return delegate; +} + +#pragma mark - + +- (void)addUpdater:(SUUpdater *)updater +{ + if (nil == updater) + return; + + if ([updater updateInProgress]) + { + NSLog(@"Could not add updater while it's in progress"); + return; + } + + NSMutableArray *updaters = self.updaters; + @synchronized (updaters) + { + //if (![updaters containsObject:updater]) + { + [self updateUpdaterDelegate:updater]; + [updater addObserver:self forKeyPath:@"delegate" options:NSKeyValueObservingOptionNew context:NULL]; + [self.updaters addObject:updater]; + } + } +} + +- (void)removeUpdater:(SUUpdater *)updater +{ + if (nil == updater) + return; + + if (updater == self.currentUpdater && self.currentUpdaterInProcess) + { + NSLog(@"Could not remove updater while it's in progress."); + return; + } + + NSMutableArray *updaters = self.updaters; + @synchronized (updaters) + { + if ([updaters containsObject:updater]) + { + [updater removeObserver:self forKeyPath:@"delegate"]; + id realDelegate = nil; + NSString *updaterKey = [self mapKeyForUpdater:updater]; + + @synchronized (self.delegatesMap) + { + realDelegate = [[self.delegatesMap objectForKey:updaterKey] realDelegate]; + [self.delegatesMap removeObjectForKey:updaterKey]; + } + + [updater setDelegate:realDelegate]; + [updaters removeObject:updater]; + } + } +} + +#pragma mark - + +- (void)performCheckForUpdates:(NSString *)selectorName +{ + NSUInteger index = 0; + self.shouldContinueCheck = YES; + self.resultUIDrivers = [NSMutableArray array]; + do + { + // in case if some of queued updaters is already in process + while (self.currentUpdaterInProcess) + { + [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.5f]]; + } + + if (!self.shouldContinueCheck) + break; + + @synchronized (self.updaters) + { + self.currentUpdater = index < [self.updaters count] ? [self.updaters objectAtIndex:index] : nil; + index++; + } + + if (nil == self.currentUpdater) + break; + + self.currentUpdaterInProcess = YES; + [self.currentUpdater performSelectorOnMainThread:NSSelectorFromString(selectorName) + withObject:nil + waitUntilDone:YES]; + } + while (YES); + + if (SUUpdateAbortDidNotFind == [[self.resultUIDrivers lastObject] abortReason]) + { + SUBasicUpdateDriver *driver = nil; + if ([self.resultUIDrivers count] > 1) + { + SUUpdater *mainUpdater = [SUUpdater sharedUpdater]; + driver = [[[SUUserInitiatedUpdateDriver alloc] initWithUpdater:mainUpdater] autorelease]; + [driver setHost:[mainUpdater host]]; + } + else + { + driver = [self.resultUIDrivers lastObject]; + } + + [driver performSelectorOnMainThread:@selector(didNotFindUpdate) withObject:nil waitUntilDone:YES]; + } + self.resultUIDrivers = nil; +} + +- (void)checkForUpdates +{ + [self performSelectorInBackground:@selector(performCheckForUpdates:) + withObject:NSStringFromSelector(@selector(checkForUpdates:))]; +} + +- (void)checkForUpdatesInBackground +{ + [self performSelectorInBackground:@selector(performCheckForUpdates:) + withObject:NSStringFromSelector(@selector(checkForUpdatesInBackground))]; +} + +#pragma mark - + +- (void)updaterWillStartUpdateProcess:(SUUpdater *)updater +{ + if ((nil != updater && nil == self.currentUpdater) || + (self.currentUpdater == updater)) + { + self.currentUpdater = updater; + self.currentUpdaterInProcess = YES; + } +} + +- (void)updaterDidEndUpdateProcess:(SUUpdater *)updater +{ + if (self.currentUpdater == updater) + { + self.currentUpdater = nil; + self.currentUpdaterInProcess = NO; + + SUBasicUpdateDriver *driver = [updater driver]; + do + { + if (![driver shouldShowUI]) + break; + + if (SUUpdateAbortGotError == [driver abortReason]) + { + self.resultUIDrivers = nil; + self.shouldContinueCheck = NO; + break; + } + + [self.resultUIDrivers addObject:driver]; + } + while (NO); + } +} + +- (BOOL)updaterMayCheckForUpdates:(SUUpdater *)updater +{ + BOOL result = NO; + if (updater != nil && updater == self.currentUpdater) + { + id realDelegate = [SUDelegateProxy class] == [[updater delegate] class] ? [[updater delegate] realDelegate] : [updater delegate]; + result = ![realDelegate respondsToSelector:_cmd] || [realDelegate updaterMayCheckForUpdates:updater]; + } + + return result; +} + +- (BOOL)updater:(SUUpdater *)updater mayShowModalAlert:(NSAlert *)alertToShow +{ + BOOL result = YES; + + if (updater != nil && updater == self.currentUpdater && self.shouldContinueCheck) + { + if (SUUpdateAbortGotError != [[updater driver] abortReason]) + result = NO; + } + else + { + id realDelegate = [SUDelegateProxy class] == [[updater delegate] class] ? [[updater delegate] realDelegate] : [updater delegate]; + result = ![realDelegate respondsToSelector:_cmd] || [realDelegate updater:updater mayShowModalAlert:alertToShow]; + } + + return result; +} + +@end diff --git a/SUUpdater_Private.h b/SUUpdater_Private.h index 0a9edcd5..924c8f2c 100644 --- a/SUUpdater_Private.h +++ b/SUUpdater_Private.h @@ -8,9 +8,19 @@ #import "SUUpdater.h" #import "SUCodeSigningVerifier.h" +#import "SUBasicUpdateDriver.h" @interface SUUpdater (Private) - (BOOL)mayUpdateAndRestart; +- (SUHost *)host; +- (SUBasicUpdateDriver *)driver; + +@end + +@interface NSObject (SUPrivateUpdaterDelegateInformalProtocol) + +- (void)updaterWillStartUpdateProcess:(SUUpdater *)updater; +- (void)updaterDidEndUpdateProcess:(SUUpdater *)updater; @end diff --git a/SUUserInitiatedUpdateDriver.m b/SUUserInitiatedUpdateDriver.m index 276b032b..7bb6359a 100644 --- a/SUUserInitiatedUpdateDriver.m +++ b/SUUserInitiatedUpdateDriver.m @@ -50,7 +50,7 @@ { if (isCanceled) { - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortCanceledByUser]; return; } [self closeCheckingWindow]; @@ -63,17 +63,17 @@ [super abortUpdateWithError:error]; } -- (void)abortUpdate +- (void)abortUpdate:(SUUpdateAbortReason)reason { [self closeCheckingWindow]; - [super abortUpdate]; + [super abortUpdate:reason]; } - (void)appcast:(SUAppcast *)ac failedToLoadWithError:(NSError *)error { if (isCanceled) { - [self abortUpdate]; + [self abortUpdate:SUUpdateAbortCanceledByUser]; return; } [super appcast:ac failedToLoadWithError:error]; diff --git a/Sparkle.h b/Sparkle.h index 08dd5777..1662e7d8 100644 --- a/Sparkle.h +++ b/Sparkle.h @@ -13,6 +13,7 @@ // there are name-space collisions) so we can list all of them to start with: #import +#import #import #import diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index c803f923..1b55118b 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -16,6 +16,9 @@ 3330768F190A5CB8005602B2 /* Sparkle.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61AAE8220A321A7F00D8810D /* Sparkle.strings */; }; 338A79F11919191500EDD837 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; }; 338A79F319193CDC00EDD837 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; + 33C07AAD198B887F0039242D /* SUAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 33C07AAC198B887F0039242D /* SUAppDelegate.m */; }; + 33C3934C198A825600C29D9D /* SUUpdaterQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 33C3934A198A825600C29D9D /* SUUpdaterQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 33C3934D198A825600C29D9D /* SUUpdaterQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 33C3934B198A825600C29D9D /* SUUpdaterQueue.m */; }; 33D081831888446F00394A94 /* libDMCore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 33D081821888446E00394A94 /* libDMCore.a */; }; 3772FEA913DE0B6B00F79537 /* SUVersionDisplayProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; 525A2790133D6AE900FD8D70 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 525A278F133D6AE900FD8D70 /* Cocoa.framework */; }; @@ -251,6 +254,10 @@ 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 3329F06D18FBFBA800556010 /* ResourceRules.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = ResourceRules.plist; sourceTree = ""; }; 33307690190A5D8B005602B2 /* install_service.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = install_service.pch; sourceTree = ""; }; + 33C07AAB198B887F0039242D /* SUAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUAppDelegate.h; sourceTree = ""; }; + 33C07AAC198B887F0039242D /* SUAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUAppDelegate.m; sourceTree = ""; }; + 33C3934A198A825600C29D9D /* SUUpdaterQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdaterQueue.h; sourceTree = ""; }; + 33C3934B198A825600C29D9D /* SUUpdaterQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdaterQueue.m; sourceTree = ""; }; 33CE69761934D1F8009D5956 /* ReleaseNotes.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = ReleaseNotes.rtf; sourceTree = ""; }; 33D081821888446E00394A94 /* libDMCore.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libDMCore.a; path = External/libDMCore.a; sourceTree = ""; }; 3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUVersionDisplayProtocol.h; sourceTree = ""; }; @@ -812,6 +819,8 @@ 61B5F92409C4CFC900B25A18 /* main.m */, 61B5F90409C4CEE200B25A18 /* Test Application-Info.plist */, 618E9CFC0E7328F1004646D8 /* dsa_pub.pem */, + 33C07AAB198B887F0039242D /* SUAppDelegate.h */, + 33C07AAC198B887F0039242D /* SUAppDelegate.m */, ); name = "Test Application Sources"; sourceTree = ""; @@ -854,6 +863,8 @@ 61B5F8E309C4CE3C00B25A18 /* SUUpdater.h */, 6158A1C4137904B300487EC1 /* SUUpdater_Private.h */, 61B5F8E409C4CE3C00B25A18 /* SUUpdater.m */, + 33C3934A198A825600C29D9D /* SUUpdaterQueue.h */, + 33C3934B198A825600C29D9D /* SUUpdaterQueue.m */, 61CFB2C20E38496B007A1735 /* Drivers */, 61CFB2C10E384958007A1735 /* Support */, ); @@ -953,6 +964,7 @@ 61F83F740DBFE141006FDD30 /* SUBasicUpdateDriver.h in Headers */, 61B93A3C0DD02D7000DCD2F8 /* SUUIBasedUpdateDriver.h in Headers */, 61B93B270DD0FDD300DCD2F8 /* SUAutomaticUpdateDriver.h in Headers */, + 33C3934C198A825600C29D9D /* SUUpdaterQueue.h in Headers */, 61B93C090DD112FF00DCD2F8 /* SUScheduledUpdateDriver.h in Headers */, 610134730DD250470049ACDF /* SUUpdateDriver.h in Headers */, 6101347B0DD2541A0049ACDF /* SUProbingUpdateDriver.h in Headers */, @@ -1047,7 +1059,7 @@ name = "Sparkle Unit Tests"; productName = "Sparkle Unit Tests"; productReference = 612279D90DB5470200AB99EA /* Sparkle Unit Tests.octest */; - productType = "com.apple.product-type.bundle"; + productType = "com.apple.product-type.bundle.ocunit-test"; }; 61B5F90109C4CEE200B25A18 /* Sparkle Test App */ = { isa = PBXNativeTarget; @@ -1370,6 +1382,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 33C07AAD198B887F0039242D /* SUAppDelegate.m in Sources */, 61B5F93009C4CFDC00B25A18 /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1393,6 +1406,7 @@ buildActionMask = 2147483647; files = ( 61B5F8EE09C4CE3C00B25A18 /* SUUpdater.m in Sources */, + 33C3934D198A825600C29D9D /* SUUpdaterQueue.m in Sources */, 61B5F8EF09C4CE3C00B25A18 /* SUPlainInstallerInternals.m in Sources */, 61B5FBB709C4FAFF00B25A18 /* SUAppcast.m in Sources */, 61B5FC6F09C51F4900B25A18 /* SUAppcastItem.m in Sources */, diff --git a/Test Application/English.lproj/MainMenu.nib/classes.nib b/Test Application/English.lproj/MainMenu.nib/classes.nib deleted file mode 100644 index 14196291..00000000 --- a/Test Application/English.lproj/MainMenu.nib/classes.nib +++ /dev/null @@ -1,43 +0,0 @@ - - - - - IBClasses - - - CLASS - FirstResponder - LANGUAGE - ObjC - SUPERCLASS - NSObject - - - CLASS - NSObject - LANGUAGE - ObjC - - - ACTIONS - - checkForUpdates - id - - CLASS - SUUpdater - LANGUAGE - ObjC - OUTLETS - - delegate - id - - SUPERCLASS - NSObject - - - IBVersion - 1 - - diff --git a/Test Application/English.lproj/MainMenu.nib/designable.nib b/Test Application/English.lproj/MainMenu.nib/designable.nib index 72437679..909c2225 100644 --- a/Test Application/English.lproj/MainMenu.nib/designable.nib +++ b/Test Application/English.lproj/MainMenu.nib/designable.nib @@ -2,17 +2,25 @@ 1050 - 10A432 - 732 - 1038 - 437.00 + 14A298i + 6185.11 + 1326.11 + 743.00 com.apple.InterfaceBuilder.CocoaPlugin - 732 + 6185.11 - - - + + NSButton + NSButtonCell + NSCustomObject + NSMenu + NSMenuItem + NSTextField + NSTextFieldCell + NSUserDefaultsController + NSView + NSWindowTemplate com.apple.InterfaceBuilder.CocoaPlugin @@ -40,10 +48,10 @@ View - {1.79769e+308, 1.79769e+308} + {213, 107} - + 256 @@ -51,18 +59,19 @@ 268 {{21, 112}, {225, 18}} + YES - -2080244224 + -2080374784 0 Automatically check for updates - LucidaGrande + YES 13 1044 - 1211912703 + 1211912448 2 NSImage @@ -76,20 +85,22 @@ 200 25 + NO 268 {{21, 92}, {228, 18}} + YES - -2080244224 + -2080374784 0 Automatically download updates - 1211912703 + 1211912448 2 @@ -98,20 +109,22 @@ 200 25 + NO 268 {{21, 72}, {224, 18}} + YES - -2080244224 + -2080374784 0 Send system profile information - 1211912703 + 1211912448 2 @@ -120,20 +133,22 @@ 200 25 + NO 268 {{21, 52}, {152, 18}} + YES - -2080244224 + -2080374784 0 Has launched before - 1211912703 + 1211912448 2 @@ -142,21 +157,23 @@ 200 25 + NO 268 {{20, 136}, {106, 17}} + YES - 67239488 + 67108928 272630784 Debug options: - LucidaGrande-Bold + YES 13 - 16 + 2072 @@ -178,15 +195,18 @@ + NO + 1 268 {{17, 20}, {157, 17}} + YES - 68288064 + 68157504 272630784 Check for updates every @@ -194,6 +214,8 @@ + NO + 1 @@ -202,7 +224,7 @@ YES - 68288064 + 68157504 272630784 seconds @@ -210,15 +232,18 @@ + NO + 1 268 {{179, 18}, {56, 22}} + YES - -1804468671 + -1804599231 272630784 @@ -240,14 +265,17 @@ + NO + 1 {313, 173} - + - {{0, 0}, {1680, 1028}} + {{0, 0}, {1680, 1027}} {213, 129} - {1.79769e+308, 1.79769e+308} + {10000000000000, 10000000000000} + YES MainMenu @@ -267,6 +295,7 @@ NSMenuMixedState submenuAction: + NewApplication @@ -327,6 +356,7 @@ submenuAction: + Services @@ -406,6 +436,7 @@ submenuAction: + File @@ -438,6 +469,7 @@ submenuAction: + Open Recent @@ -543,6 +575,7 @@ submenuAction: + Edit @@ -651,6 +684,7 @@ submenuAction: + Find @@ -717,6 +751,7 @@ submenuAction: + Spelling @@ -762,6 +797,7 @@ submenuAction: + Window @@ -818,6 +854,7 @@ submenuAction: + Help @@ -839,12 +876,63 @@ SUUpdater + + SUAppDelegate + YES + + + delegate + + + + 266 + + + + terminate: + + + + 139 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + hideOtherApplications: + + + + 146 + + + + hide: + + + + 152 + + + + unhideAllApplications: + + + + 153 + performMiniaturize: @@ -893,46 +981,6 @@ 127 - - - terminate: - - - - 139 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - hideOtherApplications: - - - - 146 - - - - hide: - - - - 152 - - - - unhideAllApplications: - - - - 153 - cut: @@ -1086,20 +1134,12 @@ 208 - - value: values.SUHasLaunchedBefore - - - - - - value: values.SUHasLaunchedBefore - value - values.SUHasLaunchedBefore - 2 - + + delegate + + - 225 + 267 @@ -1149,6 +1189,22 @@ 261 + + + value: values.SUHasLaunchedBefore + + + + + + value: values.SUHasLaunchedBefore + value + values.SUHasLaunchedBefore + 2 + + + 225 + value: updateCheckInterval @@ -1165,6 +1221,14 @@ 263 + + + updater + + + + 265 + @@ -1752,175 +1816,110 @@ + + 264 + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - {{0, 672}, {313, 173}} com.apple.InterfaceBuilder.CocoaPlugin {{0, 672}, {313, 173}} - - - {213, 107} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{258, 684}, {362, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{270, 481}, {242, 203}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - 263 + 267 @@ -1931,706 +1930,25 @@ - - NSObject - - IBProjectSource - SUAppcast.h - - - - NSObject - - IBProjectSource - SUAutomaticUpdateAlert.h - - - - NSObject - - IBProjectSource - SUInstaller.h - - - - NSObject - - IBProjectSource - SUUnarchiver.h - - - - NSObject - - IBProjectSource - SUUpdateAlert.h - - - - NSObject - - IBProjectSource - SUUpdatePermissionPrompt.h - - - - NSObject - - IBProjectSource - SUUpdater.h - - - - NSObject - - IBUserSource - - - - - SUUpdater - NSObject - - checkForUpdates: - id - - - delegate - id - - - - - SUUpdater - NSObject - - IBUserSource - - - - - - - NSActionCell - NSCell - - IBFrameworkSource - AppKit.framework/Headers/NSActionCell.h - - - - NSApplication - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSApplication.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSApplicationScripting.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSColorPanel.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSHelpManager.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSPageLayout.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSUserInterfaceItemSearching.h - - - - NSBrowser - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSBrowser.h - - - - NSButton - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSButton.h - - - - NSButtonCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSButtonCell.h - - - - NSCell - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSCell.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h - - - - NSController - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSController.h - - - - NSDocument - NSObject - - id - id - id - id - id - id - - - IBFrameworkSource - AppKit.framework/Headers/NSDocument.h - - - - NSDocument - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentScripting.h - - - - NSDocumentController - NSObject - - id - id - id - id - - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentController.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.h - - - - NSMatrix - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSMatrix.h - - - - NSMenu - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenu.h - - - - NSMenuItem - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenuItem.h - - - - NSMovieView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSMovieView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSAccessibility.h - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDictionaryController.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDragging.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontManager.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontPanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSKeyValueBinding.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSNibLoading.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSOutlineView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSPasteboard.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSavePanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSToolbarItem.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSView.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObjectScripting.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPortCoder.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptObjectSpecifiers.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptWhoseTests.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLDownload.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebDownload.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebEditingDelegate.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebFrameLoadDelegate.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebJavaPlugIn.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebPlugin.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebPluginContainer.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebPolicyDelegate.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebResourceLoadDelegate.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebScriptObject.h - - - - NSObject - - IBFrameworkSource - WebKit.framework/Headers/WebUIDelegate.h - - - - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSInterfaceStyle.h - - - - NSResponder - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSResponder.h - - - - NSTableView - NSControl - - - - NSText - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSText.h - - - - NSTextField - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSTextField.h - - - - NSTextFieldCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSTextFieldCell.h - - - - NSUserDefaultsController - NSController - - IBFrameworkSource - AppKit.framework/Headers/NSUserDefaultsController.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSClipView.h - - - - NSView - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSRulerView.h - - - - NSView - NSResponder - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSDrawer.h - - - - NSWindow - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSWindow.h - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSWindowScripting.h - - - - WebView - NSView - - id - id - id - id - id - id - id - id - id - id - id - - - IBFrameworkSource - WebKit.framework/Headers/WebView.h - - 0 + IBCocoaFramework + NO com.apple.InterfaceBuilder.CocoaPlugin.macosx - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + YES - ../../Sparkle.xcodeproj 3 + + {12, 12} + {10, 2} + {15, 15} + diff --git a/Test Application/English.lproj/MainMenu.nib/info.nib b/Test Application/English.lproj/MainMenu.nib/info.nib deleted file mode 100644 index 09d03620..00000000 --- a/Test Application/English.lproj/MainMenu.nib/info.nib +++ /dev/null @@ -1,21 +0,0 @@ - - - - - IBFramework Version - 667 - IBLastKnownRelativeProjectPath - ../../Sparkle.xcodeproj - IBOldestOS - 5 - IBOpenObjects - - 2 - 57 - - IBSystem Version - 9D34 - targetFramework - IBCocoaFramework - - diff --git a/Test Application/English.lproj/MainMenu.nib/keyedobjects.nib b/Test Application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7N()m!xK^d0nh`Y!r> zeRq9!*s(dhF1-<3~w0b80H!l7~V20HY_nLHLNhKGORJYXIN)gZ}`aYvEft0R>O9~ z4#Q5vF2f$fw}$Tx`wRyRhYiOJCk&?yXAI{IKN&6>el}b&Tr=D-+%()a+%eoW+&BDT zcwl&%j?*`%f0Dj6eS7+s>ATYRq<@$GL;C*oL+MA;Po$qtKbL+X{pa+n={M4ErQb=v zm;OikgY<{#kJ6tQk&!e?jWVN`(bp(91{y<*;l?Oqv@y<@U{o7Zj9R1KXf$RTbBt|` zW@9^JM`LGWzOjd~&{$;bXDl|B7>5{b#^J`1#wz1W#yaB|<9OpFBWIjuoMC*`__}e9 zah`FZak23o<8tFF32X|jnkO*Kt7%{0Acdc!owG}koWw9vH3^tS08(=yXa(`wVZ zrnRPZrVmXUOdpvxo3@xfGi@_{Vfxbam1(zWkLg>}Uei9)0n;JV5z}$gNz-Z5S<`vb z1=A(dWz#j&4bx52ucqHj_e{T={xbb-dT4rNdTe@@i*u=5X|62SGuJ1V&6Vc{3Kt}!K4Cs>K4-pQ{@Hxhe8YUp ze8+sx{D=90`Jwqg^HU49P!`(aVez)G7Jo~SCDamOQCMOu@s>nOvPEOjS<)>TmTXHK zORmLg>0rsTbhUK1^tAN0^tBAI46>A3$}PhzBP^pV)s|YzXv;XuM9UP*RLgYBOv^0G zY|C8B0?Q)H63a5nO3NC{TFVEP4VF!ok1d~AKC^7IY`5&N?6mB%d~Ny0@||U`<%s2& z<%H#w<&5Q=f8mTQ(9mYbH_mOGYvmftOZS{_*bvHWZK&+^3b%!;j~Rbr*B zGOMT6+v;oev-(>Dt-;n%Yq&Mis<1{|W3BPlL~D{Y#j3HUS@qU*Yb$G}HQUdi|t&^>sb*lAc>kR8m>uc86t+TCfTIX38Sl_ZPwl1+QwJx`=w633VM$@c#feMt17} diff --git a/finish_installation.m b/finish_installation.m index 59c2ba1f..9dc14ad0 100644 --- a/finish_installation.m +++ b/finish_installation.m @@ -14,65 +14,73 @@ @interface TerminationListener : NSObject { - const char *hostpath; - const char *executablepath; - pid_t parentprocessid; - const char *folderpath; - NSString *selfPath; - NSString *installationPath; - NSTimer *watchdogTimer; - NSTimer *longInstallationTimer; - SUHost *host; - BOOL shouldRelaunch; - BOOL alreadyInstalled; + const char *hostpath; + const char *executablepath; + pid_t parentprocessid; + const char *folderpath; + NSString *selfPath; + NSString *installationPath; + NSTimer *watchdogTimer; + NSTimer *longInstallationTimer; + SUHost *host; + SUFinishUpdateTask finishTasks; } -- (void) parentHasQuit; +- (void)parentHasQuit; -- (void) relaunch; -- (void) install; +- (void)relaunch; +- (void)install; -- (SUHost *) host; +- (SUHost *)host; -- (void) showAppIconInDock:(NSTimer *)aTimer; -- (void) watchdog:(NSTimer *)aTimer; +- (void)showAppIconInDock:(NSTimer *)aTimer; +- (void)watchdog:(NSTimer *)aTimer; @end @implementation TerminationListener -- (id) initWithHostPath:(const char *)inhostpath executablePath:(const char *)execpath parentProcessId:(pid_t)ppid folderPath: (const char*)infolderpath shouldRelaunch:(BOOL)relaunch -selfPath: (NSString*)inSelfPath alreadyInstalled:(BOOL)inalreadyInstalled +- (id)initWithHostPath:(const char *)inhostpath + executablePath:(const char *)execpath + parentProcessId:(pid_t)ppid + folderPath:(const char*)infolderpath + finishTasksMask:(SUFinishUpdateTask)tasks + selfPath:(NSString*)inSelfPath { - if( !(self = [super init]) ) + self = [super init]; + if (nil == self) return nil; - hostpath = inhostpath; - executablepath = execpath; + + hostpath = inhostpath; + executablepath = execpath; parentprocessid = ppid; - folderpath = infolderpath; - selfPath = [inSelfPath retain]; - shouldRelaunch = relaunch; - alreadyInstalled = inalreadyInstalled; + folderpath = infolderpath; + finishTasks = tasks; + selfPath = [inSelfPath retain]; if (NULL != hostpath) { NSString *bundlePath = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:hostpath length:strlen(hostpath)]; NSBundle *theBundle = [NSBundle bundleWithPath:bundlePath]; - host = [[SUHost alloc] initWithBundle: theBundle]; + host = [[SUHost alloc] initWithBundle:theBundle]; } - BOOL alreadyTerminated = (getppid() == 1); // ppid is launchd (1) => parent terminated already + BOOL alreadyTerminated = (getppid() == 1); // ppid is launchd (1) => parent terminated already - if( alreadyTerminated ) + if (alreadyTerminated) + { [self parentHasQuit]; + } else + { watchdogTimer = [[NSTimer scheduledTimerWithTimeInterval:CHECK_FOR_PARENT_TO_QUIT_TIME target:self selector:@selector(watchdog:) userInfo:nil repeats:YES] retain]; + } return self; } --(void) dealloc +- (void)dealloc { [longInstallationTimer invalidate]; [longInstallationTimer release]; @@ -93,20 +101,23 @@ selfPath: (NSString*)inSelfPath alreadyInstalled:(BOOL)inalreadyInstalled } --(void) parentHasQuit +- (void)parentHasQuit { [watchdogTimer invalidate]; - longInstallationTimer = [[NSTimer scheduledTimerWithTimeInterval: LONG_INSTALLATION_TIME - target: self selector: @selector(showAppIconInDock:) - userInfo:nil repeats:NO] retain]; + longInstallationTimer = [[NSTimer scheduledTimerWithTimeInterval:LONG_INSTALLATION_TIME + target:self + selector:@selector(showAppIconInDock:) + userInfo:nil + repeats:NO] + retain]; - if( folderpath && !alreadyInstalled ) + if (folderpath && (SUFinishUpdateWithInstall & finishTasks)) [self install]; else [self relaunch]; } -- (void) watchdog:(NSTimer *)aTimer +- (void)watchdog:(NSTimer *)aTimer { ProcessSerialNumber psn; if (GetProcessForPID(parentprocessid, &psn) == procNotFound) @@ -115,89 +126,91 @@ selfPath: (NSString*)inSelfPath alreadyInstalled:(BOOL)inalreadyInstalled - (void)showAppIconInDock:(NSTimer *)aTimer; { - ProcessSerialNumber psn = { 0, kCurrentProcess }; - TransformProcessType( &psn, kProcessTransformToForegroundApplication ); + ProcessSerialNumber psn = { 0, kCurrentProcess }; + TransformProcessType(&psn, kProcessTransformToForegroundApplication); } - -- (void) relaunch +- (void)relaunch { - if (shouldRelaunch) + if (SUFinishUpdateWithRelaunch & finishTasks) { - NSString *appPath = nil; - if( !folderpath || strcmp(executablepath, hostpath) != 0 ) + NSString *appPath = nil; + if (!folderpath || strcmp(executablepath, hostpath) != 0) appPath = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:executablepath length:strlen(executablepath)]; else appPath = installationPath; - [[NSWorkspace sharedWorkspace] openFile: appPath]; + [[NSWorkspace sharedWorkspace] openFile:appPath]; } if (folderpath) { NSError *theError = nil; - if( ![SUPlainInstaller _removeFileAtPath: [SUInstaller updateFolder] error: &theError] ) - SULog( @"Couldn't remove update folder: %@.", theError ); + if (![SUPlainInstaller _removeFileAtPath:[SUInstaller updateFolder] error:&theError]) + SULog(@"Couldn't remove update folder: %@.", theError); } -#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 - [[NSFileManager defaultManager] removeFileAtPath: selfPath handler: nil]; -#else - [[NSFileManager defaultManager] removeItemAtPath: selfPath error: NULL]; -#endif + [[NSFileManager defaultManager] removeItemAtPath:selfPath error:NULL]; exit(EXIT_SUCCESS); } -- (void) install +- (void)install { + if (0 == (SUFinishUpdateWithInstall & finishTasks)) + return; + installationPath = [[host installationPath] copy]; // Perhaps a poor assumption but: if we're not relaunching, we assume we shouldn't be showing any UI either. Because non-relaunching installations are kicked off without any user interaction, we shouldn't be interrupting them. - if (shouldRelaunch) { - SUStatusController* statusCtl = [[SUStatusController alloc] initWithHost: host]; // We quit anyway after we've installed, so leak this for now. - [statusCtl setButtonTitle: SULocalizedString(@"Cancel Update",@"") target: nil action: Nil isDefault: NO]; - [statusCtl beginActionWithTitle: SULocalizedString(@"Installing update...",@"") - maxProgressValue: 0 statusText: @""]; - [statusCtl showWindow: self]; + if (SUFinishUpdateWithRelaunch & finishTasks) + { + SUStatusController *statusCtl = [[SUStatusController alloc] initWithHost:host]; // We quit anyway after we've installed, so leak this for now. + [statusCtl setButtonTitle:SULocalizedString(@"Cancel Update", @"") target:nil action:nil isDefault:NO]; + [statusCtl beginActionWithTitle:SULocalizedString(@"Installing update...", @"") + maxProgressValue:0 + statusText:@""]; + [statusCtl showWindow:self]; } - [SUInstaller installFromUpdateFolder: [[NSFileManager defaultManager] stringWithFileSystemRepresentation: folderpath length: strlen(folderpath)] - overHost: host - installationPath: installationPath - delegate: self synchronously: NO - versionComparator: [SUStandardVersionComparator defaultComparator]]; + NSString *updateFolder =[[NSFileManager defaultManager] stringWithFileSystemRepresentation:folderpath length:strlen(folderpath)]; + [SUInstaller installFromUpdateFolder:updateFolder + overHost:host + installationPath:installationPath + delegate:self + synchronously:NO + versionComparator:[SUStandardVersionComparator defaultComparator]]; } -- (void) installerFinishedForHost:(SUHost *)aHost +- (void)installerFinishedForHost:(SUHost *)aHost { [self relaunch]; } -- (void) installerForHost:(SUHost *)host failedWithError:(NSError *)error +- (void)installerForHost:(SUHost *)host failedWithError:(NSError *)error { // Perhaps a poor assumption but: if we're not relaunching, we assume we shouldn't be showing any UI either. Because non-relaunching installations are kicked off without any user interaction, we shouldn't be interrupting them. - if (shouldRelaunch) - NSRunAlertPanel( @"", @"%@", @"OK", @"", @"", [error localizedDescription] ); + if (SUFinishUpdateWithRelaunch & finishTasks) + NSRunAlertPanel(@"", @"%@", @"OK", @"", @"", [error localizedDescription]); exit(EXIT_FAILURE); } -- (SUHost *) host +- (SUHost *)host { return host; } @end -int main (int argc, const char * argv[]) +int main(int argc, const char * argv[]) { - if( argc < 5 || argc > 7 ) + if (argc < 6) return EXIT_FAILURE; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; //ProcessSerialNumber psn = { 0, kCurrentProcess }; //TransformProcessType( &psn, kProcessTransformToForegroundApplication ); - [[NSApplication sharedApplication] activateIgnoringOtherApps: YES]; + [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; #if 0 // Cmdline tool NSString* selfPath = nil; @@ -209,19 +222,19 @@ int main (int argc, const char * argv[]) selfPath = [selfPath stringByAppendingPathComponent: [[NSFileManager defaultManager] stringWithFileSystemRepresentation: argv[0] length: strlen(argv[0])]]; } #else - NSString* selfPath = [[NSBundle mainBundle] bundlePath]; + NSString *selfPath = [[NSBundle mainBundle] bundlePath]; #endif [NSApplication sharedApplication]; NSConnection *connection = [[[NSConnection alloc] init] autorelease]; - TerminationListener *listener = [[[TerminationListener alloc] initWithHostPath: (argc > 1) ? argv[1] : NULL - executablePath: (argc > 2) ? argv[2] : NULL - parentProcessId: (argc > 3) ? atoi(argv[3]) : 0 - folderPath: (argc > 4) ? argv[4] : NULL - shouldRelaunch: (argc > 5) ? atoi(argv[5]) : 1 - selfPath: selfPath - alreadyInstalled: (argc > 6) ? atoi(argv[6]) : 0] autorelease]; + TerminationListener *listener = [[[TerminationListener alloc] initWithHostPath:argv[1] + executablePath:argv[2] + parentProcessId:atoi(argv[3]) + folderPath:argv[4] + finishTasksMask:atoi(argv[5]) + selfPath:selfPath] + autorelease]; [connection setRootObject:listener]; if (![connection registerName:[NSString stringWithFormat:@"Sparkle %@", [[[listener host] bundle] bundleIdentifier]]])