mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-28 05:14:34 +00:00
Allow manual checks when an install on quit update is pending
This commit is contained in:
1 parent
409e7e22bf
commit
7fc9e32ce7
4 files changed
+13
-1
No files matched your search
@@ -19,6 +19,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
|
||||
- (void)showUpdateAlert
|
||||
{
|
||||
isInterruptible = NO;
|
||||
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
|
||||
@@ -69,6 +70,9 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
else
|
||||
{
|
||||
showUpdateAlertTimer = [[NSTimer scheduledTimerWithTimeInterval:SUAutomaticUpdatePromptImpatienceTimer target:self selector:@selector(showUpdateAlert) userInfo:nil repeats:NO] retain];
|
||||
|
||||
// At this point the driver is idle, allow it to be interrupted for user-initiated update checks.
|
||||
isInterruptible = YES;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +130,8 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
||||
break;
|
||||
|
||||
case SUInstallLaterChoice:
|
||||
// No-op: we're already waiting on quit.
|
||||
// We're already waiting on quit, just indicate that we're idle.
|
||||
isInterruptible = YES;
|
||||
break;
|
||||
|
||||
case SUDoNotInstallChoice:
|
||||
|
||||
@@ -21,11 +21,13 @@ extern NSString * const SUUpdateDriverFinishedNotification;
|
||||
NSURL *appcastURL;
|
||||
|
||||
BOOL finished;
|
||||
BOOL isInterruptible;
|
||||
}
|
||||
|
||||
- initWithUpdater:(SUUpdater *)updater;
|
||||
- (void)checkForUpdatesAtURL:(NSURL *)URL host:(SUHost *)host;
|
||||
- (void)abortUpdate;
|
||||
- (BOOL)isInterruptible;
|
||||
- (BOOL)finished;
|
||||
|
||||
@end
|
||||
|
||||
@@ -33,6 +33,8 @@ NSString * const SUUpdateDriverFinishedNotification = @"SUUpdateDriverFinished";
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdateDriverFinishedNotification object:self];
|
||||
}
|
||||
|
||||
- (BOOL)isInterruptible { return isInterruptible; }
|
||||
|
||||
- (BOOL)finished { return finished; }
|
||||
|
||||
- (void)dealloc
|
||||
|
||||
@@ -288,6 +288,9 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault
|
||||
|
||||
- (IBAction)checkForUpdates: (id)sender
|
||||
{
|
||||
if (driver && [driver isInterruptible])
|
||||
[driver abortUpdate];
|
||||
|
||||
[self checkForUpdatesWithDriver:[[[SUUserInitiatedUpdateDriver alloc] initWithUpdater:self] autorelease]];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user