mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-29 05:24:26 +00:00
Fixes Bug #312381: "Bundles can't ask for permission to update; developers have to hard-code YES for SUEnableAutomaticChecks"
Thanks to Hofman for the patch! Now the update cycle will be started once the SUUpdater instance is instantiated; bundles no longer need to expressly start the update cycle.
This commit is contained in:
1 parent
8ff6c147f2
commit
91c242ac04
1 file changed
+4
-2
+4
-2
@@ -18,6 +18,7 @@
|
||||
|
||||
@interface SUUpdater (Private)
|
||||
- initForBundle:(NSBundle *)bundle;
|
||||
- (void)startUpdateCycle;
|
||||
- (void)checkForUpdatesWithDriver:(SUUpdateDriver *)updateDriver;
|
||||
- (BOOL)automaticallyDownloadsUpdates;
|
||||
- (void)scheduleNextUpdateCheck;
|
||||
@@ -68,6 +69,8 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
|
||||
[sharedUpdaters setObject:self forKey:[NSValue valueWithNonretainedObject:bundle]];
|
||||
host = [[SUHost alloc] initWithBundle:bundle];
|
||||
[self registerAsObserver];
|
||||
// This runs the permission prompt if needed, but never before the app has finished launching because the runloop won't run before that
|
||||
[self performSelector:@selector(startUpdateCycle) withObject:nil afterDelay:0];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -80,7 +83,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
|
||||
|
||||
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [host bundlePath]]; }
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)note
|
||||
- (void)startUpdateCycle
|
||||
{
|
||||
BOOL shouldPrompt = NO;
|
||||
|
||||
@@ -198,7 +201,6 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
|
||||
|
||||
- (void)registerAsObserver
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidFinishLaunching:) name:NSApplicationDidFinishLaunchingNotification object:NSApp];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDriverDidFinish:) name:SUUpdateDriverFinishedNotification object:nil];
|
||||
// No sense observing the shared NSUserDefaultsController when we're not updating the main bundle.
|
||||
if ([host bundle] != [NSBundle mainBundle]) return;
|
||||
|
||||
Reference in new issue
Block a user