Skip to content

Conversation

@golfinq
Copy link

@golfinq golfinq commented Oct 14, 2021

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

Adds a "Show Replies" for the comments with replies for Youtube; when clicked, the first page of replies is displayed below the comment.

Before/After Screenshots/Screen Record

(Ignore the different themes)

  • Before:

  • After:

Before Clicking:

After Clicking:

Fixes the following issue(s)

Relies on the following changes

Due diligence

Copy link
Member

@AudricV AudricV left a comment

Choose a reason for hiding this comment

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

This review is from a quick look at your changes. I will not review your PR.

@TobiGr
Copy link
Contributor

TobiGr commented Oct 14, 2021

How do you load more reply pages? If I understand the code correctly, the current implementation only shows the first one.

@golfinq
Copy link
Author

golfinq commented Oct 15, 2021

How do you load more reply pages? If I understand the code correctly, the current implementation only shows the first one.

@TobiGr That is correct, I just implemented showing the first page of replies. I am not sure how I would go about showing the next page in actual implementation. I don't know where the next page URL is and I wouldn't be able to download it without running into NetworkOnMainThreadException

I figured out how to avoid the NetworkOnMainThreadException, but haven't figured out a good way to load additional pages

@triallax triallax changed the title Added "Show Replies" Show comment replies Oct 15, 2021
@triallax triallax added the feature request Issue is related to a feature in the app label Oct 15, 2021
@golfinq
Copy link
Author

golfinq commented Oct 22, 2021

I have the core functionality up and running

@BratishkaErik
Copy link

Can't wait to see this in app!

@opusforlife2
Copy link
Collaborator

@BratishkaErik if you have nothing to add to the discussion, please just react with a thumbs up to the PR.

@golfinq
Copy link
Author

golfinq commented Nov 4, 2021

Is there anything that reviewers/maintainers want from me/this pull request in order to get merged? I don't have a free time until next weekend to work on anything, but if there is anything to help this PR, it would be appreciated to know.

@opusforlife2
Copy link
Collaborator

@golfinq We just need a team dev to get enough free time to review this PR.

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

As I explain in the comments the structure needs some work, but it's nothing too difficult after all. Thank you for the PR :-)

android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textSize="@dimen/video_item_search_upload_date_text_size" />

<androidx.recyclerview.widget.RecyclerView
Copy link
Member

Choose a reason for hiding this comment

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

If I understood correctly TeamNewPipe/NewPipeExtractor#703, a reply-comment could have replies itself, but this PR introduces support only for 1 level of reply depth. This would work fine for YouTube, but it would be problematic for other services, so the replyRecyclerView should be added dynamically. Doing this might not be best practice, since the layouts recycled in recycler views should not be built dynamically, but since the amount of comments we expect users to open is much smaller than the total number of comments, I don't think creating a few more views every time an expanded comment is shown would hurt performance whatsoever. Note: if you do this remember to cleanup the recycler view previously created, if there is one, before creating a new one.

Copy link
Author

@golfinq golfinq Nov 21, 2021

Choose a reason for hiding this comment

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

I was hoping that by reusing the 'InfoListAdapter` the comment views which were created would automatically have the reply handling code inside of it. How are the comment views which are being created here different than the ones which are created in the main comment holding view?

if (item.getReplies() == null) {
repliesView.setVisibility(View.GONE);
showReplies.setVisibility(View.GONE);
} else if (item.getRepliesOpen()) {
Copy link
Member

Choose a reason for hiding this comment

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

As I said in the extractor, this method should be removed from there and implemented here in the frontend. The usual approach would be to create an item to use in the RecyclerView that wraps around CommentsInfoItem but also has a field isExpanded. This option is not viable, though, since in NewPipe lists use a common pattern to load, reload, etc., so changing the type of data fed to the recycler view without changing the type of data returned by the extractor is not doable without huge code changes (and we don't want those). A solution that would also be suitable for the multiple-depth replies implementation (see my other comment), would be to just keep a static Set<CommentsInfoItem> somewhere storing a common list of expanded CommentsInfoItems (common meaning that it will be accessed by all (even nested) RecyclerViews' CommentsInfoItem.updateFromItem()) . When the user expands a comment view the related CommentsInfoItem should be added to the Set, when the user unexpands the same comment it should be removed and when the RecyclerView tries to load a comment using CommentsInfoItemHolder.updateFromItem(item) it is expanded based on whether item belongs to the set.

Copy link
Member

Choose a reason for hiding this comment

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

@litetex do you have any idea whether this can be achieved in a better way, without storing any separate data in RecyclerViews (since that data would be lost when the comment view is recycled)?

Copy link
Member

Choose a reason for hiding this comment

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

@Stypox At first: Welcome back.
Whoa that's a lot of info.

do you have any idea whethe ...

No I don't - currently.

I think I would have to look at this in more detail to get an answer to that, however some ideas from my side to make nested commets working:

  • ViewModel which holds the data?
  • Write a custom Custom component for this?

Copy link
Member

Choose a reason for hiding this comment

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

@golfinq ping ;-)

Copy link
Author

@golfinq golfinq Nov 21, 2021

Choose a reason for hiding this comment

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

@Stypox @litetex

I guess I am not understanding the issue, is it moving the code which stores whether or not replies were opened should move here and that in turn would cause issues requiring lots of changes or that as it currently stands this code can't handle recursive levels of replies?

Copy link
Member

Choose a reason for hiding this comment

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

as it currently stands this code can't handle recursive levels of replies

