-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
[tvOS] HomeView - Error Handling & Refreshing #1382
Conversation
commit adec8de Author: Joe Kribs <[email protected]> Date: Thu Jan 2 16:05:15 2025 -0700 [Meta] 2025 Disclaimer (jellyfin#1381)
commit adec8de Author: Joe Kribs <[email protected]> Date: Thu Jan 2 16:05:15 2025 -0700 [Meta] 2025 Disclaimer (jellyfin#1381)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to avoid additional usages of UIScreen.main
, even if tvOS is particularly on a single screen.
On iOS, we somewhat currently have static poster sizes (120, 300, etc.) that while not formal, we should keep to and not use computations screen widths. This mainly helps a lot with caching with negligent affects on the image quality. With that, we don't need to use maxWidth
as well as maxHeight
, just use maxWidth
.
The only reason I was doing this was because I wasn't sure how set width worked for tvOS. Is 500 a static size so it's 1" on a 10" TV (10%) and 1" on a 100" TV (1%) or is it proportional like 1" on the 10" screen and 10" on the 100" screen? |
There is no way to determine "inches" or any kind of physical measurement. We pass in the amount of points an image takes on the screen which then (currently) uses I will eventually change those translations to use |
…n the refresh/retry buttons. Move transitions from `.transition(.opacity.animation(.linear(duration: 0.2)))` to `.animation(.linear(duration: 0.1), value: viewModel.state)`
I went back to test on this branch again and I realized this was still not working as intended. My latest commit should resolve the My finding was that the The primary issue was the view would draw before the data was there or not there. So all the Finally, I added all of the child
And this works! The I'd appreciate some feedback but I'm trying to determine if this PR should just be Up for whatever works best! |
…`ContinueWatchingView` to mirror iOS. Ensure `RecentlyAddedView` is hidden if toggled off. Remove unused Focus.
This seems like an anti-pattern and why you had the views changing before data came back. Is there a reason why the section view models are nested within the home model? If the nesting is necessary my initial thought is to use a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still a few UIScreen.main
usages that should instead be changed to some static size.
For the changes to HomeViewModel
and HomeView
, I do know there are improvements that need to be made for how libraries are loaded and then presented but I don't think that this is it. I don't necessarily want to make explicit cases for the types of libraries (Homeview.CinematicRow
, hasResumeContent
, conditionalContentView
, etc., except for showRecentlyAdded
as a feature) which seems more error prone to any changes and maintenance and see a more general solution available.
For the tracking of library's state to change the HomeViewModel
state, polling is an okay workaround but has some issues. Most notably that if a single library errors then it will poll forever but I also don't think erroring the HomeViewModel
on an error is appropriate either. I have some other concerns with that observation implementation and would instead see if we could create a TaskGroup
with all of the library's tasks themselves. Or, I will want to investigate skeleton loading views.
I'm fine with the refresh button as I used to have a button just like that before, but I won't want that in the long run as a solution to being a manual refresh mechanism. The existing itemMetadataDidChange
notification observation and sinceLastDisappear
interval refreshing does good enough for now and can be improved.
The reason I took this approach was because we start having some spacing weirdness. Would the preferred solution be to make the If the |
For Skeleton Loading, are we talking about something like this loads then populates IF data exists then goes away if the data does not exist? Simulator.Screen.Recording.-.Apple.TV.4K.3rd.generation.-.2025-01-10.at.13.32.17.mp4I think I have that on my latest commit but there are still some items I want to work out in the interim. |
I do agree this should be the design, at least for now. I'm really trying to find a better way to articulate "I have the intention to largely refactor how the sections on home are loaded and presented" without being hand wavy and getting into details I don't currently have. Part of that is having a flat list of the sections to be presented and then (on tvOS) the first section is presented in the cinematic view. The refactor will be larger on iOS first, while tvOS will actually be a smaller change.
Similar to that, yes. However I would ask that we hold off on anything like that for a bit. |
Absolutely no worries at all! I can revert this back to just being the Primarily, my descent down the rabbit hole was the If we did want to proceed with the Either way works for me! |
Closing out in favor of a broader tvOS change. Additionally, I am going to be a bit busier in the coming months so I am closing this out to clear some of the outstanding PRs as I believe only the |
Summary
Creation of a
ErrorView
fortvOS
. Adds usage of theErrorView
for:This should mostly mirror iOS.
Since
PagingLibraryView
has an optional cinematic background, I addedColor.Clear
to the other views. Without it, theErrorView
was offset on theHomeView
which looked a little weird. See this offset below:Without Color.Clear Offset
Simulator.Screen.Recording.-.Apple.TV.4K.3rd.generation.-.2025-01-02.at.14.00.36.mp4
In addition to this, there were some issues with how the HomeView populated the recently added section. For whatever reason, you would always need to leave Home then come back to get that to populate. I moved it so on init the ViewModel is refreshed which resolves this issue. Let me know if this is not the base route. .onFirstAppear was consistently failing to load the Recently Added which is why I made this move.
Finally, since there is an option to hide the 'Recently Added' section, if there was no recently added, next up, and resume, you would end up with the first library item at the top of the screen due to the ignoreSafeAreas() which is required for cinematic background. I have just updated this so the top item is always cinematic, including if it's the first latest in library.
While I was in there, I added a
PosterType
input to make sure that the 'Poster Type' selection for top item was respected. When cinematic currently, it's always landscape. Now, it will use whatever the setting is.Demos
Server Offline
Simulator.Screen.Recording.-.Apple.TV.4K.3rd.generation.-.2025-01-02.at.13.52.23.mp4
Error Returned from Server
Simulator.Screen.Recording.-.Apple.TV.4K.3rd.generation.-.2025-01-02.at.14.04.18.mp4
Retrying Server
Simulator.Screen.Recording.-.Apple.TV.4K.3rd.generation.-.2025-01-02.at.14.02.21.mp4