Skip to content

Commit

Permalink
Add Nullability Specifiers (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
markpokornycos authored Jan 16, 2019
1 parent 9e65855 commit adb37b5
Show file tree
Hide file tree
Showing 90 changed files with 443 additions and 382 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the LaunchDarkly iOS SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).

## [2.14.2] - 2019-01-15
### Added
- Added nullability specifiers to public SDK classes.

## [2.14.1] - 2018-12-21
### Changed
- Added copy methods to several objects involved in creating a summary event.
Expand Down
5 changes: 4 additions & 1 deletion Darkly/DataModels/DarklyConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#import <Foundation/Foundation.h>


/*!
* @brief Enum for setting up log output level.
* @since 4.2.0
Expand All @@ -17,6 +16,8 @@ typedef enum {
DarklyLogLevelAll //Highest level, outputs all events
} DarklyLogLevel;

NS_ASSUME_NONNULL_BEGIN

extern NSString * const kClientVersion;
extern NSString * const kLDPrimaryEnvironmentName;
extern NSString * const kBaseUrl;
Expand Down Expand Up @@ -51,6 +52,8 @@ extern NSString *const kLDBackgroundFetchInitiated;
extern NSString *const kLDNotificationUserInfoKeyMobileKey;
extern NSString *const kLDNotificationUserInfoKeyFlagKeys;

NS_ASSUME_NONNULL_END

extern int const kCapacity;
extern int const kConnectionTimeout;
extern int const kDefaultFlushInterval;
Expand Down
2 changes: 1 addition & 1 deletion Darkly/DataModels/DarklyConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#import "DarklyConstants.h"

NSString * const kClientVersion = @"2.14.1";
NSString * const kClientVersion = @"2.14.2";
NSString * const kLDPrimaryEnvironmentName = @"LaunchDarkly.EnvironmentName.Primary";
NSString * const kBaseUrl = @"https://app.launchdarkly.com";
NSString * const kEventsUrl = @"https://mobile.launchdarkly.com";
Expand Down
36 changes: 20 additions & 16 deletions Darkly/DataModels/LDConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface LDConfig : NSObject

/**
This is the mobile key retrieved from the LaunchDarkly account settings.
*/
@property (nonatomic, readonly, nonnull) NSString* mobileKey;
@property (nonatomic, readonly) NSString* mobileKey;

/**
These are the names and mobile keys for secondary environments to use in the SDK. The
Expand Down Expand Up @@ -120,19 +122,19 @@
@param mobileKey The mobileKey retrieved from the LaunchDarkly account settings.
@return An instance of LDConfig object.
*/
- (instancetype _Nonnull)initWithMobileKey:(nonnull NSString *)mobileKey NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithMobileKey:(NSString *)mobileKey NS_DESIGNATED_INITIALIZER;
- (BOOL)isFlagRetryStatusCode:(NSInteger)statusCode;
-(NSString*)secondaryMobileKeysDescription;
- (instancetype _Nonnull )init NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;

@end

__deprecated_msg("Use LDConfig instead")
@interface LDConfigBuilder : NSObject

@property (nonatomic, strong, nonnull) LDConfig *config;
@property (nonatomic, strong) LDConfig *config;

- (instancetype _Nonnull )init;
- (instancetype)init;

