Conversation
BaseItemDto Editing CleanupBaseItemDto Editing Cleanup
|
This is a weird one. It's all kind of interconnected. There are some smaller ones I could break out like moving permissions over to the If there's anything we'd rather split out let me know. The goal was originally to fix #1869 but I kept finding things that needed clean up. The only part of this I'm not 100% confident in is the ItemEditorMenu. I like that it centralizes all of our editing logic and permission checks into 1 spot for both iOS and tvOS. It's much much cleaner BUT I don't know if making a struct for Menu Contents is good swift programming. |
0e0c84e to
a1ea7bd
Compare
…chView`. This will be used in both `AddItemElementView` and `AddServerUserAccessTagsView`
…l` have been rolled into `ItemEditorViewModel`
…s `ErrorView`. - Use `ErrorView` for `viewModel.state.content` - Use `.errorMessage($viewModel.error)` for `viewModel.events`. If there is no `.content`, IE the content is the full `BaseItemDto` which is already included, only have a `.errorMessage`. If there are no `.events` that we are looking for, don't include `.errorMessage`
a1ea7bd to
7342600
Compare
# Conflicts: # Shared/Objects/UserPermissions.swift # Shared/ViewModels/ItemAdministration/DeleteItemViewModel.swift # Shared/ViewModels/ItemAdministration/ItemEditorViewModel/GenreEditorViewModel.swift # Translations/en.lproj/Localizable.strings
Summary
Resolves: #1869
While trying to resolve #1869, I wanted to convert over the
ItemEditorViewModeland it's extensions to use the new@Statefulmacros. This led me to the views themselves which I created about a year ago. With what I know now, there is some room for improvement. The primary changes made:UserSessionto theBaseItemDto. The current usage of this was pretty bulky and required getting the permissions from a separate location using the item as an input. Instead, this just puts the permissions directly on theBaseItemDtosince that's the only place where these can be used anyway.PlayButtonif the user does not have permission to play content from Jellyfin. I don't imagine this comes up often. I am only aware of this because I have an admin account that doesn't have playback permission and this button throws a non-descriptive error from the server. Hiding the button seems like the cleaner solution.ItemEditorMenustruct. The menu dropdown items are the same between iOS and tvOS (kind of) so this lets us keep all the permission logic and routing in a single spot for later.ItemDeletionView. Especially for Series, it can be hard to determine what specifically you are deleting. This gives the full count of items deleted, and the type/details. This should help prevent any heartache where someone thinks they are deleting an episode but delete a series.EditItemElementViewModelss, I've changef this from using a trie to instead just do a search and debounce. This is more performant for items where searching is available. Tags cannot do this so that will still use the trie.EditItemElementViews, was broken where I could re-add the same genre, tag, studio, or person unlimited times. This blocks adding duplicates to the same item now.AdminDashboardView/Components/MediaItemSection.swift->/Components/ItemFormSection.swiftsince this is used outside of theAdminDashboardnow. It's a good way to displayBaseItemDtoin a form so this helps with re-use.RefreshMetadataViewModelsince we don't have the progress anymore. Eventually, most of this will be deleted since the websocket will be able to get the refreshed item instead of use counting to 5 and manually refreshing.ItemEditorViewI'm just purely leaving that as admin edit actions and moving subtitles (non-admin) and refresh Metadata functionality to the dropdown. It makes the permissions a bit easier to handle and centralizes the tvOS and iOS permission checks.navigationBarCloseButtonfor tvOS. We can make one here but I don't see a benefit since the natural interaction is the back button.AddServerUserAccessTagsViewsince we are doing tag searches with the same ViewModel there so that should reflect the Metadata editingTODOs
DeleteItemViewModelover to use the new@Statefulmacros but I think thisViewModelshould just get rolled into eitherItemEditorViewModelorItemViewModelinstead. I held off until after Posters, Libraries, Home #1752 if that is the best route. I just feel as though a wholeViewModelfor a single deletion function is overkill.Videos
Please note these only return a 404 because the test file I am using doesn't exist. I added the entry manually so there is no actual file to delete hence 404
tvOS
Simulator.Screen.Recording.-.Apple.TV.-.2025-12-21.at.00.50.30.mov
iOS
Simulator.Screen.Recording.-.iPhone.-.2025-12-21.at.14.33.01.mov
Image
iOS Episode
tvOS Series