Skip to content

Commit f68d396

Browse files
committed
Implemented comments
1 parent 1edd678 commit f68d396

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

Sources/Data Model/DispatchEvents/EventForDispatch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import Foundation
3333
public let body: Data
3434

3535
public init(url: URL? = nil, body: Data, region: Region = .US) {
36-
let endpoint = url?.absoluteString ?? EventForDispatch.getEndpoint(for: region)
36+
let endpoint = region == .US ? Self.eventEndpoint : Self.euEventEndpoint
3737
self.url = URL(string: endpoint)!
3838
self.body = body
3939
}

Sources/Extensions/ArrayEventForDispatch+Extension.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ extension Array where Element == EventForDispatch {
117117
return nil
118118
}
119119

120-
let regionValue = base.region == Region.EU.rawValue ? Region.EU : Region.US
121-
return EventForDispatch(url: url, body: data, region: regionValue)
120+
return EventForDispatch(url: url, body: data, region: Region(rawValue: base.region) ?? .US)
122121
}
123122
}

Sources/Implementation/Events/BatchEventBuilder.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,8 @@ class BatchEventBuilder {
8888
userId: String,
8989
attributes: OptimizelyAttributes?,
9090
decisions: [Decision]?,
91-
dispatchEvents: [DispatchEvent],
92-
region: Region? = nil) -> Data? {
93-
let eventRegion = region ?? config.region
91+
dispatchEvents: [DispatchEvent]) -> Data? {
92+
let eventRegion = config.region
9493
let snapShot = Snapshot(decisions: decisions, events: dispatchEvents)
9594

9695
let eventAttributes = getEventAttributes(config: config, attributes: attributes)

Sources/Optimizely+Decide/OptimizelyUserContext.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ public class OptimizelyUserContext {
7373
/// - region: The region for the user context (optional). Defaults to the region from the project config.
7474
public convenience init(optimizely: OptimizelyClient,
7575
userId: String,
76-
attributes: [String: Any?]? = nil,
77-
region: String? = nil) {
76+
attributes: [String: Any?]? = nil) {
7877
self.init(optimizely: optimizely, userId: userId, attributes: attributes ?? [:], identify: true)
7978
}
8079

0 commit comments

Comments
 (0)