Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
philprime committed Jan 20, 2025
1 parent 44c3851 commit 3d45aa8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
11 changes: 4 additions & 7 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@
A8F17B342902870300990B25 /* SentryHttpStatusCodeRange.m in Sources */ = {isa = PBXBuildFile; fileRef = A8F17B332902870300990B25 /* SentryHttpStatusCodeRange.m */; };
D48724DB2D352597005DE483 /* SentryTraceOrigin.swift in Sources */ = {isa = PBXBuildFile; fileRef = D48724DA2D352591005DE483 /* SentryTraceOrigin.swift */; };
D48724E22D354D16005DE483 /* SentryTraceOriginTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D48724E12D354D16005DE483 /* SentryTraceOriginTests.swift */; };
D48E8B8B2D3E79610032E35E /* SentryTraceOrigin.swift in Sources */ = {isa = PBXBuildFile; fileRef = D48E8B8A2D3E79610032E35E /* SentryTraceOrigin.swift */; };
D4AF00212D2E92FD00F5F3D7 /* SentryNSFileManagerSwizzling.m in Sources */ = {isa = PBXBuildFile; fileRef = D4AF00202D2E92FD00F5F3D7 /* SentryNSFileManagerSwizzling.m */; };
D4AF00232D2E931000F5F3D7 /* SentryNSFileManagerSwizzling.h in Headers */ = {isa = PBXBuildFile; fileRef = D4AF00222D2E931000F5F3D7 /* SentryNSFileManagerSwizzling.h */; };
D4AF00252D2E93C400F5F3D7 /* SentryNSFileManagerSwizzlingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D4AF00242D2E93C400F5F3D7 /* SentryNSFileManagerSwizzlingTests.m */; };
Expand Down Expand Up @@ -1891,6 +1892,7 @@
A8F17B332902870300990B25 /* SentryHttpStatusCodeRange.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryHttpStatusCodeRange.m; sourceTree = "<group>"; };
D48724DA2D352591005DE483 /* SentryTraceOrigin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryTraceOrigin.swift; sourceTree = "<group>"; };
D48724E12D354D16005DE483 /* SentryTraceOriginTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryTraceOriginTests.swift; sourceTree = "<group>"; };
D48E8B8A2D3E79610032E35E /* SentryTraceOrigin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryTraceOrigin.swift; sourceTree = "<group>"; };
D4AF00202D2E92FD00F5F3D7 /* SentryNSFileManagerSwizzling.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryNSFileManagerSwizzling.m; sourceTree = "<group>"; };
D4AF00222D2E931000F5F3D7 /* SentryNSFileManagerSwizzling.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryNSFileManagerSwizzling.h; path = include/SentryNSFileManagerSwizzling.h; sourceTree = "<group>"; };
D4AF00242D2E93C400F5F3D7 /* SentryNSFileManagerSwizzlingTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryNSFileManagerSwizzlingTests.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3679,13 +3681,6 @@
name = Transaction;
sourceTree = "<group>";
};
D468C0602D36699700964230 /* IO */ = {
isa = PBXGroup;
children = (
);
path = IO;
sourceTree = "<group>";
};
D48724D92D35258A005DE483 /* Transactions */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3796,6 +3791,7 @@
D8199DB429376ECC0074249E /* SentryInternal */ = {
isa = PBXGroup;
children = (
D48E8B8A2D3E79610032E35E /* SentryTraceOrigin.swift */,
D8199DB829376ECC0074249E /* SentryInternal.h */,
D8199DB929376ECC0074249E /* SentryInternal.m */,
);
Expand Down Expand Up @@ -5318,6 +5314,7 @@
files = (
D8199DC129376EEC0074249E /* SentryTracedView.swift in Sources */,
D8199DBF29376EE20074249E /* SentryInternal.m in Sources */,
D48E8B8B2D3E79610032E35E /* SentryTraceOrigin.swift in Sources */,
D8A65B5D2C98656800974B74 /* SentryReplayView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
21 changes: 21 additions & 0 deletions Sources/SentrySwiftUI/SentryInternal/SentryTraceOrigin.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// This file is a subset of the fields defined in `Sources/Swift/Transactions/SentryTraceOrigin.swift`.
//
// As the main file is internal in `Sentry`, it can not be exposed to the `SentrySwiftUI` module.
// This file is a workaround to expose the `SentrySpanOperation` class to the `SentrySwiftUI` module.
//
// ATTENTION: This file should be kept in sync with the main file.
// Please add new fields or methods in the main file if possible.
//
// Discarded Approach 1:
// - Define `@interface SentryTraceOrigin` in `SentryInternal.h`
// - Swift class is exposed to Objective-C in auto-generated `Sentry-Swift.h`
// - Conflict: Duplicate interface definition
//
// Discarded Approach 2:
// - Declare Swift class `SentryTraceOrigin` in main file as `public`.
// - Auto-generated `Sentry-Swift.h` is manually imported to `SentrySwift.h`
// - Issue: Internal class is public for SDK users, which is not desired

enum SentryTraceOrigin: String {
case autoUITimeToDisplay = "auto.ui.time_to_display"
}
4 changes: 2 additions & 2 deletions Sources/SentrySwiftUI/SentryTracedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SentryTraceViewModel {
withName: name,
nameSource: nameSource,
operation: "ui.load",
origin: traceOrigin
origin: traceOrigin.rawValue
)
SentryPerformanceTracker.shared.pushActiveSpan(transactionId)
self.transactionId = transactionId
Expand All @@ -57,7 +57,7 @@ class SentryTraceViewModel {
withName: name,
nameSource: nameSource,
operation: "ui.load",
origin: traceOrigin
origin: traceOrigin.rawValue
)
SentryPerformanceTracker.shared.pushActiveSpan(spanId)
return spanId
Expand Down
7 changes: 2 additions & 5 deletions Sources/Swift/Transactions/SentryTraceOrigin.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

@objcMembers
public class SentryTraceOrigin: NSObject {
@objcMembers @objc(SentryTraceOrigin)
class SentryTraceOrigin: NSObject {
static let autoNSData = "auto.file.ns_data"
static let manual = "manual"
static let uiEventTracker = "auto.ui.event_tracker"
Expand All @@ -11,8 +11,5 @@ public class SentryTraceOrigin: NSObject {
static let autoHttpNSURLSession = "auto.http.ns_url_session"
static let autoUIViewController = "auto.ui.view_controller"
static let autoUITimeToDisplay = "auto.ui.time_to_display"

/// Needs to be public to be accessible from `SentrySwiftUI`
public static let autoUISwiftUI = "auto.ui.swift_ui"
static let manualUITimeToDisplay = "manual.ui.time_to_display"
}

0 comments on commit 3d45aa8

Please sign in to comment.