Skip to content

Commit e605d75

Browse files
committed
RUM-8415 - Use type description + enums + regex + other CR suggestions
1 parent c1aa2d1 commit e605d75

14 files changed

+374
-647
lines changed

Datadog/Datadog.xcodeproj/project.pbxproj

+18-30
Large diffs are not rendered by default.

DatadogInternal/Sources/Utils/Dumper.swift

-31
This file was deleted.

DatadogRUM/Sources/Instrumentation/RUMInstrumentation.swift

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ internal final class RUMInstrumentation: RUMCommandPublisher {
5959
watchdogTermination: WatchdogTerminationMonitor?,
6060
memoryWarningMonitor: MemoryWarningMonitor
6161
) {
62+
// MARK: TODO: RUM-8416 - Remove after we add SwiftUI view instrumentation option
6263
// Always create views handler (we can't know if it will be used by SwiftUI instrumentation)
6364
// and only swizzle `UIViewController` if UIKit instrumentation is configured:
6465
let viewsHandler = RUMViewsHandler(
@@ -70,6 +71,7 @@ internal final class RUMInstrumentation: RUMCommandPublisher {
7071
)
7172
let viewControllerSwizzler: UIViewControllerSwizzler? = {
7273
do {
74+
// MARK: TODO: RUM-8416 - Check both predicates after we add SwiftUI view instrumentation option
7375
if uiKitRUMViewsPredicate != nil {
7476
return try UIViewControllerSwizzler(handler: viewsHandler)
7577
}
@@ -82,11 +84,13 @@ internal final class RUMInstrumentation: RUMCommandPublisher {
8284
return nil
8385
}()
8486

87+
// MARK: TODO: RUM-8420 - Remove after we add SwiftUI action instrumentation option
8588
// Always create actions handler (we can't know if it will be used by SwiftUI instrumentation)
8689
// and only swizzle `UIApplicationSwizzler` if UIKit instrumentation is configured:
8790
let actionsHandler = RUMActionsHandler(dateProvider: dateProvider, predicate: uiKitRUMActionsPredicate)
8891
let uiApplicationSwizzler: UIApplicationSwizzler? = {
8992
do {
93+
// MARK: TODO: RUM-8420 - Check both predicates after we add SwiftUI action instrumentation option
9094
if uiKitRUMActionsPredicate != nil {
9195
return try UIApplicationSwizzler(handler: actionsHandler)
9296
}

DatadogRUM/Sources/Instrumentation/Views/RUMViewsHandler.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ extension RUMViewsHandler: UIViewControllerHandler {
239239
path: rumView.path ?? viewController.canonicalClassName,
240240
isUntrackedModal: rumView.isUntrackedModal,
241241
attributes: rumView.attributes,
242-
instrumentationType: .uikit
242+
instrumentationType: .swiftui
243243
)
244244
)
245245
} else if #available(iOS 13, tvOS 13, *), viewController.isModalInPresentation {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2019-Present Datadog, Inc.
5+
*/
6+
7+
/// Controller type enum to identify different SwiftUI hosting controllers
8+
internal enum ControllerType {
9+
case hostingController
10+
case navigationController
11+
case modal
12+
case tabItem
13+
case unknown
14+
15+
/// Determines the controller type from the class name
16+
init(className: String) {
17+
if className.contains("_TtGC7SwiftUI19UIHostingControllerVVS_7TabItem8RootView_") {
18+
self = .tabItem
19+
} else if className.contains("TtGC7SwiftUI19UIHostingController") {
20+
self = .hostingController
21+
} else if className.contains("Navigation") {
22+
self = .navigationController
23+
} else if className.contains("_TtGC7SwiftUI29PresentationHostingController") {
24+
self = .modal
25+
} else {
26+
self = .unknown
27+
}
28+
}
29+
}

DatadogRUM/Sources/Instrumentation/Views/SwiftUI/SwiftUIViewNameExtractor+HostingController.swift

-65
This file was deleted.

DatadogRUM/Sources/Instrumentation/Views/SwiftUI/SwiftUIViewNameExtractor+NavigationStackController.swift

-103
This file was deleted.

DatadogRUM/Sources/Instrumentation/Views/SwiftUI/SwiftUIViewNameExtractor+SheetContent.swift

-35
This file was deleted.

DatadogRUM/Sources/Instrumentation/Views/SwiftUI/SwiftUIViewNameExtractor+Tabbar.swift

-30
This file was deleted.

0 commit comments

Comments
 (0)