Skip to content

Commit 181c096

Browse files
Simone Manganellirentzsch
Simone Manganelli
authored andcommitted
Allowed host applications that include Sparkle 1.5 or greater to once again allow Sparkle updating of ClickToFlash
Signed-off-by: Jonathan 'Wolf' Rentzsch <[email protected]>
1 parent 53f25ff commit 181c096

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

SparkleManager.m

+9-9
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ + (id)sharedManager {
4343
- (id)init {
4444
self = [super init];
4545
if (self) {
46-
// We can try to update is Sparkle isn't already loaded in our host.
47-
_canUpdate = !objc_getClass("SUUpdater");
46+
_canUpdate = NO;
4847
}
4948
return self;
5049
}
@@ -62,8 +61,6 @@ - (SUUpdater*)_updater {
6261
if (_updater)
6362
return _updater;
6463

65-
NSAssert(_canUpdate, nil);
66-
6764
NSString *frameworksPath = [[NSBundle bundleForClass:[self class]] privateFrameworksPath];
6865
NSAssert(frameworksPath, nil);
6966

@@ -82,10 +79,13 @@ - (SUUpdater*)_updater {
8279
Class updaterClass = objc_getClass("SUUpdater");
8380
NSAssert(updaterClass, nil);
8481

85-
_updater = [updaterClass updaterForBundle:clickToFlashBundle];
86-
NSAssert(_updater, nil);
87-
88-
[_updater setDelegate:self];
82+
if ([updaterClass respondsToSelector:@selector(updaterForBundle:)]) {
83+
_canUpdate = YES;
84+
_updater = [updaterClass updaterForBundle:clickToFlashBundle];
85+
NSAssert(_updater, nil);
86+
87+
[_updater setDelegate:self];
88+
}
8989
}
9090

9191
if (error) NSLog(@"error loading ClickToFlash's Sparkle: %@", error);
@@ -103,8 +103,8 @@ - (void)startAutomaticallyCheckingForUpdates {
103103
if (!checkedForUpdate) {
104104
checkedForUpdate = YES;
105105

106+
SUUpdater *updater = [self _updater];
106107
if (_canUpdate) {
107-
SUUpdater *updater = [self _updater];
108108
[updater checkForUpdatesInBackground];
109109
[updater setAutomaticallyChecksForUpdates:YES];
110110
}

0 commit comments

Comments
 (0)