Skip to content

Commit 26977a1

Browse files
committed
Add report fully displayed option
1 parent 941bcc9 commit 26977a1

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Modules/Sources/AnalyticsClient/AnalyticsClient.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public struct AnalyticsClient: Sendable {
2323
public var logout: @Sendable () -> Void
2424
public var log: @Sendable (any Event) -> Void
2525
public var capture: @Sendable (any Error) -> Void
26+
public var reportFullyDisplayed: @Sendable () -> Void
2627
}
2728

2829
// MARK: - Dependency Keys
@@ -63,6 +64,10 @@ extension AnalyticsClient: DependencyKey {
6364
capture: { error in
6465
logger.error("Captured error via Sentry: \(error)")
6566
SentrySDK.capture(error: error)
67+
},
68+
reportFullyDisplayed: {
69+
logger.info("Did report fully displayed")
70+
SentrySDK.reportFullyDisplayed()
6671
}
6772
)
6873
}
@@ -80,15 +85,17 @@ extension AnalyticsClient: DependencyKey {
8085
},
8186
capture: { error in
8287
print("[Sentry] \(error)")
83-
}
88+
},
89+
reportFullyDisplayed: { }
8490
)
8591

8692
public static let testValue = Self(
8793
configure: { _ in },
8894
identify: { _ in },
8995
logout: { },
9096
log: { _ in },
91-
capture: { _ in }
97+
capture: { _ in },
98+
reportFullyDisplayed: { }
9299
)
93100
}
94101

@@ -158,7 +165,8 @@ extension AnalyticsClient {
158165
options.enablePreWarmedAppStartTracing = true
159166
options.enableCoreDataTracing = false // I don't have CoreData
160167
options.enableUserInteractionTracing = false // Doesn't work with SwiftUI
161-
options.enableUIViewControllerTracing = false // I dont' have UIViewControllers
168+
options.enableUIViewControllerTracing = false // I don't have UIViewControllers
169+
options.enableTimeToFullDisplayTracing = true
162170
options.tracePropagationTargets = ["4pda"] // Dismiss analytics requests
163171
options.swiftAsyncStacktraces = true
164172
options.attachScreenshot = true

0 commit comments

Comments
 (0)