Skip to content

[FIX] Internal Testing Tools iOS breaking changes #926

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 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ internal class DatadogCoreProxy: DatadogCoreProtocol {
)
}

func set(baggage: @escaping () -> FeatureBaggage?, forKey key: String) {
core.set(baggage: baggage, forKey: key)
}
func set<Context>(context: @escaping () -> Context?) where Context : DatadogInternal.AdditionalContext {}

func send(message: FeatureMessage, else fallback: @escaping () -> Void) {
core.send(message: message, else: fallback)
Expand Down Expand Up @@ -79,16 +77,14 @@ private struct FeatureScopeProxy: FeatureScope {
proxy.send(message: message, else: fallback)
}

func set(baggage: @escaping () -> FeatureBaggage?, forKey key: String) {
proxy.set(baggage: baggage, forKey: key)
}
func set<Context>(context: @escaping () -> Context?) where Context : DatadogInternal.AdditionalContext {}

func set(anonymousId: String?) {
proxy.set(anonymousId: anonymousId)
proxy.set(anonymousId: anonymousId)
}
}

private class FeatureScopeInterceptor {
private final class FeatureScopeInterceptor: @unchecked Sendable {
struct InterceptingWriter: Writer {
static let jsonEncoder = JSONEncoder.dd.default()

Expand Down Expand Up @@ -127,7 +123,7 @@ private class FeatureScopeInterceptor {
return events
}

func waitAndDeleteEvents() -> Void {
func waitAndDeleteEvents() {
_ = group.wait(timeout: .distantFuture)
events = []
}
Expand All @@ -139,7 +135,7 @@ extension DatadogCoreProxy {
/// - name: The Feature to retrieve events from
/// - type: The type of events to filter out
/// - Returns: A list of events.
func waitAndReturnEvents<T>(ofFeature name: String, ofType type: T.Type, timeout: DispatchTime = .distantFuture) -> [T] where T: Encodable {
public func waitAndReturnEvents<T>(ofFeature name: String, ofType type: T.Type, timeout: DispatchTime = .distantFuture) -> [T] where T: Encodable {
guard let interceptor = self.featureScopeInterceptors[name] else {
return [] // feature scope was not requested, so there's no interception
}
Expand All @@ -150,11 +146,10 @@ extension DatadogCoreProxy {
///
/// - Parameter feature: The Feature to retrieve events from
/// - Returns: A list of serialized events.
func waitAndReturnEventsData(ofFeature name: String, timeout: DispatchTime = .distantFuture) -> [String] {
public func waitAndReturnEventsData(ofFeature name: String, timeout: DispatchTime = .distantFuture) -> [String] {
guard let interceptor = self.featureScopeInterceptors[name] else {
return [] // feature scope was not requested, so there's no interception
}

return interceptor
.waitAndReturnEvents(timeout: timeout)
.compactMap { $0.data.base64EncodedString() }
Expand Down
Loading