mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-28 05:14:34 +00:00
Update postponing code is not as bad as I thought
This commit is contained in:
1 parent
1cfbffa74c
commit
480feff34f
1 file changed
+15
-14
Vendored
+15
-14
@@ -31,6 +31,8 @@
|
||||
@property (copy) NSString *tempDir;
|
||||
@property (copy) NSString *relaunchPath;
|
||||
|
||||
@property (nonatomic) BOOL postponedOnce;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SUBasicUpdateDriver
|
||||
@@ -43,6 +45,8 @@
|
||||
@synthesize tempDir;
|
||||
@synthesize relaunchPath;
|
||||
|
||||
@synthesize postponedOnce;
|
||||
|
||||
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)aHost
|
||||
{
|
||||
[super checkForUpdatesAtURL:URL host:aHost];
|
||||
@@ -436,22 +440,19 @@
|
||||
}
|
||||
|
||||
// Give the host app an opportunity to postpone the install and relaunch.
|
||||
#warning this code is broken and uses a static local instead of ivar, and uses installWithToolAndRelaunch: instead of installWithToolAndRelaunch:displayingUserInterface:
|
||||
id<SUUpdaterDelegate> updaterDelegate = [self.updater delegate];
|
||||
|
||||
// static BOOL postponedOnce = NO;
|
||||
// id<SUUpdaterDelegate> updaterDelegate = [self.updater delegate];
|
||||
// if (!postponedOnce && [updaterDelegate respondsToSelector:@selector(updater:shouldPostponeRelaunchForUpdate:untilInvoking:)])
|
||||
// {
|
||||
// NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[self class] instanceMethodSignatureForSelector:@selector(installWithToolAndRelaunch:)]];
|
||||
// [invocation setSelector:@selector(installWithToolAndRelaunch:)];
|
||||
// [invocation setArgument:&relaunch atIndex:2];
|
||||
// [invocation setTarget:self];
|
||||
// postponedOnce = YES;
|
||||
// if ([updaterDelegate updater:self.updater shouldPostponeRelaunchForUpdate:self.updateItem untilInvoking:invocation]) {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
if (!self.postponedOnce && [updaterDelegate respondsToSelector:@selector(updater:shouldPostponeRelaunchForUpdate:untilInvoking:)])
|
||||
{
|
||||
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[[self class] instanceMethodSignatureForSelector:@selector(installWithToolAndRelaunch:)]];
|
||||
[invocation setSelector:@selector(installWithToolAndRelaunch:)];
|
||||
[invocation setArgument:&relaunch atIndex:2];
|
||||
[invocation setTarget:self];
|
||||
self.postponedOnce = YES;
|
||||
if ([updaterDelegate updater:self.updater shouldPostponeRelaunchForUpdate:self.updateItem untilInvoking:invocation]) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ([updaterDelegate respondsToSelector:@selector(updater:willInstallUpdate:)]) {
|
||||
|
||||
Reference in new issue
Block a user