/**
* Provide an mobileKey to the configuration builder. This is the mobileKey
Expand All @@ -141,23 +143,23 @@ __deprecated_msg("Use LDConfig instead")
* @param mobileKey the mobileKey for the configuration
* @return the configuration builder
*/
- (LDConfigBuilder *_Nonnull)withMobileKey:(NSString *_Nonnull)mobileKey __deprecated_msg("Use `setMobileKey:` on an LDConfig object");
- (LDConfigBuilder *)withMobileKey:(NSString *)mobileKey __deprecated_msg("Use `setMobileKey:` on an LDConfig object");
/**
* Provide the baseUrl of the LaunchDarkly server. This will allow you
* to switch between production and staging environments. (Optional)
*
* @param baseUrl the baseUrl of the server
* @return the configuration builder
*/
- (LDConfigBuilder *_Nonnull)withBaseUrl:(NSString *_Nullable)baseUrl __deprecated_msg("Use `setBaseUrl:` on an LDConfig object");
- (LDConfigBuilder *)withBaseUrl:(NSString *)baseUrl __deprecated_msg("Use `setBaseUrl:` on an LDConfig object");
/**
* Provide the eventsUrl of the LaunchDarkly server. This will allow you
* to switch between production and staging environments. (Optional)
*
* @param eventsUrl the eventsUrl of the server
* @return the configuration builder
*/
- (LDConfigBuilder *_Nonnull)withEventsUrl:(NSString *_Nullable)eventsUrl __deprecated_msg("Use `setEventsUrl:` on an LDConfig object");
- (LDConfigBuilder *)withEventsUrl:(nullable NSString *)eventsUrl __deprecated_msg("Use `setEventsUrl:` on an LDConfig object");
/**
* Provide the capacity for storing feature flag and custom events. Events
* are persisted on the client and then synced to the server on a regular
Expand All @@ -168,54 +170,56 @@ __deprecated_msg("Use LDConfig instead")
* @param capacity the number of events to store
* @return the configuration builder
*/
- (LDConfigBuilder *_Nonnull)withCapacity:(int)capacity __deprecated_msg("Use `setCapacity:` on an LDConfig object");
- (LDConfigBuilder *)withCapacity:(int)capacity __deprecated_msg("Use `setCapacity:` on an LDConfig object");
/**
* The connection timeout to be used when syncing to the LaunchDarkly
* server. The default is 10 seconds. (Optional)
*
* @param connectionTimeout timeout for network connections in seconds
* @return the configuration builder
*/
- (LDConfigBuilder *_Nonnull)withConnectionTimeout:(int)connectionTimeout __deprecated_msg("Use `setConnectionTimeout:` on an LDConfig object");
- (LDConfigBuilder *)withConnectionTimeout:(int)connectionTimeout __deprecated_msg("Use `setConnectionTimeout:` on an LDConfig object");
/**
* The interval at which events are synced to the server. The default
* is 30 seconds for streaming mode; in polling mode, the flush interval defaults to the polling interval. (Optional)
*
* @param flushInterval the flush interval in seconds
* @return the configuration builder
*/
- (LDConfigBuilder *_Nonnull)withFlushInterval:(int)flushInterval __deprecated_msg("Use `setFlushInterval:` on an LDConfig object");
- (LDConfigBuilder *)withFlushInterval:(int)flushInterval __deprecated_msg("Use `setFlushInterval:` on an LDConfig object");
/**
* Set the polling interval (in seconds) for polling mode only. An interval
* less than 300 is set to the minimum (5 minutes). The default is 5 minutes. (Optional)
*
* @param pollingInterval the polling interval in seconds
* @return the configuration builder
*/
- (LDConfigBuilder *_Nonnull)withPollingInterval:(int)pollingInterval __deprecated_msg("Use `setPollingInterval:` on an LDConfig object");
- (LDConfigBuilder *)withPollingInterval:(int)pollingInterval __deprecated_msg("Use `setPollingInterval:` on an LDConfig object");
/**
* Set the background fetch interval (in seconds) for background fetch. An interval
* less than 900 is set to the minimum (15 minutes). The default is 60 minutes. (Optional)
*
* @param backgroundFetchInterval the background fetch interval in seconds
* @return the configuration builder
*/
- (LDConfigBuilder *_Nonnull)withBackgroundFetchInterval:(int)backgroundFetchInterval __deprecated_msg("Use `setBackgroundFetchInterval:` on an LDConfig object");
- (LDConfigBuilder *)withBackgroundFetchInterval:(int)backgroundFetchInterval __deprecated_msg("Use `setBackgroundFetchInterval:` on an LDConfig object");
/**
* Enable streaming mode for flags. When streaming is false, disable streaming and switch to polling mode. (Optional)
*
* @param streamingEnabled Whether streaming is enabled or not
* @return the configuration builder
*/
- (LDConfigBuilder *_Nonnull)withStreaming:(BOOL)streamingEnabled __deprecated_msg("Use `setStreaming:` on an LDConfig object");
- (LDConfigBuilder *)withStreaming:(BOOL)streamingEnabled __deprecated_msg("Use `setStreaming:` on an LDConfig object");
/**
* Enable debug mode to allow things such as logging. (Optional)
*
* @param debugEnabled Whether debugging is enabled or not
* @return the configuration builder
*/
- (LDConfigBuilder *_Nonnull)withDebugEnabled:(BOOL)debugEnabled __deprecated_msg("Use `setDebugEnabled:` on an LDConfig object");
- (LDConfigBuilder *)withDebugEnabled:(BOOL)debugEnabled __deprecated_msg("Use `setDebugEnabled:` on an LDConfig object");

