Repository navigation
Apple TV (tvOS) support - #2411
Draft
TheNoumanDev wants to merge 4 commits into
Draft
TheNoumanDev wants to merge 4 commits into
TheNoumanDev wants to merge 4 commits into
Conversation
- Add isAppleTV detection and an Apple TV storage directory (Library/Caches, falling back to tmp), since Documents isn't writable on hardware. - Store the CDN manifest (encrypted envelope) in a file on Apple TV instead of SharedPreferences, which tvOS aborts on past ~1 MB. - Create GetStorage boxes in the Apple TV directory. - Keep the CDN asset cache and the image cache database in the Apple TV directory, since Application Support can't be created on hardware. - Report Apple TV as isTV; add isAndroidTV / isTvOS device getters. - Skip Workmanager init on Apple TV (no tvOS implementation).
flutter-tvos sends the Siri Remote Menu button only as a system Back (popRoute), so goBack key handlers never ran on Apple TV. AppleTVBackBridge first sends a goBack key press (down, then up) through the focus tree; if the key-up is handled, Menu stops there, otherwise the system Back goes ahead. This is the same order as on Android TV. Does nothing outside Apple TV; the host calls install() before runApp.
TV focus scrolling compared screen positions (localToGlobal) with sizes and scroll offsets. When the host scales its UI, as KPN does on Apple TV (a 960x540 layout drawn 2x), screen positions are scaled and the rest is not, so visible items looked off-screen: pages jumped and lanes lost their leading margin. Measure the item in the scrollable's coordinates instead (rectInScrollable). Unscaled hosts get the same result as before. The horizontal helpers move from box_wrapper to tv_focus_scroll so they can be tested; tests run every case at 1x and with a 2x host scale.
flutter-tvos keeps semantics on without VoiceOver, so every scrollable offers scrollToOffset and showOnScreen, and the focus engine used them while Ensemble was scrolling the same list: short lanes jerked and pages jumped past their end. On Apple TV, lists now don't allow implicit scrolling unless VoiceOver is on, and clamp like Android TV instead of bouncing. Applied through the MaterialApp scroll behavior, to lists with their own physics, and to asExternal screens on the host navigator. Other platforms are unchanged.
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Lets Ensemble apps run on Apple TV (via flutter-tvos), with the same TV behaviour as Android TV. Other platforms are unchanged.
isAppleTV) and treat it as a TV.goBackkey handlers first get a key press, as on Android TV (AppleTVBackBridge, installed by the host).asExternalscreens.Tests added for each change, run for Apple TV and for other platforms. Two TabBar tests (
tab_bar_back_focus_test,tab_bar_index_test) already fail onmain.Open: ChartJs needs a WebView, which tvOS doesn't have.