-
-
Notifications
You must be signed in to change notification settings - Fork 387
feat(network-details): Extend SentryReplayOptions API with Session Replay Network Details configuration #7580
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
Open
43jay
wants to merge
5
commits into
main
Choose a base branch
from
mobile-935/sdk-options
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
84eeaed
feat(network-details): Extend SentryReplayOptions API
43jay debc594
feat(network-details): Add type-safe SentryUrlMatchable protocol for …
43jay b8e95e5
review-comment: Remove duplicate SentryReplayOptions.convertToUrlMatc…
43jay 4a60ed4
review-comment: Remove ObjC bridge for network detail URL properties
43jay 83310fd
feat(network-details): Run make generate-public-api
43jay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import Foundation | ||
|
|
||
| /// A protocol that represents values that can be used for URL pattern matching. | ||
| /// | ||
| /// Currently used by the network details API for session replay URL filtering. | ||
| /// May be reused by other SDK features requiring URL pattern matching in the future. | ||
| /// | ||
| /// This protocol provides type safety for URL pattern arrays, preventing runtime errors | ||
| /// by enforcing valid types at compile time. | ||
| /// | ||
| /// ```swift | ||
| /// options.networkDetailAllowUrls = [ | ||
| /// "api.example.com", // String ✅ | ||
| /// try! NSRegularExpression(pattern: ".*\\.sentry\\.io.*") // NSRegularExpression ✅ | ||
| /// ] | ||
| /// options.networkDetailAllowUrls = [42] // ❌ compile error — Int doesn't conform | ||
| /// ``` | ||
| /// | ||
| /// Conforming types: String (substring matching), NSRegularExpression (regex matching). | ||
| public protocol SentryUrlMatchable { | ||
| /// Converts the conforming value to a `SentryUrlMatcher` enum representation. | ||
| /// Internal SDK use only. | ||
| var asSentryUrlMatcher: SentryUrlMatcher { get } | ||
| } | ||
|
|
||
| extension String: SentryUrlMatchable { | ||
| /// Converts the string to a `SentryUrlMatcher.string` value for substring matching. | ||
| public var asSentryUrlMatcher: SentryUrlMatcher { | ||
| return .string(self) | ||
| } | ||
| } | ||
|
|
||
| extension NSRegularExpression: SentryUrlMatchable { | ||
| /// Converts the NSRegularExpression to a `SentryUrlMatcher.regex` value for full regex matching. | ||
| public var asSentryUrlMatcher: SentryUrlMatcher { | ||
| return .regex(self) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import Foundation | ||
|
|
||
| /// A type-safe representation of URL pattern values used by network detail filtering. | ||
| /// | ||
| /// `SentryUrlMatcher` provides a strongly-typed enum for representing URL pattern types | ||
| /// including strings and regular expressions. | ||
| /// | ||
| /// - Note: This type should not be used directly. Use `String` or `NSRegularExpression` | ||
| /// when configuring URL patterns. | ||
| public enum SentryUrlMatcher { | ||
| /// String pattern for substring matching. | ||
| case string(String) | ||
| /// NSRegularExpression pattern for regex matching. | ||
| case regex(NSRegularExpression) | ||
|
|
||
| /// Converts an array of Any values to an array of SentryUrlMatchable, filtering out invalid types. | ||
| /// | ||
| /// Validates and filters entries: trim whitespace from strings, discard empty strings, | ||
| /// and preserve only valid types (String and NSRegularExpression). | ||
| /// | ||
| /// - Parameter value: Array from dictionary that may contain mixed types | ||
| /// - Returns: Array of valid SentryUrlMatchable values, or nil if input is not an array | ||
| static func convertFromAny(_ value: Any?) -> [SentryUrlMatchable]? { | ||
| guard let array = value as? [Any] else { return nil } | ||
| return array.compactMap { element in | ||
| if let string = element as? String { | ||
| let trimmed = string.trimmingCharacters(in: .whitespacesAndNewlines) | ||
| return trimmed.isEmpty ? nil : trimmed | ||
| } | ||
| if let regex = element as? NSRegularExpression { return regex } | ||
| return nil | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.