-(LDConfig *)build;

-(LDConfig *_Nonnull)build;
NS_ASSUME_NONNULL_END

@end
46 changes: 25 additions & 21 deletions Darkly/DataModels/LDUserBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
@import Foundation;
@class LDUserModel;

NS_ASSUME_NONNULL_BEGIN

@interface LDUserBuilder : NSObject

/**
Expand Down Expand Up @@ -78,7 +80,7 @@
* @param inputKey key for the data
* @param value value for the data
*/
- (void)customString:(nonnull NSString *)inputKey value:(nonnull NSString *)value;
- (void)customString:(NSString *)inputKey value:(NSString *)value;

/**
* Provide custom BOOL data for the dictionary associated with
Expand All @@ -87,7 +89,7 @@
* @param inputKey key for the data
* @param value value for the data
*/
- (void)customBool:(nonnull NSString *)inputKey value:(BOOL)value;
- (void)customBool:(NSString *)inputKey value:(BOOL)value;

/**
* Provide custom NSNumber data for the dictionary associated with
Expand All @@ -96,7 +98,7 @@
* @param inputKey key for the data
* @param value value for the data
*/
- (void)customNumber:(nonnull NSString *)inputKey value:(nonnull NSNumber *)value;
- (void)customNumber:(NSString *)inputKey value:(NSNumber *)value;

/**
* Provide custom NSArray data for the dictionary associated with
Expand All @@ -105,12 +107,12 @@
* @param inputKey key for the data
* @param value value for the data
*/
- (void)customArray:(nonnull NSString *)inputKey value:(nonnull NSArray *)value;
- (void)customArray:(NSString *)inputKey value:(NSArray *)value;

-(nonnull LDUserModel *)build;
-(LDUserModel *)build;

+ (nonnull LDUserBuilder *)currentBuilder:(nonnull LDUserModel *)iUser;
+ (nonnull LDUserBuilder *)retrieveCurrentBuilder:(nonnull LDUserModel *)iUser __deprecated_msg("Use `currentBuilder:` instead");
+ (LDUserBuilder *)currentBuilder:(LDUserModel *)iUser;
+ (LDUserBuilder *)retrieveCurrentBuilder:(LDUserModel *)iUser __deprecated_msg("Use `currentBuilder:` instead");

/**
* Provide a key to the user builder to identify the user. If this key
Expand All @@ -119,57 +121,57 @@
* @param key the key for the user
* @return the user builder
*/
- (nonnull LDUserBuilder *)withKey:(nonnull NSString *)key __deprecated_msg("Pass value directly to `key` instead");
- (LDUserBuilder *)withKey:(NSString *)key __deprecated_msg("Pass value directly to `key` instead");
/**
* Provide the ip address of the user. (Optional)
*
* @param ip the ip of the user
* @return the user builder
*/
- (nonnull LDUserBuilder *)withIp:(nullable NSString *)ip __deprecated_msg("Pass value directly to `ip` instead");
- (LDUserBuilder *)withIp:(nullable NSString *)ip __deprecated_msg("Pass value directly to `ip` instead");
/**
* Provide the country of the user. (Optional)
*
* @param country the country of the user
* @return the user builder
*/
- (nonnull LDUserBuilder *)withCountry:(nullable NSString *)country __deprecated_msg("Pass value directly to `country` instead");
- (LDUserBuilder *)withCountry:(nullable NSString *)country __deprecated_msg("Pass value directly to `country` instead");
/**
* Provide the name of the user. (Optional)
*
* @param name the name of the user
* @return the user builder
*/
- (nonnull LDUserBuilder *)withName:(nullable NSString *)name __deprecated_msg("Pass value directly to `name` instead");
- (LDUserBuilder *)withName:(nullable NSString *)name __deprecated_msg("Pass value directly to `name` instead");

