-
-
Notifications
You must be signed in to change notification settings - Fork 288
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
[iOS] Media Item Menu - Edit Arrays (People, Genres, Studios, & Tags) #1336
Conversation
…ting tags / genres should be secondary when editing & not selected
…here the suggestions fails to update on a letter entry
The validation portion of this is a 'nice to have' but if we want to cut it I'm not opposed. Jellyfin Web there is no validation but IMO, the validation is nice so you don't end up with several variants of tags / genres. Right now, the way it works is I populate all genres / tags when the viewModel refreshes. Then, I filter the full list to get 'suggestions' / validate if the genre / tag already exists. |
…n refresh then filterd locally instead of calling the server for changes.
I think there is room to make this more reusable. I'm having a bit of trouble figuring it out. So, one view for editXView that gives you existing [Element] list and editing. Then, a view for adding & validating inputs. |
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.
I like the "suggestions" feature, however these aren't really suggestions for creating a new item because they already exist. We should probably communicate instead that these values already exist.
Also, we shouldn't be performing linear string matching since tags can especially become large and can have very noticeable performance issues. We should use a trie for that, and implementing something similar to the one below is just fine.
https://www.kodeco.com/books/data-structures-algorithms-in-swift/v3.0/chapters/18-tries
What would be a better/more descriptive word than "Suggestions"? Right now I have "Matches". I can take a look at the trie as well! I'm traveling for work this week so that might be a weekend project. I just did a pretty major rewrite so studio, genre, tags, and people are all included and all share the same views using <Element: Hashable>. I've never used one of these before but it looks like it's working as intended! I want to clean up the logic more but I just wanted to make sure this was the right approach opposed to 4 different views? |
…ing operator with nil as rhs is redundant
Maybe |
At this point in time, I think I am done with the views and most of the data. Everything works how I would like it and I'm able to re-use the same views for all of the Item.[array] editing. I've added the ability to re-order the array as well so you can move actors around which appears to be working great as well. Otherwise, this is same as this was 8 commits ago but with some additional polish. I only have 3 items left:
|
You will want to take a look at debounce and how the
Instead of preventing the creation by disabling the button, we can still allow item creation even if the check hasn't happened. |
I think I'm done? It's definitely much better. Everything I'm looking to accomplish is done but it does feel just a tad off. If there is any feedback let me know! Here's the People Edit / Input: |
Alright! Final change on this should be done. I was just wrapping up some permission changes. jellyfin/jellyfin-web#6361, I realized that Collections show up in the 'Allow deletion from' options but that doesn't actually do anything. Being isAdministrator determines you ability to change this. I've structured item permissions a bit better since we have some user permissions in the userSession but we also have some user item permissions. It starts getting a little complicated some items like deletion are handled at a library level while downloads are handled at the user level. I've scaffolded out the other permissions we will eventually need as well:
This makes it
|
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.
I noticed we were trying to match search results with types, which used contains
to do n^2 searches. I changed the Trie to be able to hold key, element types to be able to search based on the key and get the resulting elements.
The ItemArrayElements
uses a lot of casting, there should be a way to use generics instead but I'm okay with this implementation for now.
I think the user permission structure is a good idea! It makes things cleaner with the many permissions and how they work together.
Summary
Creates views for editing / deleting / adding Genres & Tags in the ItemEditorView. Swipe to delete the item. Edit to multi-select/delete items. Add button takes you to the add view, where the input value is checked against the Server to validate whether it's a new Genre / Tag or the Add-Action will create a new item.
Since Genre has a lookup API, it has suggestions based on the current letters entered. Selecting a suggestion populates the input with that option.
Tags doesn't have have a search function. Instead, I am looking up all items where Tags contains the current input. So, I can tell the user if the current tag exists but getting suggestions isn't feasible unless there is a search that I'm not aware of.
These are grouped together since Genres & Tags are both just [String] so it's similar work between them.
Screenshots
New Button
Empty list
Tag Input / Validation
Genre Input / Validation 1
Genre Input / Validation 2
Genre Input / Validation 3
Item Editing 1
Item Editing 2
Item Editing 3