From 33907ec4ed8649bfd58a09f01accdd843fd8c071 Mon Sep 17 00:00:00 2001 From: Jerry Krinock Date: Fri, 17 Jun 2016 22:24:43 -0700 Subject: [PATCH] =?UTF-8?q?=E2=80=A2=20In=20SUUpdater.m,=20use=20SULocaliz?= =?UTF-8?q?edString=20macro=20instead=20of=20NSLocalizedString.=20?= =?UTF-8?q?=E2=80=A2=20In=20SUOperatingSystem.m,=20assert=20instead=20of?= =?UTF-8?q?=20test=20for=20nil=20URL.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sparkle/SUOperatingSystem.m | 15 +++++++-------- Sparkle/SUUpdater.m | 16 ++++++++-------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Sparkle/SUOperatingSystem.m b/Sparkle/SUOperatingSystem.m index ada6259b..10993585 100644 --- a/Sparkle/SUOperatingSystem.m +++ b/Sparkle/SUOperatingSystem.m @@ -20,14 +20,13 @@ { NSOperatingSystemVersion version = { 0, 0, 0 }; NSURL *coreServices = [[NSFileManager defaultManager] URLForDirectory:NSCoreServiceDirectory inDomain:NSSystemDomainMask appropriateForURL:nil create:NO error:nil]; - NSURL *url = [coreServices URLByAppendingPathComponent:@"SystemVersion.plist"] ; - if (url) { - NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfURL:url]; - NSArray *components = [ [dictionary objectForKey: @"ProductVersion"] componentsSeparatedByString:@"."]; - version.majorVersion = components.count > 0 ? [ [components objectAtIndex:0] integerValue] : 0; - version.minorVersion = components.count > 1 ? [ [components objectAtIndex:1] integerValue] : 0; - version.patchVersion = components.count > 2 ? [ [components objectAtIndex:2] integerValue] : 0; - } + NSURL *url = [coreServices URLByAppendingPathComponent:@"SystemVersion.plist"]; + assert(url != nil); + NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfURL:url]; + NSArray *components = [ [dictionary objectForKey: @"ProductVersion"] componentsSeparatedByString:@"."]; + version.majorVersion = components.count > 0 ? [ [components objectAtIndex:0] integerValue] : 0; + version.minorVersion = components.count > 1 ? [ [components objectAtIndex:1] integerValue] : 0; + version.patchVersion = components.count > 2 ? [ [components objectAtIndex:2] integerValue] : 0; return version; } #endif diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index 255b2da5..22a71bec 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -128,15 +128,15 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults if (!hasPublicDSAKey) { if (!isMainBundle) { - [self showAlertText:NSLocalizedString(@"Insecure update error!", nil) - informativeText:NSLocalizedString(@"For security reasons, you need to sign your updates with a DSA key. See Sparkle's documentation for more information.", nil)]; + [self showAlertText:SULocalizedString(@"Insecure update error!", nil) + informativeText:SULocalizedString(@"For security reasons, you need to sign your updates with a DSA key. See Sparkle's documentation for more information.", nil)]; } else { if (!hostIsCodeSigned) { - [self showAlertText:NSLocalizedString(@"Insecure update error!", nil) - informativeText:NSLocalizedString(@"For security reasons, you need to code sign your application or sign your updates with a DSA key. See https://sparkle-project.org/documentation/ for more information.", nil)]; + [self showAlertText:SULocalizedString(@"Insecure update error!", nil) + informativeText:SULocalizedString(@"For security reasons, you need to code sign your application or sign your updates with a DSA key. See https://sparkle-project.org/documentation/ for more information.", nil)]; } else if (!servingOverHttps) { - [self showAlertText:NSLocalizedString(@"Insecure update error!", nil) - informativeText:NSLocalizedString(@"For security reasons, you need to serve your updates over HTTPS and/or sign your updates with a DSA key. See https://sparkle-project.org/documentation/ for more information.", nil)]; + [self showAlertText:SULocalizedString(@"Insecure update error!", nil) + informativeText:SULocalizedString(@"For security reasons, you need to serve your updates over HTTPS and/or sign your updates with a DSA key. See https://sparkle-project.org/documentation/ for more information.", nil)]; } } } @@ -145,8 +145,8 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults if (!servingOverHttps) { BOOL atsExceptionsExist = nil != [self.host objectForInfoDictionaryKey:@"NSAppTransportSecurity"]; if (isMainBundle && !atsExceptionsExist) { - [self showAlertText:NSLocalizedString(@"Insecure feed URL is blocked in macOS 10.11", nil) - informativeText:[NSString stringWithFormat:NSLocalizedString(@"You must change the feed URL (%@) to use HTTPS or disable App Transport Security.\n\nFor more information:\nhttps://sparkle-project.org/documentation/app-transport-security/", nil), [feedURL absoluteString]]]; + [self showAlertText:SULocalizedString(@"Insecure feed URL is blocked in macOS 10.11", nil) + informativeText:[NSString stringWithFormat:SULocalizedString(@"You must change the feed URL (%@) to use HTTPS or disable App Transport Security.\n\nFor more information:\nhttps://sparkle-project.org/documentation/app-transport-security/", nil), [feedURL absoluteString]]]; } else if (!isMainBundle) { SULog(@"WARNING: Serving updates over HTTP may be blocked in macOS 10.11. Please change the feed URL (%@) to use HTTPS. For more information:\nhttps://sparkle-project.org/documentation/app-transport-security/", feedURL); }