Skip to content

Improved events tests #643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
- Added client dependency to event background task

0.2.0: (Apr 25, 2018)
- Added events listener. Available events: SplitEvent.sdkReady and SplitEvent.sdkReadyTimedOut
- Added events listener. Available events: SplitEventCase.sdkReady and SplitEventCase.sdkReadyTimedOut

0.1.5: (Mar 19, 2018)
- Added first load from cache
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let factory = factoryBuilder.build()
let client = factory?.client

// Subscribe to SDK READY event and evaluate your feature flag
client?.on(event: SplitEvent.sdkReady) {
client?.on(event: SplitEventCase.sdkReady) {
if let client = client {
let treatment = client.getTreatment("my_first_feature_flag")
if treatment == "on" {
Expand Down
76 changes: 36 additions & 40 deletions Split/Api/DefaultSplitClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

typealias DestroyHandler = () -> Void

public final class DefaultSplitClient: NSObject, SplitClient, TelemetrySplitClient {

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_4) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_4) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_4) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_4) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSStreaming_2) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSStreaming_2) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSStreaming_2) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSStreaming_2) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SemVer) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SemVer) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SemVer) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SemVer) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_2) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_2) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_2) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_2) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_1) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_1) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_1) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_1) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_3) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_3) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_3) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit_3) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSIntegration_1) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSIntegration_1) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSIntegration_1) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSIntegration_1) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSStreaming_1) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSStreaming_1) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSStreaming_1) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSStreaming_1) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitPushManagerUT) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitPushManagerUT) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitPushManagerUT) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitPushManagerUT) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitStreamingUT) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitStreamingUT) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitStreamingUT) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitStreamingUT) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSUnit) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSStreaming) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSStreaming) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSStreaming) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSStreaming) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSIntegration) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSIntegration) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSIntegration) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

Check warning on line 14 in Split/Api/DefaultSplitClient.swift

View workflow job for this annotation

GitHub Actions / test (SplitiOSIntegration) / test

parameter of 'on(event:executeWithMetadata:)' has different optionality than expected by protocol 'SplitClient'

private var storageContainer: SplitStorageContainer
private var key: Key
private let config: SplitClientConfig
Expand Down Expand Up @@ -55,52 +55,48 @@
}
}

