Skip to content

Commit

Permalink
Merge branch 'master' into arafay/xcode10-bitcode
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaszurkan-optimizely authored Sep 21, 2018
2 parents 627707b + 6604759 commit 70e246e
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode8.3
osx_image: xcode9.4
branches:
only:
- master
Expand Down
6 changes: 2 additions & 4 deletions OptimizelyDemoApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let datafileManagerDownloadInterval = 20000


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func applicationDidFinishLaunching(_ application: UIApplication) {

// ********************************************************
// ***************** Integration Samples ******************
Expand All @@ -57,7 +57,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// ** Google Analytics is initialized via the GoogleService-info.plist file
Amplitude.instance().initializeApiKey("YOUR_API_KEY_HERE")
Mixpanel.initialize(token:"MIXPANEL_TOKEN")
Localytics.autoIntegrate("YOUR-LOCALYTICS-APP-KEY", launchOptions: launchOptions)
Localytics.autoIntegrate("YOUR-LOCALYTICS-APP-KEY", launchOptions: nil)

#endif
// **************************************************
Expand Down Expand Up @@ -151,8 +151,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// let optimizelyClient = optimizelyManager?.initialize()
// let variation = optimizelyClient?.activate(self.experimentKey, userId:self.userId, attributes: self.attributes)
// self.setRootViewController(optimizelyClient: optimizelyClient, bucketedVariation:variation)

return true;
}

func setRootViewController(optimizelyClient: OPTLYClient!, bucketedVariation:OPTLYVariation?) {
Expand Down
7 changes: 5 additions & 2 deletions OptimizelySDKCore/OptimizelySDKCore/OPTLYProjectConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,11 @@ - (nullable NSString *)getAttributeIdForKey:(nonnull NSString *)attributeKey {
} else if (hasReservedPrefix) {
attributeId = attributeKey;
}
NSString *logMessage = [NSString stringWithFormat:OPTLYLoggerMessagesAttributeNotFound, attributeKey];
[self.logger logMessage:logMessage withLevel:OptimizelyLogLevelError];

if (attributeId == nil) {
NSString *logMessage = [NSString stringWithFormat:OPTLYLoggerMessagesAttributeNotFound, attributeKey];
[self.logger logMessage:logMessage withLevel:OptimizelyLogLevelError];
}
return attributeId;
}

