Skip to content

Tvos#5

Open
glemartret wants to merge 5 commits into
mainfrom
tvos
Open

Tvos#5
glemartret wants to merge 5 commits into
mainfrom
tvos

Conversation

@glemartret
Copy link
Copy Markdown
Owner

@glemartret glemartret commented Mar 11, 2026

📜 Description

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps


Note

Medium Risk
Adds tvOS-specific compilation paths for SDK init, frame tracking, and profiling APIs, which could impact platform-specific builds/behavior if conditions are wrong. Changes are mostly guarded by #if blocks and formatting, limiting runtime risk but increasing cross-platform compile risk.

Overview
Adds explicit tvOS support to SentryFlutterPlugin.swift, enabling auto performance tracing frame tracking and using UIApplication-based active state checks on tvOS, while also allowing native frame metrics (beginNativeFrames/endNativeFrames) to run on tvOS.

Disables profiler collection APIs on tvOS by guarding collectProfile/discardProfiler implementations, and refactors platform imports/displayRefreshRate compilation branches. Also includes non-functional formatting/SwiftLint-style cleanup (indentation, multiline literals) and narrows the TimeInterval.toMilliseconds() helper to fileprivate.

Written by Cursor Bugbot for commit 36f7b34. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Free Tier Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

result(windowScene.screen.maximumFramesPerSecond)
} else {
result(UIScreen.main.maximumFramesPerSecond)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing tvOS version in availability check causes potential crash

High Severity

The displayRefreshRate function is now compiled for tvOS (via the #else from the #if os(macOS) check), but the #available(iOS 13.0, *) check at line 765 doesn't list tvOS explicitly. In Swift, the * wildcard makes the condition always true on unlisted platforms regardless of OS version. On tvOS < 13.0, the code enters the block and accesses windowScene, which requires tvOS 13.0+, risking a runtime crash. The check needs to be #available(iOS 13.0, tvOS 13.0, *).

Fix in Cursor Fix in Web

result(FlutterError(code: "8", message: "Cannot collect profile: end time missing", details: nil))
return
}
#if !os(tvOS)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Profiler compilation guard mismatches switch case guard

Low Severity

The switch statement guard at line 144 uses #if !os(tvOS) && !os(watchOS) to exclude profiler cases, but the method definitions at line 691 use #if !os(tvOS) only. These guards are inconsistent — on watchOS, collectProfile and discardProfiler would be compiled but never callable from the switch, resulting in dead code. The guards need to match.

Additional Locations (1)
Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant