Skip to content

Commit f1e19d0

Browse files
committed
NR-522021 Changed capture to always put color views first so they are in the background
1 parent 4d1c9db commit f1e19d0

File tree

15 files changed

+2112
-2
lines changed

15 files changed

+2112
-2
lines changed

Agent/SessionReplay/SessionReplayCapture.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,23 @@ class SessionReplayCapture {
7979

8080
let context = SwiftUIContext(frame: parentThingy.viewDetails.frame, clip: parentThingy.viewDetails.clip)
8181
let thingys = UIHostingViewRecordOrchestrator.swiftUIViewThingys(currentView, context: context, viewAttributes: viewAttributes, parentId: parentThingy.viewDetails.viewId)
82-
82+
8383
if !thingys.isEmpty {
84-
parentThingy.subviews.append(contentsOf: thingys)
84+
// Separate color views (backgrounds) from other views
85+
var colorViews: [any SessionReplayViewThingy] = []
86+
var otherViews: [any SessionReplayViewThingy] = []
87+
88+
for thingy in thingys {
89+
if thingy.viewDetails.viewName == "SwiftUIColorView" {
90+
colorViews.append(thingy)
91+
} else {
92+
otherViews.append(thingy)
93+
}
94+
}
95+
96+
// Insert color views first (they go to the back) then other views
97+
parentThingy.subviews.insert(contentsOf: colorViews, at: 0)
98+
parentThingy.subviews.append(contentsOf: otherViews)
8599
}
86100
}
87101