/**
* Provide the first name of the user. (Optional)
*
* @param firstName the firstName of the user
* @return the user builder
*/
- (nonnull LDUserBuilder *)withFirstName:(nullable NSString *)firstName __deprecated_msg("Pass value directly to `firstName` instead");
- (LDUserBuilder *)withFirstName:(nullable NSString *)firstName __deprecated_msg("Pass value directly to `firstName` instead");
/**
* Provide the last name of the user. (Optional)
*
* @param lastName the lastName of the user
* @return the user builder
*/
- (nonnull LDUserBuilder *)withLastName:(nullable NSString *)lastName __deprecated_msg("Pass value directly to `lastName` instead");
- (LDUserBuilder *)withLastName:(nullable NSString *)lastName __deprecated_msg("Pass value directly to `lastName` instead");
/**
* Provide the email address of the user. (Optional)
*
* @param email the email of the user
* @return the user builder
*/
- (nonnull LDUserBuilder *)withEmail:(nullable NSString *)email __deprecated_msg("Pass value directly to `email` instead");
- (LDUserBuilder *)withEmail:(nullable NSString *)email __deprecated_msg("Pass value directly to `email` instead");
/**
* Provide the avatar of the user. (Optional)
*
* @param avatar the avatar of the user
* @return the user builder
*/
- (nonnull LDUserBuilder *)withAvatar:(nullable NSString *)avatar __deprecated_msg("Pass value directly to `avatar` instead");
- (LDUserBuilder *)withAvatar:(nullable NSString *)avatar __deprecated_msg("Pass value directly to `avatar` instead");
/**
* Provide custom String data for the dictionary associated with
* the user. (Optional)
Expand All @@ -178,7 +180,7 @@
* @param value value for the data
* @return the user builder
*/
- (nonnull LDUserBuilder *)withCustomString:(nullable NSString *)inputKey value:(nullable NSString *)value __deprecated_msg("Use `customString:value` instead");
- (LDUserBuilder *)withCustomString:(nullable NSString *)inputKey value:(nullable NSString *)value __deprecated_msg("Use `customString:value` instead");
/**
* Provide custom BOOL data for the dictionary associated with
* the user. (Optional)
Expand All @@ -187,7 +189,7 @@
* @param value value for the data
* @return the user builder
*/
- (nonnull LDUserBuilder *)withCustomBool:(nullable NSString *)inputKey value:(BOOL)value __deprecated_msg("Use `customBool:value` instead");
- (LDUserBuilder *)withCustomBool:(nullable NSString *)inputKey value:(BOOL)value __deprecated_msg("Use `customBool:value` instead");
/**
* Provide custom NSNumber data for the dictionary associated with
* the user. (Optional)
Expand All @@ -196,7 +198,7 @@
* @param value value for the data
* @return the user builder
*/
- (nonnull LDUserBuilder *)withCustomNumber:(nullable NSString *)inputKey value:(nullable NSNumber *)value __deprecated_msg("Use `customNumber:value` instead");
- (LDUserBuilder *)withCustomNumber:(nullable NSString *)inputKey value:(nullable NSNumber *)value __deprecated_msg("Use `customNumber:value` instead");
/**
* Provide custom NSArray data for the dictionary associated with
* the user. (Optional)
Expand All @@ -205,15 +207,15 @@
* @param value value for the data
* @return the user builder
*/
- (nonnull LDUserBuilder *)withCustomArray:(nullable NSString *)inputKey value:(nullable NSArray *)value __deprecated_msg("Use `customArray:value` instead");
- (LDUserBuilder *)withCustomArray:(nullable NSString *)inputKey value:(nullable NSArray *)value __deprecated_msg("Use `customArray:value` instead");
/**
* Provide custom NSMutableDictionary data for the dictionary associated with
* the user. (Optional)
*
* @param inputDictionary Dictionary to associated with the user
* @return the user builder
*/
- (nonnull LDUserBuilder *)withCustomDictionary:(nullable NSMutableDictionary *)inputDictionary __deprecated_msg("Pass value directly to `customDictionary` instead");
- (LDUserBuilder *)withCustomDictionary:(nullable NSMutableDictionary *)inputDictionary __deprecated_msg("Pass value directly to `customDictionary` instead");
/**
* Provide whether the user is anonymous. Note, if a key is
* auto-generated for the user, then anonymous is set to YES. Default
Expand All @@ -222,6 +224,8 @@
* @param anonymous whether user is anonymous
* @return the user builder
*/
- (nonnull LDUserBuilder *)withAnonymous:(BOOL)anonymous __deprecated_msg("Pass value directly to `isAnonymous` instead");
- (LDUserBuilder *)withAnonymous:(BOOL)anonymous __deprecated_msg("Pass value directly to `isAnonymous` instead");

NS_ASSUME_NONNULL_END

@end
Loading

0 comments on commit adb37b5

Please sign in to comment.