diff --git a/SUAppcastItem.h b/SUAppcastItem.h index d1067321..5c91b88c 100644 --- a/SUAppcastItem.h +++ b/SUAppcastItem.h @@ -28,7 +28,7 @@ NSDictionary *deltaUpdates; NSDictionary *propertiesDictionary; - + NSURL *infoURL; // UK 2007-08-31 } @@ -47,6 +47,7 @@ - (NSString *)minimumSystemVersion; - (NSDictionary *)deltaUpdates; - (BOOL)isDeltaUpdate; +- (BOOL)isCriticalUpdate; // Returns the dictionary provided in initWithDictionary; this might be useful later for extensions. - (NSDictionary *)propertiesDictionary; diff --git a/SUAppcastItem.m b/SUAppcastItem.m index 57680557..5a46f2ff 100644 --- a/SUAppcastItem.m +++ b/SUAppcastItem.m @@ -130,6 +130,11 @@ return [[propertiesDictionary objectForKey:@"enclosure"] objectForKey:@"sparkle:deltaFrom"] != nil; } +- (BOOL)isCriticalUpdate +{ + return [[propertiesDictionary objectForKey:@"sparkle:tags"] containsObject:@"sparkle:criticalUpdate"]; +} + - initWithDictionary:(NSDictionary *)dict { return [self initWithDictionary:dict failureReason:nil]; diff --git a/SUAutomaticUpdateAlert.m b/SUAutomaticUpdateAlert.m index f055f48d..65f84bed 100644 --- a/SUAutomaticUpdateAlert.m +++ b/SUAutomaticUpdateAlert.m @@ -60,12 +60,26 @@ - (NSString *)titleText { - return [NSString stringWithFormat:SULocalizedString(@"A new version of %@ is ready to install!", nil), [host name]]; + if ([updateItem isCriticalUpdate]) + { + return [NSString stringWithFormat:SULocalizedString(@"An important update to %@ is ready to install", nil)]; + } + else + { + return [NSString stringWithFormat:SULocalizedString(@"A new version of %@ is ready to install!", nil), [host name]]; + } } - (NSString *)descriptionText { - return [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?", nil), [host name], [updateItem displayVersionString]]; + if ([updateItem isCriticalUpdate]) + { + return [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?", nil), [host name], [updateItem displayVersionString]]; + } + else + { + return [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?", nil), [host name], [updateItem displayVersionString]]; + } } @end diff --git a/SUAutomaticUpdateDriver.m b/SUAutomaticUpdateDriver.m index 7bd9d05b..04ccf170 100644 --- a/SUAutomaticUpdateDriver.m +++ b/SUAutomaticUpdateDriver.m @@ -38,9 +38,16 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2 - (void)unarchiverDidFinish:(SUUnarchiver *)ua { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil]; - - showUpdateAlertTimer = [[NSTimer scheduledTimerWithTimeInterval:SUAutomaticUpdatePromptImpatienceTimer target:self selector:@selector(showUpdateAlert) userInfo:nil repeats:NO] retain]; + // If this is marked as a critical update, we'll prompt the user to install it right away. + if ([updateItem isCriticalUpdate]) + { + [self showUpdateAlert]; + } + else + { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil]; + showUpdateAlertTimer = [[NSTimer scheduledTimerWithTimeInterval:SUAutomaticUpdatePromptImpatienceTimer target:self selector:@selector(showUpdateAlert) userInfo:nil repeats:NO] retain]; + } } - (void)stopUpdatingOnTermination