diff --git a/deprecation_notifier/DeprecationNotifier/DNAppDelegate.m b/deprecation_notifier/DeprecationNotifier/DNAppDelegate.m
index f1c860a..ae7e5e7 100644
--- a/deprecation_notifier/DeprecationNotifier/DNAppDelegate.m
+++ b/deprecation_notifier/DeprecationNotifier/DNAppDelegate.m
@@ -39,9 +39,20 @@ @implementation DNAppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSString *expectedVersion = NSLocalizedString(@"expectedVersion", @"");
+ NSString *expectedBuildsStr = NSLocalizedString(@"expectedBuilds", @"");
+ NSArray *expectedBuilds;
+
+ if ([expectedBuildsStr isEqualToString:@"expectedBuilds"]) {
+ // Apparently NSLocalizedStringWithDefaultValue will act exactly like NSLocalizedString
+ // if you attempt to use a default value of nil or empty string. Ugh.
+ expectedBuildsStr = @"";
+ } else {
+ expectedBuilds = [expectedBuildsStr componentsSeparatedByString:@","];
+ }
NSDictionary *systemVersionDictionary = [NSDictionary dictionaryWithContentsOfFile:
@"/System/Library/CoreServices/SystemVersion.plist"];
NSString *systemVersion = systemVersionDictionary[@"ProductVersion"];
+ NSString *systemBuild = systemVersionDictionary[@"ProductBuildVersion"];
NSArray *systemVersionArray = [systemVersion componentsSeparatedByString:@"."];
if (systemVersionArray.count == 2) {
@@ -53,15 +64,38 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
expectedVersionArray = [expectedVersionArray arrayByAddingObject:@"0"];
}
-
+ NSLog(@"Info: System version: %@ %@", systemVersion, systemBuild);
+ NSLog(@"Info: Expected version: %@ %@", expectedVersion, expectedBuildsStr);
if (systemVersionArray.count < 3 || expectedVersionArray.count < 3) {
NSLog(@"Exiting: Error, unable to properly determine system version or expected version");
[NSApp terminate:nil];
+ } else if ([expectedVersionArray[0] intValue] < [systemVersionArray[0] intValue]) {
+ NSLog(@"Exiting: OS is already %@ or greater", expectedVersion);
+ [NSApp terminate:nil];
+ } else if (([expectedVersionArray[0] intValue] <= [systemVersionArray[0] intValue]) &&
+ ([expectedVersionArray[1] intValue] < [systemVersionArray[1] intValue])) {
+ NSLog(@"Exiting: OS is already %@ or greater", expectedVersion);
+ [NSApp terminate:nil];
} else if (([expectedVersionArray[0] intValue] <= [systemVersionArray[0] intValue]) &&
([expectedVersionArray[1] intValue] <= [systemVersionArray[1] intValue]) &&
- ([expectedVersionArray[2] intValue] <= [systemVersionArray[2] intValue])) {
+ ([expectedVersionArray[2] intValue] < [systemVersionArray[2] intValue])) {
NSLog(@"Exiting: OS is already %@ or greater", expectedVersion);
[NSApp terminate:nil];
+ } else if (([expectedVersionArray[0] intValue] == [systemVersionArray[0] intValue]) &&
+ ([expectedVersionArray[1] intValue] == [systemVersionArray[1] intValue]) &&
+ ([expectedVersionArray[2] intValue] == [systemVersionArray[2] intValue])) {
+ NSLog(@"Checking: OS is equal to %@, checking build version", expectedVersion);
+ if (expectedBuilds == nil) {
+ NSLog(@"Exiting: No preferred build, so considered equal to %@", expectedVersion);
+ [NSApp terminate:nil];
+ } else {
+ if ([expectedBuilds containsObject:systemBuild]) {
+ NSLog(@"Exiting: OS build is one of the expected builds [ %@ ]", expectedBuildsStr);
+ [NSApp terminate:nil];
+ } else {
+ NSLog(@"Checking: OS build not found in expected builds [ %@ ]", expectedBuildsStr);
+ }
+ }
}
[[NSUserDefaults standardUserDefaults] synchronize];
diff --git a/deprecation_notifier/DeprecationNotifier/DeprecationNotifier-Info.plist b/deprecation_notifier/DeprecationNotifier/DeprecationNotifier-Info.plist
index ba54766..498439b 100644
--- a/deprecation_notifier/DeprecationNotifier/DeprecationNotifier-Info.plist
+++ b/deprecation_notifier/DeprecationNotifier/DeprecationNotifier-Info.plist
@@ -17,7 +17,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 1.4
+ 1.6
CFBundleSignature
????
LSMinimumSystemVersion