// MARK: Events
// MARK: Events Listeners
extension DefaultSplitClient {

private func onWithMetadata(event: SplitEvent, runInBackground: Bool, queue: DispatchQueue?, execute actionWithMetadata: @escaping SplitActionWithMetadata) {
guard let factory = clientManager?.splitFactory else { return }
let task = SplitEventActionTask(action: actionWithMetadata, event: event.type, runInBackground: runInBackground, factory: factory, queue: queue)
on(event: event.type, executeTask: task)
}

public func on(event: SplitEventCase, executeWithMetadata action: SplitActionWithMetadata?) {
guard let action = action else { return }
onWithMetadata(event: SplitEvent(type: event, metadata: nil), runInBackground: true, queue: nil, execute: action)
}

private func on(event: SplitEventCase, executeTask task: SplitEventActionTask) {
if event != .sdkReadyFromCache, eventsManager.eventAlreadyTriggered(event: event) {
Logger.w("A handler was added for \(event.toString()) on the SDK, which has already fired and won’t be emitted again. The callback won’t be executed.")
return
}
eventsManager.register(event: SplitEvent(type: event, metadata: nil), task: task)
}

private func on(event: SplitEventCase, runInBackground: Bool, queue: DispatchQueue?, execute action: @escaping SplitAction) {
guard let factory = clientManager?.splitFactory else { return }
let task = SplitEventActionTask(action: action, event: event, runInBackground: runInBackground, factory: factory, queue: queue)
on(event: event, executeTask: task)
}

public func on(event: SplitEvent, execute action: @escaping SplitAction) {
public func on(event: SplitEventCase, execute action: @escaping SplitAction) {
on(event: event, runInBackground: false, queue: nil, execute: action)
}

public func on(event: SplitEvent, runInBackground: Bool,
execute action: @escaping SplitAction) {
public func on(event: SplitEventCase, runInBackground: Bool, execute action: @escaping SplitAction) {
on(event: event, runInBackground: runInBackground, queue: nil, execute: action)
}

public func on(event: SplitEvent,
queue: DispatchQueue, execute action: @escaping SplitAction) {
public func on(event: SplitEventCase, queue: DispatchQueue, execute action: @escaping SplitAction) {
on(event: event, runInBackground: true, queue: queue, execute: action)
}

private func on(event: SplitEvent,
runInBackground: Bool,
queue: DispatchQueue?,
execute action: @escaping SplitAction) {

guard let factory = clientManager?.splitFactory else {
return
}

let task = SplitEventActionTask(action: action, event: event,
runInBackground: runInBackground,
factory: factory,
queue: queue)
task.event = event
on(event: event, executeTask: task)
}

private func on(event: SplitEvent, executeTask task: SplitEventTask) {
if event != .sdkReadyFromCache,
eventsManager.eventAlreadyTriggered(event: event) {
Logger.w("A handler was added for \(event.toString()) on the SDK, " +
"which has already fired and won’t be emitted again. The callback won’t be executed.")
return
}
eventsManager.register(event: event, task: task)
}
}

// MARK: Treatment / Evaluation
// MARK: Treatments
extension DefaultSplitClient {
public func getTreatmentWithConfig(_ split: String) -> SplitResult {
return treatmentManager.getTreatmentWithConfig(split, attributes: nil, evaluationOptions: nil)
Expand All @@ -127,7 +123,7 @@
}
}

// MARK: Treatment / Evaluation with Properties
// MARK: With Properties
extension DefaultSplitClient {
public func getTreatment(_ split: String, attributes: [String: Any]?, evaluationOptions: EvaluationOptions?) -> String {
return treatmentManager.getTreatment(split, attributes: attributes, evaluationOptions: evaluationOptions)
Expand Down Expand Up @@ -164,7 +160,7 @@
}
}

// MARK: Track Events
// MARK: Tracking
extension DefaultSplitClient {

public func track(trafficType: String, eventType: String) -> Bool {
Expand Down Expand Up @@ -214,7 +210,7 @@
}
}

// MARK: Persistent attributes feature
// MARK: Persistence
extension DefaultSplitClient {

public func setAttribute(name: String, value: Any) -> Bool {
Expand Down Expand Up @@ -270,7 +266,7 @@
}
}

// MARK: By Sets evaluation
// MARK: By FlagSets
extension DefaultSplitClient {
public func getTreatmentsByFlagSet(_ flagSet: String, attributes: [String: Any]?) -> [String: String] {
return treatmentManager.getTreatmentsByFlagSet(flagSet: flagSet, attributes: attributes, evaluationOptions: nil)
Expand All @@ -290,7 +286,7 @@
}
}

// MARK: Flush / Destroy
// MARK: Lifecycle
extension DefaultSplitClient {

private func syncFlush() {
Expand Down
22 changes: 11 additions & 11 deletions Split/Api/FailHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import Foundation

/// To avoid crashing host app this dummy components will be returned
/// on Failed init
///

class FailedClient: SplitClient {
func on(event: SplitEventCase, executeWithMetadata: SplitActionWithMetadata) {}

func getTreatment(_ split: String) -> String {
return SplitConstants.control
Expand Down Expand Up @@ -53,15 +53,18 @@ class FailedClient: SplitClient {
func getTreatmentsWithConfig(splits: [String], attributes: [String: Any]?, evaluationOptions: EvaluationOptions?) -> [String: SplitResult] {
return [:]
}

public func on(event: SplitEventCase, perform: SplitAction?) {}

func on(event: SplitEventCase, perform: @escaping ([String : Any]?) -> Void) {}

func on(event: SplitEvent, execute action: @escaping SplitAction) {
}
func on(event: SplitEventCase, execute action: @escaping SplitAction) {}

func on(event: SplitEvent, runInBackground: Bool,
func on(event: SplitEventCase, runInBackground: Bool,
execute action: @escaping SplitAction) {
}

func on(event: SplitEvent,
func on(event: SplitEventCase,
queue: DispatchQueue, execute action: @escaping SplitAction) {
}

Expand Down Expand Up @@ -137,14 +140,11 @@ class FailedClient: SplitClient {
return [:]
}

func setUserConsent(enabled: Bool) {
}
func setUserConsent(enabled: Bool) {}

func flush() {
}
func flush() {}

func destroy() {
}
func destroy() {}

func destroy(completion: (() -> Void)?) {
completion?()
Expand Down
55 changes: 40 additions & 15 deletions Split/Api/LocalhostSplitClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ public final class LocalhostSplitClient: NSObject, SplitClient {
private let key: Key
weak var clientManger: SplitClientManager?

init(key: Key, splitsStorage: SplitsStorage,
clientManager: SplitClientManager?,
eventsManager: SplitEventsManager? = nil,
evaluator: Evaluator) {
init(key: Key, splitsStorage: SplitsStorage, clientManager: SplitClientManager?, eventsManager: SplitEventsManager? = nil, evaluator: Evaluator) {
self.eventsManager = eventsManager
self.key = key
self.splitsStorage = splitsStorage
Expand All @@ -64,6 +61,7 @@ public final class LocalhostSplitClient: NSObject, SplitClient {
super.init()
}

// MARK: Treatments
public func getTreatment(_ split: String, attributes: [String: Any]?) -> String {
return getTreatmentWithConfig(split).treatment
}
Expand Down Expand Up @@ -120,33 +118,61 @@ public final class LocalhostSplitClient: NSObject, SplitClient {
}
return results
}

// MARK: Events Listeners
public func on(event: SplitEventCase, perform: SplitAction?) {
guard let perform = perform else { return }
on(event: event, execute: perform)
}

public func on(event: SplitEventCase, executeWithMetadata: @escaping SplitActionWithMetadata) {
on(eventWithMetadata: SplitEvent(type: event, metadata: nil), runInBackground: false, queue: nil, execute: executeWithMetadata)
}

public func on(event: SplitEvent, runInBackground: Bool,
public func on(event: SplitEventCase, runInBackground: Bool,
execute action: @escaping SplitAction) {
on(event: event, runInBackground: runInBackground, queue: nil, execute: action)
}

public func on(event: SplitEvent, queue: DispatchQueue, execute action: @escaping SplitAction) {
public func on(event: SplitEventCase, queue: DispatchQueue, execute action: @escaping SplitAction) {
on(event: event, runInBackground: true, queue: queue, execute: action)
}

public func on(event: SplitEvent, execute action: @escaping SplitAction) {
public func on(event: SplitEventCase, execute action: @escaping SplitAction) {
on(event: event, runInBackground: false, queue: nil, execute: action)
}

private func on(event: SplitEvent, runInBackground: Bool,
private func on(event: SplitEventCase, runInBackground: Bool, queue: DispatchQueue?, execute action: @escaping SplitAction) {
on(eventWithMetadata: SplitEvent(type: event, metadata: nil), runInBackground: runInBackground, queue: queue, execute: action)
}

private func on(eventWithMetadata event: SplitEvent, runInBackground: Bool,
queue: DispatchQueue?, execute action: @escaping SplitAction) {

guard let factory = clientManger?.splitFactory else { return }
if let eventsManager = self.eventsManager {
let task = SplitEventActionTask(action: action, event: event,
let task = SplitEventActionTask(action: action, event: event.type,
runInBackground: runInBackground,
factory: factory,
queue: queue)
eventsManager.register(event: event, task: task)
}
}

private func on(eventWithMetadata event: SplitEvent, runInBackground: Bool,
queue: DispatchQueue?, execute action: @escaping SplitActionWithMetadata) {

guard let factory = clientManger?.splitFactory else { return }
if let eventsManager = self.eventsManager {
let task = SplitEventActionTask(action: action, event: event.type,
runInBackground: runInBackground,
factory: factory,
queue: queue)
eventsManager.register(event: event, task: task)
}
}

// MARK: Tracking
public func track(trafficType: String, eventType: String) -> Bool {
return true
}
Expand Down Expand Up @@ -179,11 +205,10 @@ public final class LocalhostSplitClient: NSObject, SplitClient {
return true
}

public func setUserConsent(enabled: Bool) {
}
public func setUserConsent(enabled: Bool) {}

public func flush() {
}
// MARK: Lifecycle
public func flush() {}

public func destroy() {
splitsStorage.destroy()
Expand All @@ -195,7 +220,7 @@ public final class LocalhostSplitClient: NSObject, SplitClient {
}
}

// MARK: Persistent attributes feature
// MARK: Persistence
extension LocalhostSplitClient {

public func setAttribute(name: String, value: Any) -> Bool {
Expand Down Expand Up @@ -223,7 +248,7 @@ extension LocalhostSplitClient {
}
}

// MARK: TreatmentBySets Feature
// MARK: By Flagset
extension LocalhostSplitClient {
public func getTreatmentsByFlagSet(_ flagSet: String, attributes: [String: Any]?) -> [String: String] {
return [String: String]()
Expand Down
Loading
Loading