-
-
Notifications
You must be signed in to change notification settings - Fork 284
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 Metadata #1323
base: main
Are you sure you want to change the base?
Conversation
This is still coming in a little bigger than I would like it to but a lot of the line count is coming from the enums/extensions that are more volume than substance. I'm leaving this in draft for a sec because I'm under the weather this week and want to review this more in depth with a clear head. Primarily I want to look at:
|
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 moved to use the binding extensions like in #1313, so I'm sure we may get a merge conflict based on whatever is merged first. I had to add the NilIfEmptyStringFormatStyle
so that if a field was nil
, then just tapping on the field didn't "change" the value if I used coalesce
. We still have the issue of nil
values for dates, since DatePicker
can't take an optional binding, but that's okay. Also, if the description is nil
and the user taps on the field, it will coalesce to an empty string and indicate a change but I'm fine with that.
I think the order looks good and I'm not worried about the file structure.
Swiftfin/Views/ItemEditorView/EditMetadataView/Components/Sections/LockMetadataSection.swift
Outdated
Show resolved
Hide resolved
Swiftfin/Views/ItemEditorView/EditMetadataView/EditMetadataView.swift
Outdated
Show resolved
Hide resolved
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.
Leaving myself some notes on mobile to look at when I pick this back up on the computer.
Swiftfin/Views/ItemEditorView/EditMetadataView/Components/Sections/DateSection.swift
Outdated
Show resolved
Hide resolved
Swiftfin/Views/ItemEditorView/EditMetadataView/Components/Sections/DateSection.swift
Show resolved
Hide resolved
Swiftfin/Views/ItemEditorView/EditMetadataView/Components/Sections/DateSection.swift
Outdated
Show resolved
Hide resolved
Swiftfin/Views/ItemEditorView/EditMetadataView/Components/Sections/OverviewSection.swift
Outdated
Show resolved
Hide resolved
...tfin/Views/ItemEditorView/EditMetadataView/Components/Sections/ParentialRatingsSection.swift
Show resolved
Hide resolved
- Fix the notification when metadata was updated to work with 100% consistency - Flip the locking to be true -> lock like server - Redo the whole itemEditorViewModel to be more in-line with other viewModels | also fixes iPad weirdness - Use itemViewModel for the edit view so I can just reuse those existing notifications instead of recreating the wheel - More human dates for people - Date of death instead of "End date" (yikes)
#Conflicts: # Swiftfin/Views/ItemEditorView/EditMetadataView/Components/Sections/DateSection.swift # Swiftfin/Views/ItemEditorView/EditMetadataView/Components/Sections/LockMetadataSection.swift # Swiftfin/Views/ItemEditorView/EditMetadataView/Components/Sections/OverviewSection.swift
I think this mostly looks good! I've merged this to main and stomped out some of the build issues. I just went through a cleanup an I think there are only items I don't feel super confident in:
|
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.
Everything looks great just need the consolidation of the notification.
2 - passing in the view model is fine
4 - the picker looks good for now, I don't know what changes we'll need in the future but we'll deal with them then
5 - I agree an animation would look nice but that's difficult when the rows are the bottom and the scroll offset changes, I'm fine with a snap here
@@ -81,6 +81,8 @@ extension Notifications.Key { | |||
static let didFailMigration = NotificationKey("didFailMigration") | |||
|
|||
static let itemMetadataDidChange = NotificationKey("itemMetadataDidChange") |
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.
You're correct that this notification was mainly used for the user info since that would change after playback. Now these two notifications mean the same thing and do the same thing. I don't think we should have both, but we can change this notification to send the item instead in the future.
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.
For ItemViewModel, is this okay to consolidate [String: String] or Item.Id?
Notifications[.itemMetadataDidChange].publisher
.sink { [weak self] notification in
if let userInfo = notification.object as? [String: String] {
if let itemID = userInfo["itemID"], itemID == item.id {
Task { [weak self] in
await self?.send(.backgroundRefresh)
}
} else if let seriesID = userInfo["seriesID"], seriesID == item.id {
Task { [weak self] in
await self?.send(.backgroundRefresh)
}
}
} else if let itemId = notification.object as? String, itemId == self?.item.id {
Task { [weak self] in
await self?.send(.backgroundRefresh)
}
}
}
.store(in: &cancellables)
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 made the switch. It all seems to work both for userData updates and with metadata updates. The only interaction that's kind of off is if you edit an episode, going back to the season it's incorrect at the EpisodePicker level:
Simulator.Screen.Recording.-.iPad.Pro.13-inch.M4.-.2024-11-27.at.20.26.23.mp4
The only part of this that I'm not positive on is, I had to create another action on the itemViewModel for "replace" that takes the full baseItemDto and replaces it from a notification.
…le" menu object in the toolbar. Makes it easier to ensure that this format looks the same throughout.
@LePips What do you think of something like this as a viewModifier:
Since we'll now have this Menu in 3 spots: ItemView, ServerUsersView, and PagingLibraryView. I've included this in the latest commit. The isHidden is specifically so it can work for ServerUsersView where the ... gets replaced by a regular button in editMode. Otherwise, the isLoading is just to avoid the headache of making sure that is consistent throughout usage. Let me know if you have any changes or if this isn't a good route for this! |
… since we already have the bool available. Currently disabled.
Summary
Adds a section to the ItemEditorView to allow for manually changing most metadata. This does not include free-form content such as:
These will be added in a later PR to keep this from getting too large. These will require an editView & addView to allow deleting existing items or adding a new item to them. To simplify review, these can be seen here but I'll add these as a separate component when ready.
Screenshots
New Button
View pt. 1
View pt. 2
View pt. 3