From 181c096da517bfb002fa96045f8edbd8a2fb94f6 Mon Sep 17 00:00:00 2001 From: Simone Manganelli Date: Wed, 22 Apr 2009 14:24:57 +0800 Subject: [PATCH] Allowed host applications that include Sparkle 1.5 or greater to once again allow Sparkle updating of ClickToFlash Signed-off-by: Jonathan 'Wolf' Rentzsch --- SparkleManager.m | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/SparkleManager.m b/SparkleManager.m index 5cc07aa1..1590a086 100644 --- a/SparkleManager.m +++ b/SparkleManager.m @@ -43,8 +43,7 @@ + (id)sharedManager { - (id)init { self = [super init]; if (self) { - // We can try to update is Sparkle isn't already loaded in our host. - _canUpdate = !objc_getClass("SUUpdater"); + _canUpdate = NO; } return self; } @@ -62,8 +61,6 @@ - (SUUpdater*)_updater { if (_updater) return _updater; - NSAssert(_canUpdate, nil); - NSString *frameworksPath = [[NSBundle bundleForClass:[self class]] privateFrameworksPath]; NSAssert(frameworksPath, nil); @@ -82,10 +79,13 @@ - (SUUpdater*)_updater { Class updaterClass = objc_getClass("SUUpdater"); NSAssert(updaterClass, nil); - _updater = [updaterClass updaterForBundle:clickToFlashBundle]; - NSAssert(_updater, nil); - - [_updater setDelegate:self]; + if ([updaterClass respondsToSelector:@selector(updaterForBundle:)]) { + _canUpdate = YES; + _updater = [updaterClass updaterForBundle:clickToFlashBundle]; + NSAssert(_updater, nil); + + [_updater setDelegate:self]; + } } if (error) NSLog(@"error loading ClickToFlash's Sparkle: %@", error); @@ -103,8 +103,8 @@ - (void)startAutomaticallyCheckingForUpdates { if (!checkedForUpdate) { checkedForUpdate = YES; + SUUpdater *updater = [self _updater]; if (_canUpdate) { - SUUpdater *updater = [self _updater]; [updater checkForUpdatesInBackground]; [updater setAutomaticallyChecksForUpdates:YES]; }