Skip to content

Commit 83d47b8

Browse files
committed
change start back to initializeSDK (will fix later)
1 parent 8754e64 commit 83d47b8

13 files changed

+30
-30
lines changed

DemoObjCApp/AppDelegate.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
6464
-(void)initializeOptimizelySDKAsynchronous {
6565
self.optimizely = [[OptimizelyManager alloc] initWithSdkKey:kOptimizelySdkKey];
6666

67-
[self.optimizely startWithCompletion:^(NSData *data, NSError *error) {
67+
[self.optimizely initializeSDKWithCompletion:^(NSData *data, NSError *error) {
6868
if (error == nil) {
6969
NSLog(@"Optimizely SDK initialized successfully!");
7070
} else {
@@ -93,7 +93,7 @@ -(void)initializeOptimizelySDKSynchronous {
9393
self.optimizely = nil;
9494
} else {
9595
NSError *error;
96-
BOOL status = [self.optimizely startWithDatafile:datafileJSON error:&error];
96+
BOOL status = [self.optimizely initializeSDKWithDatafile:datafileJSON error:&error];
9797
if (status) {
9898
NSLog(@"Optimizely SDK initialized successfully!");
9999
} else {
@@ -144,7 +144,7 @@ -(void)initializeOptimizelySDKWithCustomization {
144144
#endif
145145
}];
146146

147-
[self.optimizely startWithCompletion:^(NSData *data, NSError *error) {
147+
[self.optimizely initializeSDKWithCompletion:^(NSData *data, NSError *error) {
148148
if (error == nil) {
149149
NSLog(@"Optimizely SDK initialized successfully!");
150150
} else {

DemoSwiftApp/AppDelegate.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
6363
func initializeOptimizelySDKAsynchronous() {
6464
optimizely = OptimizelyManager(sdkKey: sdkKey)
6565

66-
optimizely.start { result in
66+
optimizely.initializeSDK { result in
6767
switch result {
6868
case .failure(let error):
6969
print("Optimizely SDK initiliazation failed: \(error)")
@@ -87,7 +87,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
8787

8888
do {
8989
let datafileJSON = try String(contentsOfFile: localDatafilePath, encoding: .utf8)
90-
try optimizely!.start(datafile: datafileJSON)
90+
try optimizely!.initializeSDK(datafile: datafileJSON)
9191
print("Optimizely SDK initialized successfully!")
9292
} catch {
9393
print("Optimizely SDK initiliazation failed: \(error)")
@@ -154,7 +154,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
154154

155155
// initialize SDK
156156

157-
optimizely!.start { result in
157+
optimizely!.initializeSDK { result in
158158
switch result {
159159
case .failure(let error):
160160
print("Optimizely SDK initiliazation failed: \(error)")

OptimizelySDK/Optimizely/OptimizelyManager+ObjC.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ extension OptimizelyManager {
5858
}
5959

6060
@available(swift, obsoleted: 1.0)
61-
@objc(startWithCompletion:)
61+
@objc(initializeSDKWithCompletion:)
6262
/// Start Optimizely SDK (Asynchronous)
6363
///
6464
/// If an updated datafile is available in the server, it's downloaded and the SDK is configured with
6565
/// the updated datafile.
6666
///
6767
/// - Parameters:
6868
/// - completion: callback when initialization is completed
69-
public func _objcStart(completion: ((Data?, NSError?) -> Void)?) {
70-
start { result in
69+
public func _objcInitializeSDK(completion: ((Data?, NSError?) -> Void)?) {
70+
initializeSDK { result in
7171
switch result {
7272
case .failure(let error):
7373
completion?(nil, self.convertErrorForObjc(error))
@@ -78,19 +78,19 @@ extension OptimizelyManager {
7878
}
7979

8080
@available(swift, obsoleted: 1.0)
81-
@objc(startWithDatafile:error:)
81+
@objc(initializeSDKWithDatafile:error:)
8282
/// Start Optimizely SDK (Synchronous)
8383
///
8484
/// - Parameters:
8585
/// - datafile: This datafile will be used when cached copy is not available (fresh start).
8686
/// A cached copy from previous download is used if it's available.
8787
/// The datafile will be updated from the server in the background thread.
8888
public func _objcStartWith(datafile:String) throws {
89-
try self.start(datafile: datafile)
89+
try self.initializeSDK(datafile: datafile)
9090
}
9191

9292
@available(swift, obsoleted: 1.0)
93-
@objc(startWithDatafile:doFetchDatafileBackground:error:)
93+
@objc(initializeSDKWithDatafile:doFetchDatafileBackground:error:)
9494
/// Start Optimizely SDK (Synchronous)
9595
///
9696
/// - Parameters:
@@ -101,7 +101,7 @@ extension OptimizelyManager {
101101
/// you don't want to download the datafile. In practice, you should allow the
102102
/// background thread to update the cache copy (optional)
103103
public func _objcStart(datafile: Data, doFetchDatafileBackground: Bool = true) throws {
104-
try self.start(datafile: datafile, doFetchDatafileBackground: doFetchDatafileBackground)
104+
try self.initializeSDK(datafile: datafile, doFetchDatafileBackground: doFetchDatafileBackground)
105105
}
106106

107107
@available(swift, obsoleted: 1.0)

OptimizelySDK/Optimizely/OptimizelyManager.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ open class OptimizelyManager: NSObject {
9898
/// - Parameters:
9999
/// - resourceTimeout: timeout for datafile download (optional)
100100
/// - completion: callback when initialization is completed
101-
public func start(resourceTimeout:Double? = nil, completion: ((OptimizelyResult<Data>) -> Void)?=nil) {
101+
public func initializeSDK(resourceTimeout:Double? = nil, completion: ((OptimizelyResult<Data>) -> Void)?=nil) {
102102
fetchDatafileBackground(resourceTimeout:resourceTimeout) { result in
103103
switch result {
104104
case .failure:
@@ -124,12 +124,12 @@ open class OptimizelyManager: NSObject {
124124
/// - datafile: This datafile will be used when cached copy is not available (fresh start).
125125
/// A cached copy from previous download is used if it's available.
126126
/// The datafile will be updated from the server in the background thread.
127-
public func start(datafile: String) throws {
127+
public func initializeSDK(datafile: String) throws {
128128
guard let datafileData = datafile.data(using: .utf8) else {
129129
throw OptimizelyError.dataFileInvalid
130130
}
131131

132-
try start(datafile: datafileData)
132+
try initializeSDK(datafile: datafileData)
133133
}
134134

135135
/// Start Optimizely SDK (Synchronous)
@@ -141,7 +141,7 @@ open class OptimizelyManager: NSObject {
141141
/// - doFetchDatafileBackground: This is for debugging purposes when
142142
/// you don't want to download the datafile. In practice, you should allow the
143143
/// background thread to update the cache copy (optional)
144-
public func start(datafile: Data, doFetchDatafileBackground: Bool = true) throws {
144+
public func initializeSDK(datafile: Data, doFetchDatafileBackground: Bool = true) throws {
145145
let cachedDatafile = self.datafileHandler.loadSavedDatafile(sdkKey: self.sdkKey)
146146

147147
let selectedDatafile = cachedDatafile ?? datafile

OptimizelySDK/OptimizelyTests/OptimizelyTests-APIs/OptimizelyManagerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class OptimizelyManagerTests: XCTestCase {
2525
// Put setup code here. This method is called before the invocation of each test method in the class.
2626
optimizely = OptimizelyManager(sdkKey: "SDKKEY")
2727

28-
try! optimizely?.start(datafile:json)
28+
try! optimizely?.initializeSDK(datafile:json)
2929
}
3030

3131
override func tearDown() {

OptimizelySDK/OptimizelyTests/OptimizelyTests-APIs/OptimizelyManagerTests_ForcedVariation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class OptimizelyManagerTests_ForcedVariation: XCTestCase {
3333

3434
self.optimizely = OptimizelyManager(sdkKey: "12345",
3535
userProfileService: OTUtils.createClearUserProfileService())
36-
try! self.optimizely.start(datafile: datafile)
36+
try! self.optimizely.initializeSDK(datafile: datafile)
3737
}
3838

3939
func testForcedVariation_ThenActivate() {
@@ -79,7 +79,7 @@ class OptimizelyManagerTests_ForcedVariation: XCTestCase {
7979

8080
// reload ProjectConfig (whitelist must NOT be sustained)
8181

82-
try! self.optimizely.start(datafile: datafile)
82+
try! self.optimizely.initializeSDK(datafile: datafile)
8383
variationKey = self.optimizely.getForcedVariation(experimentKey: kExperimentKey, userId: kUserId)
8484
XCTAssertNil(variationKey)
8585
}

OptimizelySDK/OptimizelyTests/OptimizelyTests-APIs/OptimizelyManagerTests_Invalid.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class OptimizelyManagerTests_Invalid: XCTestCase {
3333
self.optimizely = OptimizelyManager(sdkKey: kSdkKey)
3434

3535
let invalidDatafile = "{\"version\": \"4\"}"
36-
try? self.optimizely.start(datafile: invalidDatafile)
36+
try? self.optimizely.initializeSDK(datafile: invalidDatafile)
3737
}
3838

3939
func testActivate_WhenManagerNonInitialized() {

OptimizelySDK/OptimizelyTests/OptimizelyTests-APIs/OptimizelyManagerTests_ObjcAPIs.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ - (void)setUp {
104104

105105
self.optimizely = [[OptimizelyManager alloc] initWithSdkKey: kSdkKey];
106106

107-
[self.optimizely startWithDatafile:fileContents error:nil];
107+
[self.optimizely initializeSDKWithDatafile:fileContents error:nil];
108108

109109
self.attributes = @{ @"name": @"tom", @"age": @21 };
110110
}
@@ -231,11 +231,11 @@ - (void)testCustomizationAPIs {
231231
periodicDownloadInterval:@(50)
232232
defaultLogLevel:OptimizelyLogLevelInfo];
233233

234-
[self.optimizely startWithCompletion:^(NSData * _Nullable data, NSError * _Nullable error) {}];
234+
[self.optimizely initializeSDKWithCompletion:^(NSData * _Nullable data, NSError * _Nullable error) {}];
235235

236-
[self.optimizely startWithDatafile:datafile error:nil];
236+
[self.optimizely initializeSDKWithDatafile:datafile error:nil];
237237

238-
[self.optimizely startWithDatafile:datafileData doFetchDatafileBackground:false error:nil];
238+
[self.optimizely initializeSDKWithDatafile:datafileData doFetchDatafileBackground:false error:nil];
239239
}
240240

241241
@end

OptimizelySDK/OptimizelyTests/OptimizelyTests-APIs/OptimizelyManagerTests_Valid.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class OptimizelyManagerTests_Valid: XCTestCase {
5656

5757
self.optimizely = OptimizelyManager(sdkKey: "12345",
5858
userProfileService: OTUtils.createClearUserProfileService())
59-
try! self.optimizely.start(datafile: datafile)
59+
try! self.optimizely.initializeSDK(datafile: datafile)
6060
}
6161

6262
func testActivate() {

OptimizelySDK/OptimizelyTests/OptimizelyTests-Common/BatchEventBuilderTest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class BatchEventBuilderTests: XCTestCase {
3030

3131
let datafile = OTUtils.loadJSONDatafile(datafileName)
3232
do {
33-
try optimizely?.start(datafile: datafile!)
33+
try optimizely?.initializeSDK(datafile: datafile!)
3434
}
3535
catch {
3636
print(error)

0 commit comments

Comments
 (0)