Test Harness/NRTestApp/NRTestApp.xcodeproj/project.pbxproj

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,17 @@
141141
F8BF14882F35112100EF5628 /* AttributedTextTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF14872F35112100EF5628 /* AttributedTextTestViewController.swift */; };
142142
F8BF14892F35112100EF5628 /* AttributedTextTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF14872F35112100EF5628 /* AttributedTextTestViewController.swift */; };
143143
F8BF14A42F35345500EF5628 /* AttributedTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF14A32F35345500EF5628 /* AttributedTextView.swift */; };
144+
F8BF16382F3F6D9F00EF5628 /* ClaimFormView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF162A2F3F6D9F00EF5628 /* ClaimFormView.swift */; };
145+
F8BF16392F3F6D9F00EF5628 /* MUIToken.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF16302F3F6D9F00EF5628 /* MUIToken.swift */; };
146+
F8BF163A2F3F6D9F00EF5628 /* HomeProfileCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF162E2F3F6D9F00EF5628 /* HomeProfileCardView.swift */; };
147+
F8BF163B2F3F6D9F00EF5628 /* ExpenseEntryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF162D2F3F6D9F00EF5628 /* ExpenseEntryView.swift */; };
148+
F8BF163D2F3F6D9F00EF5628 /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF16352F3F6D9F00EF5628 /* WebView.swift */; };
149+
F8BF163E2F3F6D9F00EF5628 /* ChatView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF16292F3F6D9F00EF5628 /* ChatView.swift */; };
150+
F8BF163F2F3F6D9F00EF5628 /* ConfirmationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF162B2F3F6D9F00EF5628 /* ConfirmationView.swift */; };
151+
F8BF16402F3F6D9F00EF5628 /* NewRelicSDK.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF16312F3F6D9F00EF5628 /* NewRelicSDK.swift */; };
152+
F8BF16412F3F6D9F00EF5628 /* ProviderSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF16332F3F6D9F00EF5628 /* ProviderSearchView.swift */; };
153+
F8BF16432F3F6D9F00EF5628 /* Views.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF16342F3F6D9F00EF5628 /* Views.swift */; };
154+
F8BF16442F3F6D9F00EF5628 /* model.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BF162F2F3F6D9F00EF5628 /* model.swift */; };
144155
F8C8812929845B8C001C15B9 /* NRTestAppNavigationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C8812829845B8C001C15B9 /* NRTestAppNavigationTests.swift */; };
145156
F8D7C6052B45C38700170F79 /* AppDelegate+UITest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BF1FA3B2AE32C9500E9019C /* AppDelegate+UITest.swift */; };
146157
F8E278492E3BEADA00D6F04C /* DiffTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8E278412E3BEACD00D6F04C /* DiffTestViewController.swift */; };
@@ -418,6 +429,17 @@
418429
F8BF14352F3268E900EF5628 /* DrawingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DrawingsView.swift; sourceTree = "<group>"; };
419430
F8BF14872F35112100EF5628 /* AttributedTextTestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttributedTextTestViewController.swift; sourceTree = "<group>"; };
420431
F8BF14A32F35345500EF5628 /* AttributedTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttributedTextView.swift; sourceTree = "<group>"; };
432+
F8BF16292F3F6D9F00EF5628 /* ChatView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatView.swift; sourceTree = "<group>"; };
433+
F8BF162A2F3F6D9F00EF5628 /* ClaimFormView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClaimFormView.swift; sourceTree = "<group>"; };
434+
F8BF162B2F3F6D9F00EF5628 /* ConfirmationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmationView.swift; sourceTree = "<group>"; };
435+
F8BF162D2F3F6D9F00EF5628 /* ExpenseEntryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpenseEntryView.swift; sourceTree = "<group>"; };
436+
F8BF162E2F3F6D9F00EF5628 /* HomeProfileCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeProfileCardView.swift; sourceTree = "<group>"; };
437+
F8BF162F2F3F6D9F00EF5628 /* model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = model.swift; sourceTree = "<group>"; };
438+
F8BF16302F3F6D9F00EF5628 /* MUIToken.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MUIToken.swift; sourceTree = "<group>"; };
439+
F8BF16312F3F6D9F00EF5628 /* NewRelicSDK.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewRelicSDK.swift; sourceTree = "<group>"; };
440+
F8BF16332F3F6D9F00EF5628 /* ProviderSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProviderSearchView.swift; sourceTree = "<group>"; };
441+
F8BF16342F3F6D9F00EF5628 /* Views.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Views.swift; sourceTree = "<group>"; };
442+
F8BF16352F3F6D9F00EF5628 /* WebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebView.swift; sourceTree = "<group>"; };
421443
F8C8812829845B8C001C15B9 /* NRTestAppNavigationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NRTestAppNavigationTests.swift; sourceTree = "<group>"; };
422444
F8E278412E3BEACD00D6F04C /* DiffTestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiffTestViewController.swift; sourceTree = "<group>"; };
423445
F8EAB9732EE09E040008B092 /* ConfidentialViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfidentialViewController.swift; sourceTree = "<group>"; };
@@ -487,6 +509,7 @@
487509
isa = PBXGroup;
488510
children = (
489511
2BCDE5B22ECEA133008EE3B9 /* MinimalReproView.swift */,
512+
F8BF16362F3F6D9F00EF5628 /* NewRelicSessionReplay */,
490513
2BCDE5B32ECEA133008EE3B9 /* PerformanceContentView.swift */,
491514
2B3493692E8EF15A006DE9D0 /* MaskingView.swift */,
492515
F8BF14352F3268E900EF5628 /* DrawingsView.swift */,
@@ -765,6 +788,24 @@
765788
path = "NRTestApp (tvOS)";
766789
sourceTree = "<group>";
767790
};
791+
F8BF16362F3F6D9F00EF5628 /* NewRelicSessionReplay */ = {
792+
isa = PBXGroup;
793+
children = (
794+
F8BF16292F3F6D9F00EF5628 /* ChatView.swift */,
795+
F8BF162A2F3F6D9F00EF5628 /* ClaimFormView.swift */,
796+
F8BF162B2F3F6D9F00EF5628 /* ConfirmationView.swift */,
797+
F8BF162D2F3F6D9F00EF5628 /* ExpenseEntryView.swift */,
798+
F8BF162E2F3F6D9F00EF5628 /* HomeProfileCardView.swift */,
799+
F8BF162F2F3F6D9F00EF5628 /* model.swift */,
800+
F8BF16302F3F6D9F00EF5628 /* MUIToken.swift */,
801+
F8BF16312F3F6D9F00EF5628 /* NewRelicSDK.swift */,
802+
F8BF16332F3F6D9F00EF5628 /* ProviderSearchView.swift */,
803+
F8BF16342F3F6D9F00EF5628 /* Views.swift */,
804+
F8BF16352F3F6D9F00EF5628 /* WebView.swift */,
805+
);
806+
path = NewRelicSessionReplay;
807+
sourceTree = "<group>";
808+
};
768809
F8F5D8212BEBB7C800CDC139 /* NRTestApp (watchOS) AppTests */ = {
769810
isa = PBXGroup;
770811
children = (
@@ -1228,6 +1269,17 @@
12281269
2BAE5C972E860C7D001D2B88 /* DatePickersView.swift in Sources */,
12291270
2BAE5C982E860C7D001D2B88 /* ButtonsView.swift in Sources */,
12301271
2BAE5C992E860C7D001D2B88 /* SteppersView.swift in Sources */,
1272+
F8BF16382F3F6D9F00EF5628 /* ClaimFormView.swift in Sources */,
1273+
F8BF16392F3F6D9F00EF5628 /* MUIToken.swift in Sources */,
1274+
F8BF163A2F3F6D9F00EF5628 /* HomeProfileCardView.swift in Sources */,
1275+
F8BF163B2F3F6D9F00EF5628 /* ExpenseEntryView.swift in Sources */,
1276+
F8BF163D2F3F6D9F00EF5628 /* WebView.swift in Sources */,
1277+
F8BF163E2F3F6D9F00EF5628 /* ChatView.swift in Sources */,
1278+
F8BF163F2F3F6D9F00EF5628 /* ConfirmationView.swift in Sources */,
1279+
F8BF16402F3F6D9F00EF5628 /* NewRelicSDK.swift in Sources */,
1280+
F8BF16412F3F6D9F00EF5628 /* ProviderSearchView.swift in Sources */,
1281+
F8BF16432F3F6D9F00EF5628 /* Views.swift in Sources */,
1282+
F8BF16442F3F6D9F00EF5628 /* model.swift in Sources */,
12311283
2BAE5C9A2E860C7D001D2B88 /* ScrollViewsView.swift in Sources */,
12321284
F8BF14882F35112100EF5628 /* AttributedTextTestViewController.swift in Sources */,
12331285
2BAE5C9B2E860C7D001D2B88 /* SlidersView.swift in Sources */,

Test Harness/NRTestApp/NRTestApp/Navigation/MainCoordinator.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,20 @@ class MainCoordinator: Coordinator {
103103
}
104104
#endif
105105
}
106+
107+
func showSwiftUICustomerView() {
108+
#if os(iOS)
109+
if #available(iOS 15.0, *) {
110+
if #available(iOS 16.0, *) {
111+
let swiftUIView = ClaimFormView()
112+
let swiftUIViewController = UIHostingController(rootView: swiftUIView)
113+
navigationController.pushViewController(swiftUIViewController, animated: true)
114+
} else {
115+
// Fallback on earlier versions
116+
}
117+
}
118+
#endif
119+
}
106120

