diff --git a/CHANGELOG b/CHANGELOG index 4f500418..b514cb8d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,9 @@ * Add some Japanese lozalized strings (1024jp) * Made test app available in all languages #695 (LIU Dongyuan / 柳东原) * Removed a test resource from the framework bundle (Karl Moskowski) +* Czech localizations update (Frantisek Erben) +* Test if the updated app is the frontmost one (Zorg) +* UI Tests for the Test Application (Zorg) # 1.13.1 (Jan 31, 2016) diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index af46420f..09957a9d 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -72,8 +72,10 @@ 55C14F9A136F045400649790 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; }; 55C14FC7136F05E100649790 /* Sparkle.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61AAE8220A321A7F00D8810D /* Sparkle.strings */; }; 55E6F33319EC9F6C00005E76 /* SUErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 55E6F33219EC9F6C00005E76 /* SUErrors.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 5A4094481C74EA5200983BE0 /* SUAppcastTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AA4DCD01C73E5510078F128 /* SUAppcastTest.swift */; }; 5A6D31EE1BF53245009C5157 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; }; 5A6D31EF1BF5325F009C5157 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; + 5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */ = {isa = PBXBuildFile; fileRef = 5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */; }; 5AE459001C34118500E3BB47 /* SUUpdaterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 14950074195FDF5900BC5B5B /* SUUpdaterTest.m */; }; 5AE459021C34118500E3BB47 /* SUVersionComparisonTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 61227A150DB548B800AB99EA /* SUVersionComparisonTest.m */; }; 5AF6C74F1AEA46D10014A3AB /* test.sparkle_guided.pkg in Resources */ = {isa = PBXBuildFile; fileRef = 5AF6C74E1AEA46D10014A3AB /* test.sparkle_guided.pkg */; }; @@ -494,6 +496,8 @@ 55C14F05136EF6DB00649790 /* SULog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SULog.m; sourceTree = ""; }; 55C14F31136EFC2400649790 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 55E6F33219EC9F6C00005E76 /* SUErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUErrors.h; sourceTree = ""; }; + 5AA4DCD01C73E5510078F128 /* SUAppcastTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUAppcastTest.swift; sourceTree = ""; }; + 5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testappcast.xml; sourceTree = ""; }; 5AEF45D9189D1CC90030D7DC /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Sparkle.strings; sourceTree = ""; }; 5AF6C74C1AEA40760014A3AB /* SUInstallerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUInstallerTest.m; sourceTree = ""; }; 5AF6C74E1AEA46D10014A3AB /* test.sparkle_guided.pkg */ = {isa = PBXFileReference; lastKnownFileType = file; path = test.sparkle_guided.pkg; sourceTree = ""; }; @@ -919,6 +923,7 @@ F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */, 14958C6C19AEBC610061B14F /* test-pubkey.pem */, 5AF6C74E1AEA46D10014A3AB /* test.sparkle_guided.pkg */, + 5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */, ); path = Resources; sourceTree = ""; @@ -969,6 +974,7 @@ 14958C7019AEBE350061B14F /* Resources */, 72AFC6121B9A944200F6B565 /* Sparkle Unit Tests-Bridging-Header.h */, 612279DA0DB5470200AB99EA /* SparkleTests-Info.plist */, + 5AA4DCD01C73E5510078F128 /* SUAppcastTest.swift */, 142E0E0819A83AAC00E4312B /* SUBinaryDeltaTest.m */, F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */, 5AF9DC3B1981DBEE001EA135 /* SUDSAVerifierTest.m */, @@ -1128,8 +1134,8 @@ 726B2B5E1C645FC900388755 /* UI Tests */ = { isa = PBXGroup; children = ( - 720B16421C66433D006985FB /* UITests-Info.plist */, 720B16431C66433D006985FB /* SUTestApplicationTest.swift */, + 720B16421C66433D006985FB /* UITests-Info.plist */, ); path = "UI Tests"; sourceTree = ""; @@ -1386,7 +1392,7 @@ attributes = { CLASSPREFIX = SU; LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0710; + LastUpgradeCheck = 0720; ORGANIZATIONNAME = "Sparkle Project"; TargetAttributes = { 612279D80DB5470200AB99EA = { @@ -1483,6 +1489,7 @@ F8761EB31ADC50EB000C9034 /* SparkleTestCodeSignApp.zip in Resources */, 14958C6F19AEBC980061B14F /* test-pubkey.pem in Resources */, 5AF6C74F1AEA46D10014A3AB /* test.sparkle_guided.pkg in Resources */, + 5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1648,6 +1655,7 @@ 721CF1A71AD7643600D9AC09 /* bsdiff.c in Sources */, 721CF1A81AD7644100D9AC09 /* bspatch.c in Sources */, 721CF1A91AD7644C00D9AC09 /* sais.c in Sources */, + 5A4094481C74EA5200983BE0 /* SUAppcastTest.swift in Sources */, 72D4DAA11AD7632900B211E2 /* SUBinaryDeltaCreate.m in Sources */, 142E0E0919A83AAC00E4312B /* SUBinaryDeltaTest.m in Sources */, F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */, diff --git a/Sparkle/SUAppcast.m b/Sparkle/SUAppcast.m index dd2b8316..4e81df61 100644 --- a/Sparkle/SUAppcast.m +++ b/Sparkle/SUAppcast.m @@ -93,153 +93,142 @@ - (void)downloadDidFinish:(NSURLDownload *)__unused aDownload { NSError *error = nil; + NSArray *appcastItems = [self parseAppcastItemsFromXMLFile:[NSURL fileURLWithPath:self.downloadFilename] error:&error]; - NSXMLDocument *document = nil; - BOOL failed = NO; - NSArray *xmlItems = nil; - NSMutableArray *appcastItems = [NSMutableArray array]; + [[NSFileManager defaultManager] removeItemAtPath:self.downloadFilename error:nil]; + self.downloadFilename = nil; - if (self.downloadFilename) - { - NSUInteger options = 0; - options = NSXMLNodeLoadExternalEntitiesNever; // Prevent inclusion from file:// - document = [[NSXMLDocument alloc] initWithContentsOfURL:[NSURL fileURLWithPath:self.downloadFilename] options:options error:&error]; - - [[NSFileManager defaultManager] removeItemAtPath:self.downloadFilename error:nil]; - self.downloadFilename = nil; - } - else - { - failed = YES; - } - - if (nil == document) - { - failed = YES; - } - else - { - xmlItems = [document nodesForXPath:@"/rss/channel/item" error:&error]; - if (nil == xmlItems) - { - failed = YES; + if (appcastItems) { + self.items = appcastItems; + self.completionBlock(nil); + self.completionBlock = nil; + } else { + NSMutableDictionary *userInfo = [NSMutableDictionary + dictionaryWithObject: SULocalizedString(@"An error occurred while parsing the update feed.", nil) + forKey: NSLocalizedDescriptionKey]; + if (error) { + userInfo[NSUnderlyingErrorKey] = error; } + [self reportError:[NSError errorWithDomain:SUSparkleErrorDomain + code:SUAppcastParseError + userInfo:userInfo]]; + } +} + +-(NSArray *)parseAppcastItemsFromXMLFile:(NSURL *)appcastFile error:(NSError *__autoreleasing*)errorp { + if (errorp) { + *errorp = nil; } - if (failed == NO) - { + if (!appcastFile) { + return nil; + } - NSEnumerator *nodeEnum = [xmlItems objectEnumerator]; - NSXMLNode *node; + NSUInteger options = NSXMLNodeLoadExternalEntitiesNever; // Prevent inclusion from file:// + NSXMLDocument *document = [[NSXMLDocument alloc] initWithContentsOfURL:appcastFile options:options error:errorp]; + if (nil == document) { + return nil; + } + + NSArray *xmlItems = [document nodesForXPath:@"/rss/channel/item" error:errorp]; + if (nil == xmlItems) { + return nil; + } + + NSMutableArray *appcastItems = [NSMutableArray array]; + NSEnumerator *nodeEnum = [xmlItems objectEnumerator]; + NSXMLNode *node; + + while((node = [nodeEnum nextObject])) { NSMutableDictionary *nodesDict = [NSMutableDictionary dictionary]; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; - while (failed == NO && (node = [nodeEnum nextObject])) - { - // First, we'll "index" all the first-level children of this appcast item so we can pick them out by language later. - if ([[node children] count]) - { - node = [node childAtIndex:0]; - while (nil != node) - { - NSString *name = [node name]; - if (name) - { - NSMutableArray *nodes = nodesDict[name]; - if (nodes == nil) - { - nodes = [NSMutableArray array]; - nodesDict[name] = nodes; - } - [nodes addObject:node]; + // First, we'll "index" all the first-level children of this appcast item so we can pick them out by language later. + if ([[node children] count]) { + node = [node childAtIndex:0]; + while (nil != node) { + NSString *name = [node name]; + if (name) { + NSMutableArray *nodes = nodesDict[name]; + if (nodes == nil) { + nodes = [NSMutableArray array]; + nodesDict[name] = nodes; } - node = [node nextSibling]; + [nodes addObject:node]; } + node = [node nextSibling]; } + } - for (NSString *name in nodesDict) - { - node = [self bestNodeInNodes:nodesDict[name]]; - if ([name isEqualToString:SURSSElementEnclosure]) - { - // enclosure is flattened as a separate dictionary for some reason - NSDictionary *encDict = [(NSXMLElement *)node attributesAsDictionary]; - dict[name] = encDict; - - } - else if ([name isEqualToString:SURSSElementPubDate]) - { - // pubDate is expected to be an NSDate by SUAppcastItem, but the RSS class was returning an NSString - NSString *string = node.stringValue; - if (string) { -#warning This NSDate method is deprecated and doesn't supporte NSSecureCoding... replace it, don't use the date at all, or change the encode/decoding. sigh - //NSDate *date = [NSDate dateWithNaturalLanguageString:string]; - NSDate *date = nil; - if (date) - dict[name] = date; - } - } - else if ([name isEqualToString:SUAppcastElementDeltas]) - { - NSMutableArray *deltas = [NSMutableArray array]; - NSEnumerator *childEnum = [[node children] objectEnumerator]; - for (NSXMLNode *child in childEnum) { - if ([[child name] isEqualToString:SURSSElementEnclosure]) - [deltas addObject:[(NSXMLElement *)child attributesAsDictionary]]; - } - dict[name] = deltas; - } - else if ([name isEqualToString:SUAppcastElementTags]) { - NSMutableArray *tags = [NSMutableArray array]; - NSEnumerator *childEnum = [[node children] objectEnumerator]; - for (NSXMLNode *child in childEnum) { - NSString *childName = child.name; - if (childName) - [tags addObject:childName]; - } - dict[name] = tags; - } - else if (name != nil) - { - // add all other values as strings - NSString *theValue = [[node stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - if (theValue != nil) { - dict[name] = theValue; - } - } - } - - NSString *errString; - SUAppcastItem *anItem = [[SUAppcastItem alloc] initWithDictionary:dict failureReason:&errString]; - if (anItem) - { - [appcastItems addObject:anItem]; + for (NSString *name in nodesDict) { + node = [self bestNodeInNodes:nodesDict[name]]; + if ([name isEqualToString:SURSSElementEnclosure]) { + // enclosure is flattened as a separate dictionary for some reason + NSDictionary *encDict = [(NSXMLElement *)node attributesAsDictionary]; + dict[name] = encDict; } - else - { - SULog(@"Sparkle Updater: Failed to parse appcast item: %@.\nAppcast dictionary was: %@", errString, dict); + else if ([name isEqualToString:SURSSElementPubDate]) { + // pubDate is expected to be an NSDate by SUAppcastItem, but the RSS class was returning an NSString + NSString *string = node.stringValue; + if (string) { + #warning This NSDate method is deprecated and doesn't supporte NSSecureCoding... replace it, don't use the date at all, or change the encode/decoding. sigh + NSDate *date = nil; + //NSDate *date = [NSDate dateWithNaturalLanguageString:string]; + if (date) { + dict[name] = date; + } + } + } + else if ([name isEqualToString:SUAppcastElementDeltas]) { + NSMutableArray *deltas = [NSMutableArray array]; + NSEnumerator *childEnum = [[node children] objectEnumerator]; + for (NSXMLNode *child in childEnum) { + if ([[child name] isEqualToString:SURSSElementEnclosure]) { + [deltas addObject:[(NSXMLElement *)child attributesAsDictionary]]; + } + } + dict[name] = deltas; + } + else if ([name isEqualToString:SUAppcastElementTags]) { + NSMutableArray *tags = [NSMutableArray array]; + NSEnumerator *childEnum = [[node children] objectEnumerator]; + for (NSXMLNode *child in childEnum) { + NSString *childName = child.name; + if (childName) { + [tags addObject:childName]; + } + } + dict[name] = tags; } - [nodesDict removeAllObjects]; - [dict removeAllObjects]; + else if (name != nil) { + // add all other values as strings + NSString *theValue = [[node stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; + if (theValue != nil) { + dict[name] = theValue; + } + } + } + + NSString *errString; + SUAppcastItem *anItem = [[SUAppcastItem alloc] initWithDictionary:dict failureReason:&errString]; + if (anItem) { + [appcastItems addObject:anItem]; + } + else { + SULog(@"Sparkle Updater: Failed to parse appcast item: %@.\nAppcast dictionary was: %@", errString, dict); + if (errorp) *errorp = [NSError errorWithDomain:SUSparkleErrorDomain + code:SUAppcastParseError + userInfo:@{NSLocalizedDescriptionKey: errString}]; + return nil; } } if ([appcastItems count]) { NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"date" ascending:NO]; [appcastItems sortUsingDescriptors:@[sort]]; - self.items = appcastItems; } - if (failed) { - [self reportError:[NSError errorWithDomain:SUSparkleErrorDomain - code:SUAppcastParseError - userInfo:@{ - NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while parsing the update feed.", nil), - NSUnderlyingErrorKey: error ? error : [NSNull null]}]]; - } else { - self.completionBlock(nil); - self.completionBlock = nil; - } + return appcastItems; } - (void)download:(NSURLDownload *)__unused aDownload didFailWithError:(NSError *)error @@ -259,14 +248,18 @@ - (void)reportError:(NSError *)error { - NSURL *failingUrl = error.userInfo[NSURLErrorFailingURLErrorKey]; - - self.completionBlock([NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastError userInfo:@{ + NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred in retrieving update information. Please try again later.", nil), NSLocalizedFailureReasonErrorKey: [error localizedDescription], NSUnderlyingErrorKey: error, - NSURLErrorFailingURLErrorKey: failingUrl ? failingUrl : [NSNull null], - }]); + }]; + + NSURL *failingUrl = error.userInfo[NSURLErrorFailingURLErrorKey]; + if (failingUrl) { + userInfo[NSURLErrorFailingURLErrorKey] = failingUrl; + } + + self.completionBlock([NSError errorWithDomain:SUSparkleErrorDomain code:SUAppcastError userInfo:userInfo]); self.completionBlock = nil; } diff --git a/Sparkle/SUAutomaticUpdateDriver.m b/Sparkle/SUAutomaticUpdateDriver.m index a3a54d82..2e7ad5c9 100644 --- a/Sparkle/SUAutomaticUpdateDriver.m +++ b/Sparkle/SUAutomaticUpdateDriver.m @@ -27,6 +27,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2 @property (assign) BOOL postponingInstallation; @property (assign) BOOL showErrors; @property (assign) BOOL willUpdateOnTermination; +@property (assign) BOOL isTerminating; @property (strong) SUAutomaticUpdateAlert *alert; @property (strong) NSTimer *showUpdateAlertTimer; @@ -37,6 +38,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2 @synthesize postponingInstallation; @synthesize showErrors; @synthesize willUpdateOnTermination; +@synthesize isTerminating; @synthesize alert; @synthesize showUpdateAlertTimer; @@ -132,6 +134,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2 - (void)abortUpdate { + self.isTerminating = NO; [self stopUpdatingOnTermination]; [self invalidateShowUpdateAlertTimer]; [super abortUpdate]; @@ -154,8 +157,6 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2 case SUInstallLaterChoice: self.postponingInstallation = YES; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil]; - [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(systemWillPowerOff:) name:NSWorkspaceWillPowerOffNotification object:nil]; // We're already waiting on quit, just indicate that we're idle. self.interruptible = YES; break; @@ -167,6 +168,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2 } } + - (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI { if (relaunch) { @@ -186,9 +188,22 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2 - (void)applicationWillTerminate:(NSNotification *)__unused note { + // We don't want to terminate the app if the user or someone else initiated a termination + // Use a property instead of passing an argument to installWithToolAndRelaunch: + // because we give the delegate an invocation to our install methods and + // this code was added later :| + self.isTerminating = YES; + [self installWithToolAndRelaunch:NO]; } +- (void)terminateApp +{ + if (!self.isTerminating) { + [super terminateApp]; + } +} + - (void)abortUpdateWithError:(NSError *)error { if (self.showErrors) { diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index d4c57148..b60e09a3 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -329,18 +329,22 @@ if (!failingUrl) { failingUrl = [self.updateItem fileURL]; } - + if ([[self.updater delegate] respondsToSelector:@selector(updater:failedToDownloadUpdate:error:)]) { [[self.updater delegate] updater:self.updater failedToDownloadUpdate:self.updateItem error:error]; } - [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:@{ + NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while downloading the update. Please try again later.", nil), NSUnderlyingErrorKey: error, - NSURLErrorFailingURLErrorKey: failingUrl ? failingUrl : [NSNull null], - }]]; + }]; + if (failingUrl) { + userInfo[NSURLErrorFailingURLErrorKey] = failingUrl; + } + + [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURelaunchError userInfo:userInfo]]; } - (BOOL)download:(NSURLDownload *)__unused download shouldDecodeSourceDataOfMIMEType:(NSString *)encodingType @@ -537,6 +541,7 @@ [self terminateApp]; } +// Note: this is overridden by the automatic update driver to not terminate in some cases - (void)terminateApp { for (NSRunningApplication *runningApplication in [[NSWorkspace sharedWorkspace] runningApplications]) { diff --git a/Sparkle/SUConstants.h b/Sparkle/SUConstants.h index b717d843..ae9beae1 100644 --- a/Sparkle/SUConstants.h +++ b/Sparkle/SUConstants.h @@ -50,6 +50,7 @@ extern NSString *const SULastProfileSubmitDateKey; extern NSString *const SUPromptUserOnFirstLaunchKey; extern NSString *const SUKeepDownloadOnFailedInstallKey; extern NSString *const SUDefaultsDomainKey; +extern NSString *const SUEnableJavaScriptKey; extern NSString *const SUFixedHTMLDisplaySizeKey __attribute__((deprecated("This key is obsolete and has no effect."))); extern NSString *const SUAppendVersionNumberKey __attribute__((deprecated("This key is obsolete. See SPARKLE_APPEND_VERSION_NUMBER."))); extern NSString *const SUEnableAutomatedDowngradesKey __attribute__((deprecated("This key is obsolete. See SPARKLE_AUTOMATED_DOWNGRADES."))); diff --git a/Sparkle/SUConstants.m b/Sparkle/SUConstants.m index 31c80ca3..dbaefe13 100644 --- a/Sparkle/SUConstants.m +++ b/Sparkle/SUConstants.m @@ -42,6 +42,7 @@ NSString *const SUEnableAutomaticChecksKeyOld = @"SUCheckAtStartup"; NSString *const SUSendProfileInfoKey = @"SUSendProfileInfo"; NSString *const SULastProfileSubmitDateKey = @"SULastProfileSubmissionDate"; NSString *const SUPromptUserOnFirstLaunchKey = @"SUPromptUserOnFirstLaunch"; +NSString *const SUEnableJavaScriptKey = @"SUEnableJavaScript"; NSString *const SUFixedHTMLDisplaySizeKey = @"SUFixedHTMLDisplaySize"; NSString *const SUKeepDownloadOnFailedInstallKey = @"SUKeepDownloadOnFailedInstall"; NSString *const SUDefaultsDomainKey = @"SUDefaultsDomain"; diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index 3433299d..08ccc755 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -122,6 +122,8 @@ self.releaseNotesView.preferencesIdentifier = SUBundleIdentifier; WebPreferences *prefs = [self.releaseNotesView preferences]; prefs.plugInsEnabled = NO; + prefs.javaEnabled = NO; + prefs.javaScriptEnabled = [self.host boolForInfoDictionaryKey:SUEnableJavaScriptKey]; self.releaseNotesView.frameLoadDelegate = self; self.releaseNotesView.policyDelegate = self; diff --git a/Sparkle/cs.lproj/SUAutomaticUpdateAlert.xib b/Sparkle/cs.lproj/SUAutomaticUpdateAlert.xib index 1b2be43d..0c30faaa 100644 --- a/Sparkle/cs.lproj/SUAutomaticUpdateAlert.xib +++ b/Sparkle/cs.lproj/SUAutomaticUpdateAlert.xib @@ -1,7 +1,7 @@ - + - + @@ -24,7 +24,6 @@ - @@ -33,7 +32,6 @@ - @@ -46,7 +44,6 @@ - @@ -57,10 +54,9 @@ + + - - - diff --git a/Sparkle/cs.lproj/SUUpdateAlert.xib b/Sparkle/cs.lproj/SUUpdateAlert.xib index afa0cf85..417f2517 100644 --- a/Sparkle/cs.lproj/SUUpdateAlert.xib +++ b/Sparkle/cs.lproj/SUUpdateAlert.xib @@ -1,8 +1,8 @@ - + - - + + @@ -26,7 +26,7 @@ - + @@ -40,7 +40,6 @@ - @@ -51,7 +50,6 @@ - @@ -61,13 +59,12 @@ - + - @@ -88,7 +85,6 @@ - @@ -101,7 +97,6 @@ - @@ -110,7 +105,6 @@ - @@ -127,7 +121,6 @@ - @@ -150,14 +143,12 @@ - - @@ -149,13 +140,12 @@ Gw - - Informace z anonymního systémového profilu pomáhají vývojářům lépe plánovat budoucí vývoj aplikace -Obraťte se na nás v případě, že budete mít k němu nějaký dotaz. + Informace z anonymního systémového profilu pomáhají vývojářům lépe plánovat budoucí vývoj aplikace. +Budete-li mít nějaký dotaz, obraťte se na nás. -Tyto informace by měli být odeslány: +Tyto informace by měly být odeslány: @@ -165,12 +155,11 @@ Tyto informace by měli být odeslány: - + - @@ -210,23 +199,18 @@ Tyto informace by měli být odeslány: - - - diff --git a/Sparkle/cs.lproj/Sparkle.strings b/Sparkle/cs.lproj/Sparkle.strings index 0cf3adb4..251d007f 100644 --- a/Sparkle/cs.lproj/Sparkle.strings +++ b/Sparkle/cs.lproj/Sparkle.strings @@ -1,6 +1,6 @@ "%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ byl instalován a je připraven k použití po příštím spuštění. Přejete si aplikaci %1$@ nyní nainstalovat a znovu spustit?"; -"%1$@ can't be updated when it's running from a read-only volume like a disk image or an optical drive. Move %1$@ to your Applications folder, relaunch it from there, and try again." = "Aplikace %1$@ nemůže být aktualizována, protože je spuštěna z nezapisovatelného média. Může to být CD/DVD-ROM, obraz disku nebo jen nemáte právo zápisu na disk. Přesuňte aplikaci %1$@ do vaší složky Aplikace, spusťte ji z tohoto umístěni znovu."; +"%1$@ can't be updated when it's running from a read-only volume like a disk image or an optical drive. Move %1$@ to your Applications folder, relaunch it from there, and try again." = "Aplikace %1$@ nemůže být aktualizována, protože je spuštěna z média na které nelze zapisovat. Může to být CD/DVD-ROM, obraz disku nebo jen nemáte právo zápisu na disk. Přesuňte aplikaci %1$@ do vaší složky Aplikace, spusťte ji z tohoto umístěni znovu."; "%@ %@ is currently the newest version available." = "%1$@ %2$@ je nejnovější dostupná verze"; @@ -8,7 +8,7 @@ "%@ %@ is now available--you have %@. Would you like to download it now?" = "Je k dispozici %1$@ %2$@ - máte %3$@. Přejete si nyní zkopírovat aktualizaci?"; /* Description text for SUUpdateAlert when the update informational with no download. */ -"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ is now available--you have %3$@. Would you like to learn more about this update on the web?"; +"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ je nyní k dispozici – vy máte %3$@. Přejete si zobrazit o této aktualizaci další informace?"; "%@ downloaded" = "zkopírováno %@"; @@ -24,7 +24,7 @@ "An error occurred while extracting the archive. Please try again later." = "Při rozbalování archivu se vyskytla chyba. Zkuste to prosím později."; -"An error occurred while installing the update. Please try again later." = "Při instalování aktualizace se vyskytla chyba. Zkuste to prosím později."; +"An error occurred while installing the update. Please try again later." = "Při instalaci aktualizace se vyskytla chyba. Zkuste to prosím později."; "An error occurred while parsing the update feed." = "Při zpracovávání údajů o aktualizaci se vyskytla chyba. Zkuste to prosím později."; diff --git a/Tests/Resources/testappcast.xml b/Tests/Resources/testappcast.xml new file mode 100644 index 00000000..0023508e --- /dev/null +++ b/Tests/Resources/testappcast.xml @@ -0,0 +1,17 @@ + + + + For unit test only + + Version 2.0 + desc + Sat, 26 Jul 2014 15:20:11 +0000 + + + + Version 3.0 + Sat, 26 Jul 2014 15:20:12 +0000 + + + + diff --git a/Tests/SUAppcastTest.swift b/Tests/SUAppcastTest.swift new file mode 100644 index 00000000..5f39f795 --- /dev/null +++ b/Tests/SUAppcastTest.swift @@ -0,0 +1,34 @@ +// +// SUAppcastTest.swift +// Sparkle +// +// Created by Kornel on 17/02/2016. +// Copyright © 2016 Sparkle Project. All rights reserved. +// + +import XCTest +import Sparkle; + +class SUAppcastTest: XCTestCase { + + func testExample() { + let appcast = SUAppcast(); + let testFile = NSBundle(forClass: SUAppcastTest.self).pathForResource("testappcast", ofType: "xml")!; + let testFileUrl = NSURL(fileURLWithPath: testFile); + XCTAssertNotNil(testFileUrl); + + do { + let items = try appcast.parseAppcastItemsFromXMLFile(testFileUrl) as! [SUAppcastItem]; + + XCTAssertEqual(2, items.count); + XCTAssertEqual("Version 3.0", items[0].title); + XCTAssertNil(items[0].itemDescription); + + XCTAssertEqual("Version 2.0", items[1].title); + XCTAssertEqual("desc", items[1].itemDescription); + } catch let err as NSError { + NSLog("%@", err); + XCTFail(err.localizedDescription); + } + } +} diff --git a/Tests/Sparkle Unit Tests-Bridging-Header.h b/Tests/Sparkle Unit Tests-Bridging-Header.h index ab678027..512f4a58 100644 --- a/Tests/Sparkle Unit Tests-Bridging-Header.h +++ b/Tests/Sparkle Unit Tests-Bridging-Header.h @@ -6,6 +6,8 @@ #import "SUPipedUnarchiver.h" #import "SUBinaryDeltaCommon.h" #import "SUFileManager.h" +#import "SUAppcast.h" +#import "SUAppcastItem.h" // Duplicated to avoid exporting a private symbol from SUFileManager static const char *SUAppleQuarantineIdentifier = "com.apple.quarantine"; @@ -20,3 +22,9 @@ static const char *SUAppleQuarantineIdentifier = "com.apple.quarantine"; - (BOOL)_makeDirectoryAtURL:(NSURL *)url error:(NSError * __autoreleasing *)error; @end + + +@interface SUAppcast (Private) +- (NSArray *)parseAppcastItemsFromXMLFile:(NSURL *)appcastFile error:(NSError *__autoreleasing*)errorp; +@end +