From b1f9bff9a128e513f4216e4bdf91a79953fc078f Mon Sep 17 00:00:00 2001 From: Zorg Date: Thu, 17 Jun 2021 20:29:33 -0700 Subject: [PATCH 1/3] Pass http headers and user agent when downloading release notes --- Sparkle/SPUUIBasedUpdateDriver.m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Sparkle/SPUUIBasedUpdateDriver.m b/Sparkle/SPUUIBasedUpdateDriver.m index d17cc4df..dc2ce766 100644 --- a/Sparkle/SPUUIBasedUpdateDriver.m +++ b/Sparkle/SPUUIBasedUpdateDriver.m @@ -36,11 +36,11 @@ @synthesize downloadDriver = _downloadDriver; @synthesize completionHandler = _completionHandler; -- (instancetype)initWithReleaseNotesURL:(NSURL *)releaseNotesURL host:(SUHost *)host completionHandler:(void (^)(SPUDownloadData * _Nullable, NSError * _Nullable))completionHandler +- (instancetype)initWithReleaseNotesURL:(NSURL *)releaseNotesURL httpHeaders:(NSDictionary * _Nullable)httpHeaders userAgent:(NSString * _Nullable)userAgent host:(SUHost *)host completionHandler:(void (^)(SPUDownloadData * _Nullable, NSError * _Nullable))completionHandler { self = [super init]; if (self != nil) { - _downloadDriver = [[SPUDownloadDriver alloc] initWithRequestURL:releaseNotesURL host:host userAgent:nil httpHeaders:nil inBackground:NO delegate:self]; + _downloadDriver = [[SPUDownloadDriver alloc] initWithRequestURL:releaseNotesURL host:host userAgent:userAgent httpHeaders:httpHeaders inBackground:NO delegate:self]; _completionHandler = [completionHandler copy]; } else { assert(false); @@ -90,6 +90,8 @@ @property (nonatomic) BOOL resumingInstallingUpdate; @property (nonatomic) BOOL resumingDownloadedUpdate; @property (nonatomic) BOOL preventsInstallerInteraction; +@property (nonatomic, nullable) NSDictionary *httpHeaders; +@property (nonatomic, nullable) NSString *userAgent; @end @@ -106,6 +108,8 @@ @synthesize resumingInstallingUpdate = _resumingInstallingUpdate; @synthesize resumingDownloadedUpdate = _resumingDownloadedUpdate; @synthesize preventsInstallerInteraction = _preventsInstallerInteraction; +@synthesize httpHeaders = _httpHeaders; +@synthesize userAgent = _userAgent; - (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id )userDriver userInitiated:(BOOL)userInitiated updaterDelegate:(nullable id )updaterDelegate delegate:(id)delegate { @@ -137,6 +141,9 @@ - (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background { + self.httpHeaders = httpHeaders; + self.userAgent = userAgent; + [self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:background requiresSilentInstall:NO]; } @@ -269,7 +276,7 @@ if (updateItem.releaseNotesURL != nil && (![updaterDelegate respondsToSelector:@selector(updaterShouldDownloadReleaseNotes:)] || [updaterDelegate updaterShouldDownloadReleaseNotes:self.updater])) { __weak __typeof__(self) weakSelf = self; - self.releaseNotesDriver = [[SPUReleaseNotesDriver alloc] initWithReleaseNotesURL:updateItem.releaseNotesURL host:self.host completionHandler:^(SPUDownloadData * _Nullable downloadData, NSError * _Nullable error) { + self.releaseNotesDriver = [[SPUReleaseNotesDriver alloc] initWithReleaseNotesURL:updateItem.releaseNotesURL httpHeaders:self.httpHeaders userAgent:self.userAgent host:self.host completionHandler:^(SPUDownloadData * _Nullable downloadData, NSError * _Nullable error) { __typeof__(self) strongSelf = weakSelf; id userDriver = strongSelf.userDriver; if (downloadData != nil) { From 25e0de59887d6cbb5a3f5ca9061e76ef6d6bbad0 Mon Sep 17 00:00:00 2001 From: Zorg Date: Fri, 25 Jun 2021 22:17:29 -0700 Subject: [PATCH 2/3] Fix analyzer warnings --- Configurations/ed25519-Shared.xcconfig | 3 +++ Sparkle/Base.lproj/Sparkle.strings | 4 ++++ Sparkle/SPUAutomaticUpdateDriver.m | 2 +- Sparkle/SPUBasicUpdateDriver.h | 2 +- Sparkle/SPUBasicUpdateDriver.m | 6 +++--- Sparkle/SPUCoreBasedUpdateDriver.h | 4 ++-- Sparkle/SPUCoreBasedUpdateDriver.m | 6 +++--- Sparkle/SPUDownloadDriver.m | 2 +- Sparkle/SPUInformationalUpdate.h | 2 +- Sparkle/SPUInformationalUpdate.m | 2 +- Sparkle/SPUProbingUpdateDriver.m | 2 +- Sparkle/SPUStandardUpdaterController.m | 6 +++--- Sparkle/SPUUIBasedUpdateDriver.m | 2 +- Sparkle/SUAppcastDriver.h | 2 +- Sparkle/SUHost.m | 4 ++-- 15 files changed, 28 insertions(+), 21 deletions(-) diff --git a/Configurations/ed25519-Shared.xcconfig b/Configurations/ed25519-Shared.xcconfig index 91faa52d..22d08a7d 100644 --- a/Configurations/ed25519-Shared.xcconfig +++ b/Configurations/ed25519-Shared.xcconfig @@ -12,3 +12,6 @@ ALWAYS_SEARCH_USER_PATHS = NO // Disable Warnings - this is a third-party project, and we'll trust that the maintainers know what they're doing. WARNING_CFLAGS = $(inherited) -Wno-cast-qual -Wno-conversion -Wno-sign-conversion + +// Disable dead stores analyzer warning +CLANG_ANALYZER_DEADCODE_DEADSTORES = NO diff --git a/Sparkle/Base.lproj/Sparkle.strings b/Sparkle/Base.lproj/Sparkle.strings index 4b305e80..86423b2a 100644 --- a/Sparkle/Base.lproj/Sparkle.strings +++ b/Sparkle/Base.lproj/Sparkle.strings @@ -66,6 +66,10 @@ "An important update to %@ is ready to install" = "An important update to %@ is ready to install"; +"Unable to Check For Updates" = "Unable to Check For Updates"; + +"The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version" = "The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version"; + /* the unit for bytes */ "B" = "B"; diff --git a/Sparkle/SPUAutomaticUpdateDriver.m b/Sparkle/SPUAutomaticUpdateDriver.m index 90240adb..34ee64e5 100644 --- a/Sparkle/SPUAutomaticUpdateDriver.m +++ b/Sparkle/SPUAutomaticUpdateDriver.m @@ -83,7 +83,7 @@ SULog(SULogLevelError, @"Error: resumeDownloadedUpdate:completion: called on SPUAutomaticUpdateDriver"); } -- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate +- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate { self.updateItem = updateItem; diff --git a/Sparkle/SPUBasicUpdateDriver.h b/Sparkle/SPUBasicUpdateDriver.h index afe99e8d..f4d791d3 100644 --- a/Sparkle/SPUBasicUpdateDriver.h +++ b/Sparkle/SPUBasicUpdateDriver.h @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @protocol SPUBasicUpdateDriverDelegate -- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)appcastItem secondaryAppcastItem:(SUAppcastItem *)secondaryAppcastItem preventsAutoupdate:(BOOL)preventsAutoupdate systemDomain:(NSNumber * _Nullable)systemDomain; +- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)appcastItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryAppcastItem preventsAutoupdate:(BOOL)preventsAutoupdate systemDomain:(NSNumber * _Nullable)systemDomain; - (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error; diff --git a/Sparkle/SPUBasicUpdateDriver.m b/Sparkle/SPUBasicUpdateDriver.m index c0b2459a..6443cd9b 100644 --- a/Sparkle/SPUBasicUpdateDriver.m +++ b/Sparkle/SPUBasicUpdateDriver.m @@ -79,7 +79,7 @@ } } -- (void)notifyResumableUpdateItem:(SUAppcastItem *)updateItem secondaryUpdateItem:(SUAppcastItem *)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain +- (void)notifyResumableUpdateItem:(SUAppcastItem *)updateItem secondaryUpdateItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain { if (updateItem == nil) { [self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUResumeAppcastError userInfo:@{ NSLocalizedDescriptionKey: SULocalizedString(@"Failed to resume installing update.", nil) }]]; @@ -137,7 +137,7 @@ } } -- (void)notifyFoundValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate systemDomain:(NSNumber * _Nullable)systemDomain +- (void)notifyFoundValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate systemDomain:(NSNumber * _Nullable)systemDomain { if (!self.aborted) { [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification @@ -152,7 +152,7 @@ } } -- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryAppcastItem preventsAutoupdate:(BOOL)preventsAutoupdate +- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryAppcastItem preventsAutoupdate:(BOOL)preventsAutoupdate { [self notifyFoundValidUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryAppcastItem preventsAutoupdate:preventsAutoupdate systemDomain:nil]; } diff --git a/Sparkle/SPUCoreBasedUpdateDriver.h b/Sparkle/SPUCoreBasedUpdateDriver.h index 85805166..f8789ea4 100644 --- a/Sparkle/SPUCoreBasedUpdateDriver.h +++ b/Sparkle/SPUCoreBasedUpdateDriver.h @@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN @protocol SPUCoreBasedUpdateDriverDelegate -- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryAppcastItem preventsAutoupdate:(BOOL)preventsAutoupdate; +- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryAppcastItem preventsAutoupdate:(BOOL)preventsAutoupdate; - (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently; @@ -63,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem inBackground:(BOOL)background; -- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem secondaryUpdate:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate; +- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem secondaryUpdate:(SUAppcastItem * _Nullable)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate; - (void)extractDownloadedUpdate; diff --git a/Sparkle/SPUCoreBasedUpdateDriver.m b/Sparkle/SPUCoreBasedUpdateDriver.m index 551fd2c2..75381ee9 100644 --- a/Sparkle/SPUCoreBasedUpdateDriver.m +++ b/Sparkle/SPUCoreBasedUpdateDriver.m @@ -32,7 +32,7 @@ @property (nonatomic, readonly) SPUInstallerDriver *installerDriver; @property (nonatomic, weak, readonly) id delegate; @property (nonatomic) SUAppcastItem *updateItem; -@property (nonatomic) SUAppcastItem *secondaryUpdateItem; +@property (nonatomic, nullable) SUAppcastItem *secondaryUpdateItem; @property (nonatomic) id resumableUpdate; @property (nonatomic) SPUDownloadedUpdate *downloadedUpdateForRemoval; @@ -149,7 +149,7 @@ } } -- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate systemDomain:(NSNumber * _Nullable)systemDomain +- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate systemDomain:(NSNumber * _Nullable)systemDomain { self.updateItem = updateItem; self.secondaryUpdateItem = secondaryUpdateItem; @@ -225,7 +225,7 @@ [self extractUpdate:downloadedUpdate]; } -- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem secondaryUpdate:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate +- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem secondaryUpdate:(SUAppcastItem * _Nullable)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate { self.resumableUpdate = [[SPUInformationalUpdate alloc] initWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem preventsAutoupdate:preventsAutoupdate]; } diff --git a/Sparkle/SPUDownloadDriver.m b/Sparkle/SPUDownloadDriver.m index 46c449a2..b34bdc32 100644 --- a/Sparkle/SPUDownloadDriver.m +++ b/Sparkle/SPUDownloadDriver.m @@ -28,7 +28,7 @@ @property (nonatomic) id downloader; @property (nonatomic) NSXPCConnection *connection; @property (nonatomic, readonly) SUAppcastItem *updateItem; -@property (nonatomic, readonly) SUAppcastItem *secondaryUpdateItem; +@property (nonatomic, readonly, nullable) SUAppcastItem *secondaryUpdateItem; @property (nonatomic, readonly) SUHost *host; @property (nonatomic, copy) NSString *temporaryDirectory; @property (nonatomic, copy) NSString *downloadName; diff --git a/Sparkle/SPUInformationalUpdate.h b/Sparkle/SPUInformationalUpdate.h index 0d54f99d..9006e9b4 100644 --- a/Sparkle/SPUInformationalUpdate.h +++ b/Sparkle/SPUInformationalUpdate.h @@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN @interface SPUInformationalUpdate : NSObject -- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate; +- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate; @end diff --git a/Sparkle/SPUInformationalUpdate.m b/Sparkle/SPUInformationalUpdate.m index e9eec62f..07de3556 100644 --- a/Sparkle/SPUInformationalUpdate.m +++ b/Sparkle/SPUInformationalUpdate.m @@ -19,7 +19,7 @@ @synthesize secondaryUpdateItem = _secondaryUpdateItem; @synthesize preventsAutoupdate = _preventsAutoupdate; -- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate +- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate { self = [super init]; if (self != nil) { diff --git a/Sparkle/SPUProbingUpdateDriver.m b/Sparkle/SPUProbingUpdateDriver.m index 71257a36..288ee506 100644 --- a/Sparkle/SPUProbingUpdateDriver.m +++ b/Sparkle/SPUProbingUpdateDriver.m @@ -54,7 +54,7 @@ [self.basicDriver resumeUpdate:resumableUpdate completion:completionBlock]; } -- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)__unused appcastItem secondaryAppcastItem:(SUAppcastItem *)__unused secondaryAppcastItem preventsAutoupdate:(BOOL)__unused preventsAutoupdate systemDomain:(NSNumber * _Nullable)__unused systemDomain +- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)__unused appcastItem secondaryAppcastItem:(SUAppcastItem * _Nullable)__unused secondaryAppcastItem preventsAutoupdate:(BOOL)__unused preventsAutoupdate systemDomain:(NSNumber * _Nullable)__unused systemDomain { // Stop as soon as we have an answer [self abortUpdate]; diff --git a/Sparkle/SPUStandardUpdaterController.m b/Sparkle/SPUStandardUpdaterController.m index c8adff8a..03488d51 100644 --- a/Sparkle/SPUStandardUpdaterController.m +++ b/Sparkle/SPUStandardUpdaterController.m @@ -14,6 +14,7 @@ #import "SPUStandardUserDriver.h" #import "SUConstants.h" #import "SULog.h" +#import "SULocalizations.h" #import static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObservationContext"; @@ -76,9 +77,8 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults // Delay the alert four seconds so it doesn't show RIGHT as the app launches, but also doesn't interrupt the user once they really get to work. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ NSAlert *alert = [[NSAlert alloc] init]; - alert.messageText = @"Unable to Check For Updates"; - alert.informativeText = @"The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version."; - [alert addButtonWithTitle:@"OK"]; + alert.messageText = SULocalizedString(@"Unable to Check For Updates", nil); + alert.informativeText = SULocalizedString(@"The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version.", nil); [alert runModal]; }); } diff --git a/Sparkle/SPUUIBasedUpdateDriver.m b/Sparkle/SPUUIBasedUpdateDriver.m index dc2ce766..d11cfa99 100644 --- a/Sparkle/SPUUIBasedUpdateDriver.m +++ b/Sparkle/SPUUIBasedUpdateDriver.m @@ -170,7 +170,7 @@ } } -- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem *)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate +- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem preventsAutoupdate:(BOOL)preventsAutoupdate { if (self.userInitiated) { [SPUSkippedUpdate clearSkippedUpdateForHost:self.host]; diff --git a/Sparkle/SUAppcastDriver.h b/Sparkle/SUAppcastDriver.h index cc142d72..0ef38428 100644 --- a/Sparkle/SUAppcastDriver.h +++ b/Sparkle/SUAppcastDriver.h @@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)didFailToFetchAppcastWithError:(NSError *)error; - (void)didFinishLoadingAppcast:(SUAppcast *)appcast; -- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)appcastItem secondaryAppcastItem:(SUAppcastItem *)secondaryAppcastItem preventsAutoupdate:(BOOL)preventsAutoupdate; +- (void)didFindValidUpdateWithAppcastItem:(SUAppcastItem *)appcastItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryAppcastItem preventsAutoupdate:(BOOL)preventsAutoupdate; - (void)didNotFindUpdateWithLatestAppcastItem:(nullable SUAppcastItem *)latestAppcastItem hostToLatestAppcastItemComparisonResult:(NSComparisonResult)hostToLatestAppcastItemComparisonResult passesMinOSVersion:(BOOL)passesMinOSVersion passesMaxOSVersion:(BOOL)passesMaxOSVersion; @end diff --git a/Sparkle/SUHost.m b/Sparkle/SUHost.m index c3da0893..518039bf 100644 --- a/Sparkle/SUHost.m +++ b/Sparkle/SUHost.m @@ -93,12 +93,12 @@ NS_ASSUME_NONNULL_BEGIN return [self isValidVersion:[self _version]]; } -- (BOOL)isValidVersion:(NSString *)version +- (BOOL)isValidVersion:(NSString * _Nullable)version { return (version != nil && version.length != 0); } -- (NSString *)_version +- (NSString * _Nullable)_version { NSString *version = [self objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey]; return ([self isValidVersion:version] ? version : nil); From 3d8e00eecdd2c3e101e324cd4844c3c231576017 Mon Sep 17 00:00:00 2001 From: Zorg Date: Fri, 25 Jun 2021 22:26:52 -0700 Subject: [PATCH 3/3] Annotate SUAppcastItem initializers as nullable Also mark -init as unavailable. --- Sparkle/SUAppcastItem.h | 6 ++++-- Sparkle/SUAppcastItem.m | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Sparkle/SUAppcastItem.h b/Sparkle/SUAppcastItem.h index b1fce84d..6511c6de 100644 --- a/Sparkle/SUAppcastItem.h +++ b/Sparkle/SUAppcastItem.h @@ -60,9 +60,11 @@ SU_EXPORT @interface SUAppcastItem : NSObject // Returns the dictionary representing the appcast item; this might be useful later for extensions. @property (readonly, copy) NSDictionary *propertiesDictionary; +- (instancetype)init NS_UNAVAILABLE; + // Initializes with data from a dictionary provided by the RSS class. -- (instancetype)initWithDictionary:(NSDictionary *)dict; -- (instancetype)initWithDictionary:(NSDictionary *)dict failureReason:(NSString * _Nullable __autoreleasing *_Nullable)error; +- (nullable instancetype)initWithDictionary:(NSDictionary *)dict; +- (nullable instancetype)initWithDictionary:(NSDictionary *)dict failureReason:(NSString * _Nullable __autoreleasing *_Nullable)error; - (nullable instancetype)initWithDictionary:(NSDictionary *)dict relativeToURL:(NSURL * _Nullable)appcastURL failureReason:(NSString * _Nullable __autoreleasing *_Nullable)error; @end diff --git a/Sparkle/SUAppcastItem.m b/Sparkle/SUAppcastItem.m index 519ff1c7..2874a7a6 100644 --- a/Sparkle/SUAppcastItem.m +++ b/Sparkle/SUAppcastItem.m @@ -214,12 +214,12 @@ static NSString *SUAppcastItemInstallationTypeKey = @"SUAppcastItemInstallationT return self.infoURL && !self.fileURL; } -- (instancetype)initWithDictionary:(NSDictionary *)dict +- (nullable instancetype)initWithDictionary:(NSDictionary *)dict { return [self initWithDictionary:dict relativeToURL:nil failureReason:nil]; } -- (instancetype)initWithDictionary:(NSDictionary *)dict failureReason:(NSString *__autoreleasing *)error +- (nullable instancetype)initWithDictionary:(NSDictionary *)dict failureReason:(NSString *__autoreleasing *)error { return [self initWithDictionary:dict relativeToURL:nil failureReason:error]; }