Mark SPUUpdater with nullability annotations

This commit is contained in:
Zorg committed 2016-08-06 20:47:30 -04:00
1 parent f2713138b9
commit bdd2b7571b
8 files changed
+24 -11

No files matched your search

+8 -4
View File
@@ -14,6 +14,8 @@
#import "SUExport.h"
#import "SPUUserDriver.h"
NS_ASSUME_NONNULL_BEGIN
@class SUAppcastItem, SUAppcast;
@protocol SUUpdaterDelegate;
@@ -43,7 +45,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
*
* This must be called on the main thread.
*/
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle userDriver:(id <SPUUserDriver>)userDriver delegate:(id <SUUpdaterDelegate>)delegate;
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle userDriver:(id <SPUUserDriver>)userDriver delegate:(id<SUUpdaterDelegate> _Nullable)delegate;
/*!
* Starts the updater.
@@ -58,7 +60,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
*/
- (BOOL)startUpdater:(NSError * __autoreleasing *)error;
@property (weak, readonly) id<SUUpdaterDelegate> delegate;
@property (weak, readonly, nullable) id<SUUpdaterDelegate> delegate;
@property (nonatomic, readonly) id<SPUUserDriver> userDriver;
@property (readonly, strong) NSBundle *hostBundle;
@@ -77,7 +79,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
@property (nonatomic, copy) NSString *userAgentString;
@property (copy) NSDictionary *httpHeaders;
@property (copy, nullable) NSDictionary *httpHeaders;
@property (nonatomic) BOOL sendsSystemProfile;
@@ -108,7 +110,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
\returns \c nil if no check has been performed.
*/
@property (readonly, copy) NSDate *lastUpdateCheckDate;
@property (readonly, copy, nullable) NSDate *lastUpdateCheckDate;
/*!
Begins a "probing" check for updates which will not actually offer to
@@ -131,3 +133,5 @@ SU_EXPORT @interface SPUUpdater : NSObject
- (void)resetUpdateCycle;
@end
NS_ASSUME_NONNULL_END
+10 -1
View File
@@ -658,7 +658,16 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
NSString *version = [self.sparkleBundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
NSString *userAgent = [NSString stringWithFormat:@"%@/%@ Sparkle/%@", [self.host name], [self.host displayVersion], version ? version : @"?"];
NSData *cleanedAgent = [userAgent dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
return [[NSString alloc] initWithData:cleanedAgent encoding:NSASCIIStringEncoding];
NSString *result = @"";
if (cleanedAgent != nil) {
NSString *cleanedAgentString = [[NSString alloc] initWithData:(NSData * _Nonnull)cleanedAgent encoding:NSASCIIStringEncoding];
if (cleanedAgentString != nil) {
result = cleanedAgentString;
}
}
return result;
}
- (void)setSendsSystemProfile:(BOOL)sendsSystemProfile
+1 -1
View File
@@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithHost:(SUHost *)host updater:(id)updater updaterDelegate:(nullable id <SUUpdaterDelegate>)updaterDelegate delegate:(nullable id <SUAppcastDriverDelegate>)delegate;
- (void)loadAppcastFromURL:(NSURL *)appcastURL userAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates;
- (void)loadAppcastFromURL:(NSURL *)appcastURL userAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates;
@property (nullable, nonatomic, readonly) SUAppcastItem *nonDeltaUpdateItem;
+1 -1
View File
@@ -52,7 +52,7 @@
return self;
}
- (void)loadAppcastFromURL:(NSURL *)appcastURL userAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates
- (void)loadAppcastFromURL:(NSURL *)appcastURL userAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates
{
self.userAgent = userAgent;
+1 -1
View File
@@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithHost:(SUHost *)host updater:(id)updater updaterDelegate:(nullable id <SUUpdaterDelegate>)updaterDelegate delegate:(id <SUBasicUpdateDriverDelegate>)delegate;
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates completion:(SUUpdateDriverCompletion)completionBlock;
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates completion:(SUUpdateDriverCompletion)completionBlock;
- (void)resumeInstallingUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock;
+1 -1
View File
@@ -56,7 +56,7 @@
return self;
}
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates completion:(SUUpdateDriverCompletion)completionBlock
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates completion:(SUUpdateDriverCompletion)completionBlock
{
self.completionBlock = completionBlock;
+1 -1
View File
@@ -34,7 +34,7 @@
return self;
}
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders completion:(SUUpdateDriverCompletion)completionBlock
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders completion:(SUUpdateDriverCompletion)completionBlock
{
[self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders includesSkippedUpdates:NO completion:completionBlock];
}
+1 -1
View File
@@ -14,7 +14,7 @@ typedef void (^SUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately, SUDow
@protocol SUUpdateDriver <NSObject>
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders completion:(SUUpdateDriverCompletion)completionBlock;
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders completion:(SUUpdateDriverCompletion)completionBlock;
- (void)resumeInstallingUpdateWithCompletion:(SUUpdateDriverCompletion)completionBlock;