Skip to content

Commit c0b0746

Browse files
make the host override constructor public. cleanup broken demo app. (#283)
1 parent a47b511 commit c0b0746

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

OptimizelyDemoApp/AppDelegate.swift

+12-7
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,29 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
6565
// **************************************************
6666

6767
// ---- Create the Event Dispatcher ----
68-
let eventDispatcher = OPTLYEventDispatcherDefault.init(builder: OPTLYEventDispatcherBuilder.init(block: { (builder) in
68+
let eventDispatcher = OPTLYEventDispatcherDefault(builder: OPTLYEventDispatcherBuilder(block: { (builder) in
6969
builder?.eventDispatcherDispatchInterval = self.eventDispatcherDispatchInterval
7070
builder?.logger = OPTLYLoggerDefault.init(logLevel: .debug)
7171
}))
7272

7373
// ---- Create the Datafile Manager ----
74-
let datafileManager = OPTLYDatafileManagerDefault.init(builder: OPTLYDatafileManagerBuilder.init(block: { (builder) in
74+
let datafileManager = OPTLYDatafileManagerDefault(builder: OPTLYDatafileManagerBuilder(block: { (builder) in
7575
// builder!.datafileFetchInterval = TimeInterval(self.datafileManagerDownloadInterval)
76-
builder!.datafileConfig = OPTLYDatafileConfig(projectId: self.projectId, withSDKKey:nil)!;
77-
}
76+
builder!.datafileConfig = OPTLYDatafileConfig(projectId: nil, withSDKKey:"6hmwpgZcRFp36wH5QLK8Sb")!;
77+
78+
}))
7879

79-
// ---- Create the Manager ----
80-
let optimizelyManager = OPTLYManager.init(builder: OPTLYManagerBuilder.init(block: { (builder) in
80+
let builder = OPTLYManagerBuilder(block: { (builder) in
8181
builder!.projectId = nil;
8282
builder!.sdkKey = self.projectId
8383
builder!.datafileManager = datafileManager!
8484
builder!.eventDispatcher = eventDispatcher
85-
}))
85+
})
86+
87+
// ---- Create the Manager ----
88+
var optimizelyManager = OPTLYManager(builder: builder)
89+
90+
optimizelyManager?.datafileConfig = datafileManager?.datafileConfig
8691

8792
// After creating the client, there are three different ways to intialize the manager:
8893

OptimizelySDKShared/OptimizelySDKShared/OPTLYDatafileConfig.h

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extern NSString * const OPTLY_PROJECTID_SUFFIX;
2020
extern NSString * const OPTLY_ENVIRONMENTS_SUFFIX;
2121

2222
@interface OPTLYDatafileConfig : NSObject
23+
- (nullable id)initWithProjectId:(NSString *)projectId withSDKKey:(NSString *)sdkKey withHost:(NSString *)host;
2324
- (nullable id)initWithProjectId:(NSString *)projectId withSDKKey:(NSString *)sdkKey;
2425
- (NSURL *) URLForKey;
2526
- (NSString *) key;

0 commit comments

Comments
 (0)