Skip to content
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

Fix LibraryItem deep links #51

Closed
wants to merge 5 commits into from
Closed

Conversation

tymmesyde
Copy link
Member

@tymmesyde tymmesyde commented Oct 23, 2024

LibraryItem was using MetaItemDeepLinks instead of LibraryItemDeepLinks
The trait implementation did not passed the StreamsItem to the deeplink used for the player field
Moved the deeplinks to a designated file

@tymmesyde tymmesyde requested a review from TheBeastLT October 23, 2024 08:37
optional string meta_details_videos = 1;
optional string meta_details_streams = 2;
optional string player = 3;
optional ExternalPlayerLink external_player = 4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a use case where this would be needed, so not sure if we need a separate struct just for a variable that will not be used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was for simplicity and clarity, to match what is implemented in core so we don't have to come back to add things and overall just to not be confused

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But since the structure is the same, what's the point of having a separate object for it? Having the same one just makes it easier to deal with deeplinks, since in many places you have either MetaItem or LibraryItem. And deelinks property having the same type makes it easier to work with in strongly typed languages, rather than each time checking the type to access fields.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structure are not the same, LibraryItemDeepLinks has external_player MetaItemDeepLinks doesn't
I don't see how it makes it easier, for me it's just more confusing because it does not match core

Copy link
Contributor

@TheBeastLT TheBeastLT Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, you've removed it and then added again external_player, which like I mentioned doesn't have any use case in android (I'd even say that this is variable is misplaced and is breaking SRP, since it most likely should be used from a Stream rather than from library item).
Having unused variables just increases serialization/deserialization burden on low end devices when it needs to pass from rust to kotlin, and it is especially relevant as that's why protobuf was used to reduce the amount of data and objects travelling through rust-kotlin. But even with protobuf we should be vary of passing too much data (ie, this library item change, when fetching multiple pages of library will need to convert hundreds of items on each field event)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like you are arguing for the sake of it and i don't follow your logic so i will close this and make a new PR with only the fix for the player deeplink of the library item

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it's not arguing. Just trying to provide a review and insighs on what to be wary of when adding something to the structures.
Like I mentioned LibraryItem and MetaItemPreview are very sensitive structures, since we have to deserialize a ton of them on each event, so it's best to keep them as lean as possible and always be vary of adding new things to it's structure, as from experience it affects the performance quite a bit. So it's best to always think what variables will be used and needed for them (ie. we don't pass all the data from LibraryItemState, only what's needed and used)

@tymmesyde tymmesyde force-pushed the fix/library-item-deep-links branch from 39f88f5 to c53612d Compare October 23, 2024 10:41
@tymmesyde tymmesyde closed this Oct 23, 2024
@TheBeastLT TheBeastLT deleted the fix/library-item-deep-links branch October 24, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants