diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index cf48657e..0339c7e4 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -736,6 +736,7 @@ 7205C4331E12C23C00E370AE /* ConfigGenerateAppcast.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcast.xcconfig; sourceTree = ""; }; 7205C4341E12C66D00E370AE /* ConfigGenerateAppcastRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcastRelease.xcconfig; sourceTree = ""; }; 7205C4351E12CA7000E370AE /* ConfigGenerateAppcastDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigGenerateAppcastDebug.xcconfig; sourceTree = ""; }; + 720767D01E2E3DD300F9A850 /* AppKitPrevention.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppKitPrevention.h; sourceTree = ""; }; 720B16421C66433D006985FB /* UITests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "UITests-Info.plist"; path = "UITests/UITests-Info.plist"; sourceTree = SOURCE_ROOT; }; 720B16431C66433D006985FB /* SUTestApplicationTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SUTestApplicationTest.swift; path = UITests/SUTestApplicationTest.swift; sourceTree = SOURCE_ROOT; }; 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUUnarchiverTest.swift; sourceTree = ""; }; @@ -1043,6 +1044,7 @@ 1495006D195FBBBD00BC5B5B /* Sparkle */ = { isa = PBXGroup; children = ( + 720767D01E2E3DD300F9A850 /* AppKitPrevention.h */, 61299B3909CB055000B7442F /* Appcast Support */, 55C14BD5136EEFD000649790 /* Autoupdate */, 089C1665FE841158C02AAC07 /* Framework Resources */, diff --git a/Sparkle/AppKitPrevention.h b/Sparkle/AppKitPrevention.h new file mode 100644 index 00000000..0ede52ff --- /dev/null +++ b/Sparkle/AppKitPrevention.h @@ -0,0 +1,20 @@ +// +// AppKitPrevention.h +// Sparkle +// +// Created by Mayur Pawashe on 1/17/17. +// Copyright © 2017 Sparkle Project. All rights reserved. +// + +// #include (not #import) this header to prevent AppKit from being imported +// Note this should be your LAST #include in your implementation file + +// If this error is triggered, you can have Xcode indicate to you which source file including this header caused the issue + +// One may wonder for certain targets where AppKit is banned completely, why just not link AppKit instead. +// Well, Xcode has thing called auto-linking that I don't trust very much. +// Even after trying to disable the setting, I've had targets able to link to AppKit without AppKit being specified in the list of linked libraries. + +#ifdef _APPKITDEFINES_H +#error This is a core or daemon-safe module and should NOT import AppKit +#endif diff --git a/Sparkle/SUAppcast.h b/Sparkle/SUAppcast.h index f4b2aea4..d7363d0a 100644 --- a/Sparkle/SUAppcast.h +++ b/Sparkle/SUAppcast.h @@ -22,7 +22,12 @@ NS_ASSUME_NONNULL_BEGIN SU_EXPORT @interface SUAppcast : NSObject @property (copy, nullable) NSString *userAgentString; + +#if __has_feature(objc_generics) +@property (copy, nullable) NSDictionary *httpHeaders; +#else @property (copy, nullable) NSDictionary *httpHeaders; +#endif - (void)fetchAppcastFromURL:(NSURL *)url inBackground:(BOOL)bg completionBlock:(void (^)(NSError *_Nullable))err; - (SUAppcast *)copyWithoutDeltaUpdates; diff --git a/Sparkle/SUAppcast.m b/Sparkle/SUAppcast.m index 0d280c31..6783684d 100644 --- a/Sparkle/SUAppcast.m +++ b/Sparkle/SUAppcast.m @@ -12,6 +12,9 @@ #import "SULocalizations.h" #import "SUErrors.h" + +#include "AppKitPrevention.h" + @interface NSXMLElement (SUAppcastExtensions) @property (readonly, copy) NSDictionary *attributesAsDictionary; @end @@ -69,7 +72,7 @@ if (self.httpHeaders) { for (NSString *key in self.httpHeaders) { - id value = [self.httpHeaders objectForKey:key]; + NSString *value = [self.httpHeaders objectForKey:key]; [request setValue:value forHTTPHeaderField:key]; } } diff --git a/Sparkle/SUAppcastItem.m b/Sparkle/SUAppcastItem.m index b30c970a..1f9ed7a1 100644 --- a/Sparkle/SUAppcastItem.m +++ b/Sparkle/SUAppcastItem.m @@ -10,6 +10,9 @@ #import "SULog.h" #import "SUConstants.h" + +#include "AppKitPrevention.h" + @interface SUAppcastItem () @property (copy, readwrite) NSString *title; @property (copy, readwrite) NSString *dateString; diff --git a/Sparkle/SUBinaryDeltaApply.m b/Sparkle/SUBinaryDeltaApply.m index eac297b4..ea93b2be 100644 --- a/Sparkle/SUBinaryDeltaApply.m +++ b/Sparkle/SUBinaryDeltaApply.m @@ -15,6 +15,9 @@ #include #include + +#include "AppKitPrevention.h" + static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath) { NSString *patchFile = temporaryFilename(@"apply-binary-delta"); diff --git a/Sparkle/SUBinaryDeltaCommon.m b/Sparkle/SUBinaryDeltaCommon.m index 5f6ce079..42e9d6c0 100644 --- a/Sparkle/SUBinaryDeltaCommon.m +++ b/Sparkle/SUBinaryDeltaCommon.m @@ -18,6 +18,9 @@ #include #include + +#include "AppKitPrevention.h" + int compareFiles(const FTSENT **a, const FTSENT **b) { return strcoll((*a)->fts_name, (*b)->fts_name); diff --git a/Sparkle/SUBinaryDeltaCreate.m b/Sparkle/SUBinaryDeltaCreate.m index 0a8fbc52..b0dfa3ef 100644 --- a/Sparkle/SUBinaryDeltaCreate.m +++ b/Sparkle/SUBinaryDeltaCreate.m @@ -21,6 +21,9 @@ #include #include + +#include "AppKitPrevention.h" + extern int bsdiff(int argc, const char **argv); @interface CreateBinaryDeltaOperation : NSOperation diff --git a/Sparkle/SUBinaryDeltaTool.m b/Sparkle/SUBinaryDeltaTool.m index ea83fdd0..fae14ed1 100644 --- a/Sparkle/SUBinaryDeltaTool.m +++ b/Sparkle/SUBinaryDeltaTool.m @@ -20,6 +20,8 @@ #define VERSION_COMMAND @"version" #define VERSION_ALTERNATE_COMMAND @"--version" +#include "AppKitPrevention.h" + static void printUsage(NSString *programName) { fprintf(stderr, "Usage:\n"); diff --git a/Sparkle/SUBinaryDeltaUnarchiver.m b/Sparkle/SUBinaryDeltaUnarchiver.m index 3863ce10..7dfce787 100644 --- a/Sparkle/SUBinaryDeltaUnarchiver.m +++ b/Sparkle/SUBinaryDeltaUnarchiver.m @@ -13,6 +13,9 @@ #import "SULog.h" #import "SUFileManager.h" + +#include "AppKitPrevention.h" + @interface SUBinaryDeltaUnarchiver () @property (nonatomic, copy, readonly) NSString *archivePath; diff --git a/Sparkle/SUBundleIcon.m b/Sparkle/SUBundleIcon.m index 97e22698..3061c65e 100644 --- a/Sparkle/SUBundleIcon.m +++ b/Sparkle/SUBundleIcon.m @@ -9,6 +9,9 @@ #import "SUBundleIcon.h" #import "SUHost.h" + +#include "AppKitPrevention.h" + @implementation SUBundleIcon // Note: To obtain the most current bundle icon file from the Info dictionary, this should take a SUHost, not a NSBundle diff --git a/Sparkle/SUCodeSigningVerifier.m b/Sparkle/SUCodeSigningVerifier.m index 6f4da51d..17ccf012 100644 --- a/Sparkle/SUCodeSigningVerifier.m +++ b/Sparkle/SUCodeSigningVerifier.m @@ -11,6 +11,9 @@ #import "SUCodeSigningVerifier.h" #import "SULog.h" + +#include "AppKitPrevention.h" + @implementation SUCodeSigningVerifier + (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError *__autoreleasing *)error diff --git a/Sparkle/SUConstants.m b/Sparkle/SUConstants.m index f5e73fda..5e883f6f 100644 --- a/Sparkle/SUConstants.m +++ b/Sparkle/SUConstants.m @@ -13,6 +13,8 @@ #define DEBUG 0 #endif +#include "AppKitPrevention.h" + // Define some minimum intervals to avoid DoS-like checking attacks const NSTimeInterval SUMinimumUpdateCheckInterval = DEBUG ? 60 : (60 * 60); const NSTimeInterval SUDefaultUpdateCheckInterval = DEBUG ? 60 : (60 * 60 * 24); diff --git a/Sparkle/SUDSAVerifier.m b/Sparkle/SUDSAVerifier.m index 9f959f05..a0fa38a9 100644 --- a/Sparkle/SUDSAVerifier.m +++ b/Sparkle/SUDSAVerifier.m @@ -16,6 +16,9 @@ #import "SULog.h" #include + +#include "AppKitPrevention.h" + @implementation SUDSAVerifier { SecKeyRef _secKey; } diff --git a/Sparkle/SUDiskImageUnarchiver.m b/Sparkle/SUDiskImageUnarchiver.m index c2207076..4c1672c6 100644 --- a/Sparkle/SUDiskImageUnarchiver.m +++ b/Sparkle/SUDiskImageUnarchiver.m @@ -10,6 +10,9 @@ #import "SUUnarchiverNotifier.h" #import "SULog.h" + +#include "AppKitPrevention.h" + @interface SUDiskImageUnarchiver () @property (nonatomic, copy, readonly) NSString *archivePath; diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index 26369b63..98800e3a 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -15,6 +15,9 @@ #include #include + +#include "AppKitPrevention.h" + static char SUAppleQuarantineIdentifier[] = "com.apple.quarantine"; static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) { diff --git a/Sparkle/SUGuidedPackageInstaller.m b/Sparkle/SUGuidedPackageInstaller.m index 308b186c..cea993a2 100644 --- a/Sparkle/SUGuidedPackageInstaller.m +++ b/Sparkle/SUGuidedPackageInstaller.m @@ -9,6 +9,9 @@ #import "SUGuidedPackageInstaller.h" #import "SUFileManager.h" + +#include "AppKitPrevention.h" + @interface SUGuidedPackageInstaller () @property (nonatomic, readonly, copy) NSString *packagePath; diff --git a/Sparkle/SUHost.m b/Sparkle/SUHost.m index 659f59b4..13dfe144 100644 --- a/Sparkle/SUHost.m +++ b/Sparkle/SUHost.m @@ -11,6 +11,9 @@ #include // For statfs for isRunningOnReadOnlyVolume #import "SULog.h" + +#include "AppKitPrevention.h" + // This class should not rely on AppKit and should also be process independent // For example, it should not have code that tests writabilty to somewhere on disk, // as that may depend on the privileges of the process owner. Or code that depends on diff --git a/Sparkle/SUInstaller.m b/Sparkle/SUInstaller.m index 4ef9ec50..8a9d8f38 100644 --- a/Sparkle/SUInstaller.m +++ b/Sparkle/SUInstaller.m @@ -15,6 +15,9 @@ #import "SULog.h" #import "SUErrors.h" + +#include "AppKitPrevention.h" + @implementation SUInstaller + (BOOL)isAliasFolderAtPath:(NSString *)path diff --git a/Sparkle/SULog.m b/Sparkle/SULog.m index e500c460..7b8125d6 100644 --- a/Sparkle/SULog.m +++ b/Sparkle/SULog.m @@ -15,20 +15,22 @@ #define STRINGIFY(x) #x #define TO_STRING(x) STRINGIFY(x) +#include "AppKitPrevention.h" + void SULog(SULogLevel level, NSString *format, ...) { static aslclient client; static dispatch_queue_t queue; static dispatch_once_t onceToken; - + static os_log_t logger; static BOOL hasOSLogging; - + dispatch_once(&onceToken, ^{ NSBundle *mainBundle = [NSBundle mainBundle]; - + hasOSLogging = [SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 12, 0}]; - + NSString *mainBundleIdentifier = mainBundle.bundleIdentifier; NSString *bundleIdentifier = (mainBundleIdentifier != nil) ? mainBundleIdentifier : @""SPARKLE_BUNDLE_IDENTIFIER; @@ -44,23 +46,23 @@ void SULog(SULogLevel level, NSString *format, ...) // Act the same way os_log() does; don't log to stderr if a terminal device is attached if (!isatty(STDERR_FILENO)) { options |= ASL_OPT_STDERR; - } + } NSString *displayName = [[NSFileManager defaultManager] displayNameAtPath:mainBundle.bundlePath]; client = asl_open([displayName stringByAppendingString:@" [Sparkle]"].UTF8String, bundleIdentifier.UTF8String, options); queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); - } +} }); - + if (!hasOSLogging && client == NULL) { return; } - + va_list ap; va_start(ap, format); NSString *logMessage = [[NSString alloc] initWithFormat:format arguments:ap]; va_end(ap); - + // Use os_log if available (on 10.12+) if (hasOSLogging) { // We'll make all of our messages formatted as public; just don't log sensitive information. @@ -78,11 +80,11 @@ void SULog(SULogLevel level, NSString *format, ...) // See docs for OS_LOG_TYPE_ERROR os_log_error(logger, "%{public}@", logMessage); break; - } + } #pragma clang diagnostic pop return; - } - +} + // Otherwise use ASL // Make sure we do not async, because if we async, the log may not be delivered deterministically dispatch_sync(queue, ^{ @@ -90,7 +92,7 @@ void SULog(SULogLevel level, NSString *format, ...) if (message == NULL) { return; } - + if (asl_set(message, ASL_KEY_MSG, logMessage.UTF8String) != 0) { return; } diff --git a/Sparkle/SUOperatingSystem.m b/Sparkle/SUOperatingSystem.m index 4a7d73aa..fada18c3 100644 --- a/Sparkle/SUOperatingSystem.m +++ b/Sparkle/SUOperatingSystem.m @@ -7,6 +7,9 @@ #import "SUOperatingSystem.h" + +#include "AppKitPrevention.h" + #if __MAC_OS_X_VERSION_MAX_ALLOWED < 101000 @interface NSProcessInfo () - (NSOperatingSystemVersion)operatingSystemVersion; diff --git a/Sparkle/SUPackageInstaller.m b/Sparkle/SUPackageInstaller.m index 61f3355a..92654742 100644 --- a/Sparkle/SUPackageInstaller.m +++ b/Sparkle/SUPackageInstaller.m @@ -11,6 +11,9 @@ #import "SUErrors.h" #import "SULog.h" + +#include "AppKitPrevention.h" + @interface SUPackageInstaller () @property (nonatomic, readonly, copy) NSString *packagePath; diff --git a/Sparkle/SUPipedUnarchiver.m b/Sparkle/SUPipedUnarchiver.m index d5d7ad4d..3c3e2005 100644 --- a/Sparkle/SUPipedUnarchiver.m +++ b/Sparkle/SUPipedUnarchiver.m @@ -11,6 +11,9 @@ #import "SULog.h" #import "SUErrors.h" + +#include "AppKitPrevention.h" + @interface SUPipedUnarchiver () @property (nonatomic, copy, readonly) NSString *archivePath; diff --git a/Sparkle/SUPlainInstaller.m b/Sparkle/SUPlainInstaller.m index 98ef2c74..81ee5cfd 100644 --- a/Sparkle/SUPlainInstaller.m +++ b/Sparkle/SUPlainInstaller.m @@ -14,6 +14,9 @@ #import "SULog.h" #import "SUErrors.h" + +#include "AppKitPrevention.h" + @interface SUPlainInstaller () @property (nonatomic, readonly) SUHost *host; diff --git a/Sparkle/SUStandardVersionComparator.m b/Sparkle/SUStandardVersionComparator.m index 7bc68181..a2958e82 100644 --- a/Sparkle/SUStandardVersionComparator.m +++ b/Sparkle/SUStandardVersionComparator.m @@ -9,6 +9,9 @@ #import "SUVersionComparisonProtocol.h" #import "SUStandardVersionComparator.h" + +#include "AppKitPrevention.h" + @implementation SUStandardVersionComparator - (instancetype)init diff --git a/Sparkle/SUSystemProfiler.h b/Sparkle/SUSystemProfiler.h index 6223e22e..4bf05472 100644 --- a/Sparkle/SUSystemProfiler.h +++ b/Sparkle/SUSystemProfiler.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @class SUHost; @interface SUSystemProfiler : NSObject -+ (NSArray *)systemProfileArrayForHost:(SUHost *)host; ++ (NSArray *> *)systemProfileArrayForHost:(SUHost *)host; @end diff --git a/Sparkle/SUSystemProfiler.m b/Sparkle/SUSystemProfiler.m index ae2f10f5..1d3c085c 100644 --- a/Sparkle/SUSystemProfiler.m +++ b/Sparkle/SUSystemProfiler.m @@ -9,11 +9,13 @@ #import #import "SUSystemProfiler.h" - #import "SUHost.h" #import "SUOperatingSystem.h" #include + +#include "AppKitPrevention.h" + static NSString *const SUSystemProfilerApplicationNameKey = @"appName"; static NSString *const SUSystemProfilerApplicationVersionKey = @"appVersion"; static NSString *const SUSystemProfilerCPU64bitKey = @"cpu64bit"; @@ -28,19 +30,19 @@ static NSString *const SUSystemProfilerPreferredLanguageKey = @"lang"; @implementation SUSystemProfiler -+ (NSDictionary *)modelTranslationTable ++ (NSDictionary *)modelTranslationTable { // Use explicit class to use the correct bundle even when subclassed NSString *path = [[NSBundle bundleForClass:[SUSystemProfiler class]] pathForResource:@"SUModelTranslation" ofType:@"plist"]; return [[NSDictionary alloc] initWithContentsOfFile:path]; } -+ (NSArray *)systemProfileArrayForHost:(SUHost *)host ++ (NSArray *> *)systemProfileArrayForHost:(SUHost *)host { - NSDictionary *modelTranslation = [self modelTranslationTable]; + NSDictionary *modelTranslation = [self modelTranslationTable]; // Gather profile information and append it to the URL. - NSMutableArray *profileArray = [NSMutableArray array]; + NSMutableArray *> *profileArray = [NSMutableArray array]; NSArray *profileDictKeys = @[@"key", @"displayKey", @"value", @"displayValue"]; int error = 0; int value = 0; diff --git a/Sparkle/SUSystemUpdateInfo.m b/Sparkle/SUSystemUpdateInfo.m index 7ef2dd8f..78325eae 100644 --- a/Sparkle/SUSystemUpdateInfo.m +++ b/Sparkle/SUSystemUpdateInfo.m @@ -11,6 +11,9 @@ #import "SUConstants.h" #import "SUFileManager.h" + +#include "AppKitPrevention.h" + @implementation SUSystemUpdateInfo + (BOOL)systemAllowsAutomaticUpdatesForHost:(SUHost *)host diff --git a/Sparkle/SUUnarchiver.m b/Sparkle/SUUnarchiver.m index 7b808814..9cb33bc6 100644 --- a/Sparkle/SUUnarchiver.m +++ b/Sparkle/SUUnarchiver.m @@ -12,6 +12,9 @@ #import "SUDiskImageUnarchiver.h" #import "SUBinaryDeltaUnarchiver.h" + +#include "AppKitPrevention.h" + @implementation SUUnarchiver + (nullable id )unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword diff --git a/Sparkle/SUUnarchiverNotifier.m b/Sparkle/SUUnarchiverNotifier.m index 727ac7da..643f0eb9 100644 --- a/Sparkle/SUUnarchiverNotifier.m +++ b/Sparkle/SUUnarchiverNotifier.m @@ -10,6 +10,9 @@ #import "SULocalizations.h" #import "SUErrors.h" + +#include "AppKitPrevention.h" + @interface SUUnarchiverNotifier () @property (nonatomic, readonly, copy) void (^completionBlock)(NSError * _Nullable); diff --git a/Sparkle/SUUpdatePermissionResponse.m b/Sparkle/SUUpdatePermissionResponse.m index 02c89acd..203ff151 100644 --- a/Sparkle/SUUpdatePermissionResponse.m +++ b/Sparkle/SUUpdatePermissionResponse.m @@ -8,6 +8,9 @@ #import "SUUpdatePermissionResponse.h" + +#include "AppKitPrevention.h" + @implementation SUUpdatePermissionResponse @synthesize automaticUpdateChecks = _automaticUpdateChecks; diff --git a/Sparkle/SUUpdateValidator.m b/Sparkle/SUUpdateValidator.m index deb8f01d..e00652ef 100644 --- a/Sparkle/SUUpdateValidator.m +++ b/Sparkle/SUUpdateValidator.m @@ -13,6 +13,9 @@ #import "SUHost.h" #import "SULog.h" + +#include "AppKitPrevention.h" + @interface SUUpdateValidator () @property (nonatomic, readonly) SUHost *host; diff --git a/Sparkle/SUUpdater.h b/Sparkle/SUUpdater.h index f627ed14..679f1b79 100644 --- a/Sparkle/SUUpdater.h +++ b/Sparkle/SUUpdater.h @@ -160,7 +160,11 @@ SU_EXPORT @interface SUUpdater : NSObject The keys of this dictionary are HTTP header fields (NSString) and values are corresponding values (NSString) */ +#if __has_feature(objc_generics) +@property (copy) NSDictionary *httpHeaders; +#else @property (copy) NSDictionary *httpHeaders; +#endif /*! A property indicating whether or not the user's system profile information is sent when checking for updates. diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index ca3b8e24..9a951b3b 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -210,7 +210,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults } if (shouldPrompt) { - NSArray *profileInfo = [SUSystemProfiler systemProfileArrayForHost:self.host]; + NSArray *> *profileInfo = [SUSystemProfiler systemProfileArrayForHost:self.host]; // Always say we're sending the system profile here so that the delegate displays the parameters it would send. if ([self.delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)]) { profileInfo = [profileInfo arrayByAddingObjectsFromArray:[self.delegate feedParametersForUpdater:self sendingSystemProfile:YES]]; diff --git a/Sparkle/SUUpdaterDelegate.h b/Sparkle/SUUpdaterDelegate.h index 522764ed..39249ac4 100644 --- a/Sparkle/SUUpdaterDelegate.h +++ b/Sparkle/SUUpdaterDelegate.h @@ -64,7 +64,11 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey; \return An array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user. */ +#if __has_feature(objc_generics) +- (NSArray *> *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile; +#else - (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile; +#endif /*! Returns a custom appcast URL. diff --git a/Tests/Resources/testappcast.xml b/Tests/Resources/testappcast.xml index 287dbda4..c156b310 100644 --- a/Tests/Resources/testappcast.xml +++ b/Tests/Resources/testappcast.xml @@ -7,6 +7,7 @@ desc Sat, 26 Jul 2014 15:20:11 +0000 + diff --git a/Tests/SUAppcastTest.swift b/Tests/SUAppcastTest.swift index c5250a60..5be4507e 100644 --- a/Tests/SUAppcastTest.swift +++ b/Tests/SUAppcastTest.swift @@ -25,19 +25,23 @@ class SUAppcastTest: XCTestCase { XCTAssertEqual("Version 2.0", items[0].title); XCTAssertEqual("desc", items[0].itemDescription); XCTAssertEqual("Sat, 26 Jul 2014 15:20:11 +0000", items[0].dateString) + XCTAssertTrue(items[0].isCriticalUpdate); // This is the best release matching our system version XCTAssertEqual("Version 3.0", items[1].title); XCTAssertNil(items[1].itemDescription); XCTAssertNil(items[1].dateString) + XCTAssertFalse(items[1].isCriticalUpdate); XCTAssertEqual("Version 4.0", items[2].title); XCTAssertNil(items[2].itemDescription); XCTAssertEqual("Sat, 26 Jul 2014 15:20:13 +0000", items[2].dateString) + XCTAssertFalse(items[2].isCriticalUpdate); XCTAssertEqual("Version 5.0", items[3].title); XCTAssertNil(items[3].itemDescription); XCTAssertNil(items[3].dateString) + XCTAssertFalse(items[3].isCriticalUpdate); // Test best appcast item & a delta update item var deltaItem: SUAppcastItem? = nil diff --git a/fileop/SUFileOperationConstants.m b/fileop/SUFileOperationConstants.m index 5ece5917..7476bd6f 100644 --- a/fileop/SUFileOperationConstants.m +++ b/fileop/SUFileOperationConstants.m @@ -8,6 +8,9 @@ #import "SUFileOperationConstants.h" + +#include "AppKitPrevention.h" + char * const SUFileOpRemoveQuarantineCommand = "xattr-d-apple-quarantine"; char * const SUFileOpCopyCommand = "cp"; char * const SUFileOpMoveCommand = "mv"; diff --git a/fileop/fileop.m b/fileop/fileop.m index 044f2abc..9bb54411 100644 --- a/fileop/fileop.m +++ b/fileop/fileop.m @@ -10,6 +10,9 @@ #import "SUFileManager.h" #import "SUFileOperationConstants.h" + +#include "AppKitPrevention.h" + // If we fail, we exit with a unique status code // We don't try to NSLog because the logs can't be seen anywhere, // and we don't want to log to a file irresponsibly (especially as root),