Fixes 245991

COMPATIBILITY ISSUE:
Changed updatePreferencesChanged to resetUpdateCycle to give better semantics for bundle-ish apps which need to start the update cycle manually since applicationDidFinishLaunching: won't do the right thing.
This commit is contained in:
Andy Matuschak committed 2008-07-23 20:27:01 -07:00
1 parent c42e3a3f47
commit ac4e4e405b
2 files changed
+8 -9

No files matched your search

+2 -3
View File
@@ -40,9 +40,8 @@
// This forces an update to begin with a particular driver (see SU*UpdateDriver.h)
- (void)checkForUpdatesWithDriver:(SUUpdateDriver *)driver;
// Call this to appropriately reschedule or cancel the update checking timer if preferences for time interval or automatic checks change.
// If you're using a .app, this'll be picked up automatically via NSUserDefaultsController, but for non-.apps, there's no way to observe changes.
- (void)updatePreferencesChanged;
// Call this to appropriately schedule or cancel the update checking timer according to the preferences for time interval and automatic checks.
- (void)resetUpdateCycle;
- (BOOL)updateInProgress;
@end
+6 -6
View File
@@ -117,7 +117,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
BOOL automaticallyCheck = (result == SUAutomaticallyCheck);
[host setBool:automaticallyCheck forUserDefaultsKey:SUEnableAutomaticChecksKey];
// Schedule checks, but make sure we ignore the delayed call from KVO
[self updatePreferencesChanged];
[self resetUpdateCycle];
}
- (void)updateDriverDidFinish:(NSNotification *)note
@@ -206,9 +206,9 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
{
// Allow a small delay, because perhaps the user or developer wants to change both preferences. This allows the developer to interpret a zero check interval as a sign to disable automatic checking.
// Or we may get this from the developer and from our own KVO observation, this will effectively coalesce them.
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(updatePreferencesChanged) object:nil];
[self performSelector:@selector(updatePreferencesChanged) withObject:nil afterDelay:15];
[self updatePreferencesChanged];
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(resetUpdateCycle) object:nil];
[self performSelector:@selector(resetUpdateCycle) withObject:nil afterDelay:15];
[self resetUpdateCycle];
}
else
{
@@ -216,9 +216,9 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
}
}
- (void)updatePreferencesChanged
- (void)resetUpdateCycle
{
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(updatePreferencesChanged) object:nil];
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(resetUpdateCycle) object:nil];
[self scheduleNextUpdateCheck];
}