107121
func showSwiftUIViewRepresentableTestView() {
108122
#if os(iOS)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//
2+
// ChatView.swift
3+
// xc
4+
//
5+
// Created by Jose Fernandes on 2026-02-11.
6+
//
7+
import SwiftUI
8+
9+
struct ChatView: View {
10+
var body: some View {
11+
ZStack(alignment: .bottomTrailing) {
12+
HStack {
13+
HStack {
14+
Button(action: {
15+
}) {
16+
HStack{
17+
Image(systemName: "message.fill")
18+
.foregroundColor(Color.white)
19+
Text("Chat").foregroundColor(Color.white).font(Font.subheadline.weight(.bold))
20+
}.padding([.bottom,.trailing],16)
21+
22+
23+
}
24+
25+
}
26+
}
27+
.frame(height: 25)
28+
.padding()
29+
.background(MUIToken.Design.colorDarkNavy
30+
.clipShape(RoundedRectangle(cornerRadius:16))
31+
.overlay(RoundedRectangle(cornerRadius:16)
32+
.stroke(MUIToken.Design.colorLightGrey, lineWidth: 0.5))
33+
.padding([.trailing, .bottom], 16.0)
34+
)
35+
36+
}
37+
}
38+
}
39+
40+
#Preview {
41+
VStack{
42+
ChatView()
43+
}
44+
45+
}

0 commit comments

Comments
 (0)