This is what I could guess by looking at the code, but I might be wrong since I couldn't test. But the problem is also the fact that you shouldn't store data about whether the replies menu is open or not in an object coming from the extractor. The extractor shouldn't have anything to do with the UI.


import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
Copy link
Member

Choose a reason for hiding this comment

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

Is there a particular reason you added this code in CommentsInfoItemHolder and not CommentsMiniInfoItemHolder like all other comments code?

Copy link
Author

Choose a reason for hiding this comment

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

It was probably left over from something else I was trying to do, should be straight forward to move it to where it is used

@Stypox
Copy link
Member

Stypox commented Nov 22, 2021

Oh, btw @golfinq, could you fix the build so that I can take a look at the apk? I think you forgot to update the extractor commit

addRepliesToUI(parentInfoItem);
}

@SuppressLint("SetTextI18n")
Copy link
Member

Choose a reason for hiding this comment

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

There is a reason why Android Studio gives you this warning: you shouldn't hardcode strings, put them in the strings.xml resource file instead.

if (item.getReplies() == null) {
repliesView.setVisibility(View.GONE);
showReplies.setVisibility(View.GONE);
} else if (item.getRepliesOpen()) {
Copy link
Member

Choose a reason for hiding this comment

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

as it currently stands this code can't handle recursive levels of replies

This is what I could guess by looking at the code, but I might be wrong since I couldn't test. But the problem is also the fact that you shouldn't store data about whether the replies menu is open or not in an object coming from the extractor. The extractor shouldn't have anything to do with the UI.

@golfinq golfinq marked this pull request as draft November 28, 2021 18:43
@golfinq
Copy link
Author

golfinq commented Nov 28, 2021

I don't really have time at the moment to work on this, so I am going to convert it to a draft until I can properly work on everyone's suggestions.

@golfinq
Copy link
Author

golfinq commented Mar 12, 2022 via email

@opusforlife2
Copy link
Collaborator

@golfinq Then closing this PR for now. You can reopen it if/when you resume working on it.

@DUOLabs333
Copy link

DUOLabs333 commented May 27, 2022

I'm willing to work on this. Does Newpipe have a way for forks to build APKs with your CI service or does the build have to be local? What are the things that need to be fixed?

@triallax
Copy link
Contributor

You don't have to do anything to get the CI to build APKs for you; pushing a branch to your fork should be sufficient.

@DUOLabs333
Copy link

So, I just push, and it builds? Cool. So, what are the problems?

@triallax
Copy link
Contributor

I'm not too sure myself, but reading the comments and reviews here should give you an idea.

@DUOLabs333
Copy link

I'm going to start out with a rebase, just to get myself situated.

@DUOLabs333
Copy link

Will the actions be counted towards my limit or the team's limit?

@triallax
Copy link
Contributor

I believe there's no limit on public repositories.

@DUOLabs333
Copy link

I had to manually run it, it doesn't work on push.

@triallax
Copy link
Contributor

triallax commented May 27, 2022

Hmm, actually, I think it runs automatically only on push to a pull request branch or to master or dev. If you create a pull request from your branch to this repo, I think it will be run automatically.

@DUOLabs333
Copy link

Oh, ok. I'm getting some style errors, so I'm trying to fix that.

@DUOLabs333
Copy link

DUOLabs333 commented May 27, 2022

I somehow got public void addReplies after my rebase in CommentsInfoItemHolder.java when it doesn't exist in either dev or comment-replies.

@triallax
Copy link
Contributor

@DUOLabs333
Copy link

DUOLabs333 commented May 27, 2022

@DUOLabs333
Copy link

DUOLabs333 commented May 27, 2022

Oh, I messed up the rebase.

@DUOLabs333
Copy link

I'll open up a new PR.

@DUOLabs333 DUOLabs333 mentioned this pull request May 27, 2022
5 tasks
@DUOLabs333
Copy link

I just need approval to start running CI tests.

@Mhowser
Copy link

Mhowser commented Sep 23, 2022

@golfinq can this pull request be resurrected? Or are you still too busy?

@golfinq
Copy link
Author

golfinq commented Sep 23, 2022

There was some good work done on cleaning it up, but it really really needs someone who is familiar with the newpipe infrastructure (or someone who is willing to dig through it and learn how) to find out how to extract and implement the extraction for the 2nd page of replies. There was discussuon that the ui should be changed to a page which pulls up from the bottom which I like a lot more but I wouldnt know how to implement. As it stands the core stuff in this PR is okay, but async/java stuff isnt my strength right now and the people who would know the core code stuff are difficult to get responses from. I've kinda moved on from this and while I still do use newpipe; its kind of a mess to dig through the source code and figure out "okay to do this I use this class and then input this into this and need to call all of these functions and this data goes here and can be accessed with this class". If I was to work on this again I would want through documentation of everything, which is a lot of work. Dont blame NewPipe devs though as supporting youtube and everything else makes it very very difficult to do what NewPipe does and that requires complicated code.

@Mhowser
Copy link

Mhowser commented Sep 23, 2022

I appreciate the update on the current situation, thank you! There are some people at #2277 who might be able to finish what was started here.

@golfinq
Copy link
Author

golfinq commented Sep 23, 2022

I am glad to see people still trying to implement this! It's why my NewPipe Repo will never be deleted - as I think this PR was the furthest anyone got.

Just to add on my previous post: If anyone reading this has any android dev knowledge (or is willing to learn it) please write some API documentation for NewPipe. Even if you are a complete beginner, if you can read code and are willing to follow the "open source" trail for something in android studio - you can write documentation. Even basic, but organized, documentation help people become developers which means more active development overall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request Issue is related to a feature in the app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display comment replies

10 participants