Expand Down
10 changes: 5 additions & 5 deletions OptimizelySDKCore/OptimizelySDKCore/Optimizely.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ typedef NS_ENUM(NSInteger, OPTLYLiveVariableError) {
* @param userId The user ID to be used for bucketing.
* @return forced variation if it exists, otherwise return nil.
*/
- (OPTLYVariation *_Nullable)getForcedVariation:(nonnull NSString *)experimentKey
- (nullable OPTLYVariation *)getForcedVariation:(nonnull NSString *)experimentKey
userId:(nonnull NSString *)userId;

/**
Expand Down Expand Up @@ -145,7 +145,7 @@ typedef NS_ENUM(NSInteger, OPTLYLiveVariableError) {
* @param attributes The user's attributes.
* @return BOOL feature variable value.
*/
- (NSNumber *)getFeatureVariableBoolean:(nullable NSString *)featureKey
- (nullable NSNumber *)getFeatureVariableBoolean:(nullable NSString *)featureKey
variableKey:(nullable NSString *)variableKey
userId:(nullable NSString *)userId
attributes:(nullable NSDictionary<NSString *, NSString *> *)attributes;
Expand All @@ -158,7 +158,7 @@ typedef NS_ENUM(NSInteger, OPTLYLiveVariableError) {
* @param attributes The user's attributes.
* @return double feature variable value of type double.
*/
- (NSNumber *)getFeatureVariableDouble:(nullable NSString *)featureKey
- (nullable NSNumber *)getFeatureVariableDouble:(nullable NSString *)featureKey
variableKey:(nullable NSString *)variableKey
userId:(nullable NSString *)userId
attributes:(nullable NSDictionary<NSString *, NSString *> *)attributes;
Expand All @@ -171,7 +171,7 @@ typedef NS_ENUM(NSInteger, OPTLYLiveVariableError) {
* @param attributes The user's attributes.
* @return int feature variable value of type integer.
*/
- (NSNumber *)getFeatureVariableInteger:(nullable NSString *)featureKey
- (nullable NSNumber *)getFeatureVariableInteger:(nullable NSString *)featureKey
variableKey:(nullable NSString *)variableKey
userId:(nullable NSString *)userId
attributes:(nullable NSDictionary<NSString *, NSString *> *)attributes;
Expand All @@ -184,7 +184,7 @@ typedef NS_ENUM(NSInteger, OPTLYLiveVariableError) {
* @param attributes The user's attributes.
* @return NSString feature variable value of type string.
*/
- (NSString *_Nullable)getFeatureVariableString:(nullable NSString *)featureKey
- (nullable NSString *)getFeatureVariableString:(nullable NSString *)featureKey
variableKey:(nullable NSString *)variableKey
userId:(nullable NSString *)userId
attributes:(nullable NSDictionary<NSString *, NSString *> *)attributes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
* @param builderBlock The builder block containing the datafile fetch interval.
* @return an Optimizely Datafile Manager instance.
*/
+ (nullable instancetype)init:(nonnull OPTLYDatafileManagerBuilderBlock)builderBlock
+ (nullable instancetype)init:(nullable OPTLYDatafileManagerBuilderBlock)builderBlock
__attribute((deprecated("Use OPTLYDatafileManagerDefault initWithBuilder method instead.")));

/**
* Init with OPTLYDatafileManagerBuilder object
* @param builder The OPTLYDatafileManagerBuilder object containing the datafile fetch interval.
* @return an Optimizely Datafile Manager instance.
*/
- (instancetype)initWithBuilder:(OPTLYDatafileManagerBuilder *)builder;
- (nullable instancetype)initWithBuilder:(nullable OPTLYDatafileManagerBuilder *)builder;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ @interface OPTLYDatafileManagerDefault ()

@implementation OPTLYDatafileManagerDefault

+ (nullable instancetype)init:(nonnull OPTLYDatafileManagerBuilderBlock)builderBlock {
+ (nullable instancetype)init:(OPTLYDatafileManagerBuilderBlock)builderBlock {
return [[self alloc] initWithBuilder:[OPTLYDatafileManagerBuilder builderWithBlock:builderBlock]];
}

- (instancetype)initWithBuilder:(OPTLYDatafileManagerBuilder *)builder {
- (nullable instancetype)initWithBuilder:(OPTLYDatafileManagerBuilder *)builder {
if (builder != nil) {
self = [super init];
if (self != nil) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ class OPTLYDatafileManagerSwiftTest: XCTestCase {
func testOPTLYDatafileManagerInitWithBuilder() -> Void {
let datafileConfig = OPTLYDatafileConfig.init(projectId: self.kProjectId, withSDKKey: nil)
XCTAssertNotNil(datafileConfig, "data file config should not be nil.")
self.datafileManager = OPTLYDatafileManagerDefault.init(builder: OPTLYDatafileManagerBuilder.init(block: { (builder) in
self.datafileManager = OPTLYDatafileManagerDefault.init(builder: OPTLYDatafileManagerBuilder(block: { (builder) in
builder?.datafileConfig = datafileConfig!
}))

XCTAssertNotNil(self.datafileManager, "data file manager should not be nil.")
}
}
2 changes: 1 addition & 1 deletion OptimizelySDKShared/OptimizelySDKShared/OPTLYClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ __attribute((deprecated("Use OPTLYClient initWithBuilder method instead.")));
* @param builder The OPTLYClientBuilder object which has datafile, event handler, event dispatcher, and other configurations to be set.
* @return OPTLYClient instance
*/
- (instancetype)initWithBuilder:(OPTLYClientBuilder *)builder;
- (nonnull instancetype)initWithBuilder:(nullable OPTLYClientBuilder *)builder;

- (OPTLYNotificationCenter *_Nullable)notificationCenter;

Expand Down
16 changes: 8 additions & 8 deletions OptimizelySDKShared/OptimizelySDKShared/OPTLYClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ + (nonnull instancetype)init:(OPTLYClientBuilderBlock)builderBlock {
return [[self alloc] initWithBuilder:[OPTLYClientBuilder builderWithBlock:builderBlock]];
}

- (instancetype)init {
- (nonnull instancetype)init {
return [self initWithBuilder:nil];
}

- (instancetype)initWithBuilder:(OPTLYClientBuilder *)builder {
- (nonnull instancetype)initWithBuilder:(nullable OPTLYClientBuilder *)builder {
self = [super init];
if (self) {
if (builder != nil) {
Expand All @@ -53,17 +53,17 @@ - (instancetype)initWithBuilder:(OPTLYClientBuilder *)builder {
return self;
}

-(OPTLYNotificationCenter *)notificationCenter {
-(nullable OPTLYNotificationCenter *)notificationCenter {
return self.optimizely.notificationCenter;
}

#pragma mark activate methods
- (OPTLYVariation *)activate:(nonnull NSString *)experimentKey
- (nullable OPTLYVariation *)activate:(nonnull NSString *)experimentKey
userId:(nonnull NSString *)userId {
return [self activate:experimentKey userId:userId attributes:nil];
}

- (OPTLYVariation *)activate:(NSString *)experimentKey
- (nullable OPTLYVariation *)activate:(NSString *)experimentKey
userId:(NSString *)userId
attributes:(NSDictionary<NSString *,NSString *> *)attributes {
if (self.optimizely == nil) {
Expand All @@ -79,14 +79,14 @@ - (OPTLYVariation *)activate:(NSString *)experimentKey
}

#pragma mark getVariation methods
- (OPTLYVariation *)variation:(NSString *)experimentKey
- (nullable OPTLYVariation *)variation:(NSString *)experimentKey
userId:(NSString *)userId {
return [self variation:experimentKey
userId:userId
attributes:nil];
}

- (OPTLYVariation *)variation:(NSString *)experimentKey
- (nullable OPTLYVariation *)variation:(NSString *)experimentKey
userId:(NSString *)userId
attributes:(NSDictionary<NSString *,NSString *> *)attributes {
if (self.optimizely == nil) {
Expand All @@ -103,7 +103,7 @@ - (OPTLYVariation *)variation:(NSString *)experimentKey

#pragma mark Forced Variation Methods

- (OPTLYVariation *)getForcedVariation:(nonnull NSString *)experimentKey
- (nullable OPTLYVariation *)getForcedVariation:(nonnull NSString *)experimentKey
userId:(nonnull NSString *)userId {
if (self.optimizely == nil) {
[self.logger logMessage:OPTLYLoggerMessagesClientDummyOptimizelyError
Expand Down
20 changes: 10 additions & 10 deletions OptimizelySDKShared/OptimizelySDKShared/OPTLYDatafileConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
***************************************************************************/
#import <Foundation/Foundation.h>

extern NSString * const DEFAULT_HOST;
extern NSString * const OPTLY_PROJECTID_SUFFIX;
extern NSString * const OPTLY_ENVIRONMENTS_SUFFIX;
extern NSString * __nonnull const DEFAULT_HOST;
extern NSString * __nonnull const OPTLY_PROJECTID_SUFFIX;
extern NSString * __nonnull const OPTLY_ENVIRONMENTS_SUFFIX;

@interface OPTLYDatafileConfig : NSObject
- (nullable id)initWithProjectId:(NSString *)projectId withSDKKey:(NSString *)sdkKey withHost:(NSString *)host;
- (nullable id)initWithProjectId:(NSString *)projectId withSDKKey:(NSString *)sdkKey;
- (NSURL *) URLForKey;
- (NSString *) key;
- (nullable id)initWithProjectId:(nullable NSString *)projectId withSDKKey:(nullable NSString *)sdkKey withHost:(nonnull NSString *)host;
- (nullable id)initWithProjectId:(nullable NSString *)projectId withSDKKey:(nullable NSString *)sdkKey;
- (nonnull NSURL *) URLForKey;
- (nonnull NSString *) key;
@end

@interface OPTLYDatafileConfig(OPTLYHelpers)
+ (NSString *)defaultProjectIdCdnPath:(NSString *)projectId;
+ (NSString *)defaultSdkKeyCdnPath:(NSString *)sdkKey;
+ (nonnull NSString *)defaultProjectIdCdnPath:(nonnull NSString *)projectId;
+ (nonnull NSString *)defaultSdkKeyCdnPath:(nonnull NSString *)sdkKey;
/*
* Test if string s can be an Optimizely SDK key string.
*/
+ (BOOL)isValidKeyString:(NSString*)s;
+ (BOOL)isValidKeyString:(nullable NSString*)s;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ __attribute((deprecated("Use OPTLYManagerBasic initWithBuilder method instead.")
* @param builder The OPTLYManagerBuilder object which has datafile manager, event dispatcher, and other configurations to be set.
* @return OptimizelyManager instance
*/
- (instancetype)initWithBuilder:(OPTLYManagerBuilder *)builder;
- (nullable instancetype)initWithBuilder:(nullable OPTLYManagerBuilder *)builder;
@end
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ typedef void (^OPTLYManagerBuilderBlock)(OPTLYManagerBuilder * _Nullable builder
@property (nonatomic, readwrite, strong, nullable) id<OPTLYUserProfileService> userProfileService;

/// init is disabled. Please use builderWithBlock to create a Manager Builder
- (instancetype)init NS_UNAVAILABLE;
- (nonnull instancetype)init NS_UNAVAILABLE;
/// Create the Optimizely Manager Builder object.
+ (nullable instancetype)builderWithBlock:(nonnull OPTLYManagerBuilderBlock)block;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ __attribute((deprecated("Use OPTLYManager initWithBuilder method instead.")));
* @param validExperimentIds An array of valid experiment ids. If default user profile contains
* experiments not in this list, they are removed from user profile service.
**/
- (void)removeInvalidExperimentsForAllUsers:(NSArray<NSString *> *)validExperimentIds;
- (void)removeInvalidExperimentsForAllUsers:(NSArray<NSString *> *_Nullable)validExperimentIds;
@end
Loading

0 comments on commit 70e246e

Please sign in to comment.