Skip to content

Commit

Permalink
feat: Track usage of appHangTrackingV2 (#4445)
Browse files Browse the repository at this point in the history
Add appHangTrackingV2 to the list of enabled features when the option
enableAppHangTrackingV2 is enabled.
  • Loading branch information
philipphofmann authored Oct 16, 2024
1 parent dfde71c commit 95331f3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- feat: API to manually start/stop Session Replay (#4414)
- Custom redact modifier for SwiftUI (#4362, #4392)
- Track usage of appHangTrackingV2 (#4445)

### Removal of Experimental API

Expand Down
6 changes: 6 additions & 0 deletions Sources/Swift/Helper/SentryEnabledFeaturesBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ import Foundation
if options.swiftAsyncStacktraces {
features.append("swiftAsyncStacktraces")
}

#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)
if options.enableAppHangTrackingV2 {
features.append("appHangTrackingV2")
}
#endif //os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)

return features
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ final class SentryEnabledFeaturesBuilderTests: XCTestCase {
options.enablePreWarmedAppStartTracing = true
#endif // canImport(UIKit)
#endif // os(iOS) || os(tvOS)

#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)
options.enableAppHangTrackingV2 = true
#endif //os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)

let features = SentryEnabledFeaturesBuilder.getEnabledFeatures(options: options)

Expand All @@ -42,5 +46,9 @@ final class SentryEnabledFeaturesBuilderTests: XCTestCase {
XCTAssert(features.contains("preWarmedAppStartTracing"))
#endif // canImport(UIKit)
#endif // os(iOS) || os(tvOS)

#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)
XCTAssert(features.contains("appHangTrackingV2"))
#endif //os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)
}
}

0 comments on commit 95331f3

Please sign in to comment.