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

Add support for comment replies #10018

Merged
merged 19 commits into from
Dec 23, 2023
Merged

Add support for comment replies #10018

merged 19 commits into from
Dec 23, 2023

Conversation

Stypox
Copy link
Member

@Stypox Stypox commented Apr 11, 2023

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

The most basic implementation of comment replies. The replies are shown in a fragment opened from the main activity, instead of on top of the video detail fragment. Although this might be a bit unexpected, this can be improved later, since I tried and found it too cumbersome to open fragments on top of each other*.

* Yet another broken thing in the current app architecture: opening new fragments from within one fragment. With the old Android APIs it would take something like 100 lines of code spread across many files, since you would have to create a stack of fragments in the base activity, then implement proper state saving in the stack, then push and pop items from the stack in the correct way, ... If we used the modern APIs instead, after the initial setup in the topmost activity, it would be as simple as writing something along the lines of findNavController(...).navigate(viewId, arguments).

Implementation notes

  • I removed the comment mini variant since it was never used. Now only one variant exists, which reduced code duplication and made it simpler to edit the layout to add the replies button.
  • The comment item layout had a few changes (other than adding the replies button) that fixed RTL warnings.
  • I moved RelatedItemsInfo in the same folder as RelatedItemsFragment, since it wouldn't make sense for that class to stay in util. I also simplified the code in that class. Although this is an unrelated change, I did it because I also added CommentRepliesInfo that works in a similar way, and put it in the same folder as CommentRepliesFragment.
  • At first I though that to load comment replies the extractor needed the original CommentsInfo object, so I made bb01da3, but then I found out that the url is enough, so I reverted that change in 50a3ae6.
  • The replies page has at the top the starting comment of which replies are shown. The text size there is a bit larger than for comment items, and the comment content is always expanded.
  • The only code smell reported by Sonar is about CommentInfoItemHolder.updateFromItem, but I would ignore this warning since I already simplified many parts of that method in 8bd42d9 and added comments to separate the various actions being performed.

Before/After Screenshots/Screen Record

Before Video details page Replies page With heart and pin
Before Video details page Replies page With heart and pin

Note to blog post writers: I just noticed these images contain some aggressive comments in Italian, so they need to be taken again

Fixes the following issue(s)

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.

This PeerTube video has nested replies, but they don't seem to work: https://share.tube/w/vxu4uTstUBAUromWwXGHrq.

Due diligence


Notes for the website team: make sure to modify the corresponding FAQ entry when updating the page for the release.

@Stypox Stypox mentioned this pull request Apr 11, 2023
5 tasks
@tsiflimagas
Copy link
Contributor

It works good and pagination works well too, I can load 500 comments. Though, I think that "List view mode" shouldn't affect the way comments are displayed (grid view for comments doesn't look well). Probably I'm ignoring that's an impact of how the fragment is opened, but idk the technical stuff.

@Stypox
Copy link
Member Author

Stypox commented Apr 12, 2023

I think that "List view mode" shouldn't affect the way comments are displayed

Thank you for noticing, now it's fixed :-)

The PR should now be ready

@Stypox Stypox force-pushed the comment-replies branch 2 times, most recently from a635746 to 2fdb259 Compare April 12, 2023 10:16
@TobiGr TobiGr added the feature request Issue is related to a feature in the app label Apr 12, 2023
@sonarcloud
Copy link

sonarcloud bot commented Apr 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@Stypox
Copy link
Member Author

Stypox commented Apr 12, 2023

@TobiGr this PeerTube video has nested replies, but they don't seem to be returned by the extractor: https://share.tube/w/vxu4uTstUBAUromWwXGHrq.

@nicoursi
Copy link

This is nice but there's a behaviour I think should be fixed: when comment replies are open, the android back button should just close the replies and not get back to the last video list.

@Stypox
Copy link
Member Author

Stypox commented Apr 14, 2023

That's an inconsistent behavior that is independent of this PR and is definitely strange. According to @opusforlife2 in Android the expected behavior for the top-left back button is to go to home, while the system back button should go to the previous fragment. This can be fixed in a separate PR.

@opusforlife2
Copy link
Collaborator

aggressive comments in Italian

xD

According to opus

Not me! I was just quoting!

@TobiGr
Copy link
Member

TobiGr commented Apr 16, 2023

@TobiGr this PeerTube video has nested replies, but they don't seem to be returned by the extractor: https://share.tube/w/vxu4uTstUBAUromWwXGHrq.

See TeamNewPipe/NewPipeExtractor#1052

@MD77MD
Copy link

MD77MD commented Apr 19, 2023

i think the approach in [Show comment replies #9410] by @xz-dev is much better because:

  1. it does not take us to a new page
  2. if we scroll down throw comments and finish reading a reply, going back will always take me to the top of the comments page then we need to scroll back to where we were.
  3. and most important, it open replies in an expandable/ retractable list that doesn't cut our flow off reading

198816463-3fbb757b-e897-432f-94d3-f381135fd57f

@Stypox
Copy link
Member Author

Stypox commented Apr 20, 2023

@MD77MD yes, if only it didn't have strange scrolling bugs and object cloning. I have already explained why this choice is being made.

@AudricV AudricV changed the title Comment replies Add support for comment replies Apr 25, 2023
@AudricV AudricV added bug Issue is related to a bug multiservice Issues related to multiple services playlist Anything to do with playlists in the app labels Apr 25, 2023
@Stypox Stypox requested a review from TobiGr August 12, 2023 10:40
@MD77MD
Copy link

MD77MD commented Aug 15, 2023

i hpoe this is not taken the wrong way, but this feature is implemented in another fork called pipepipe. perhaps you guys can take a look and see if they have managed to solve the scrolling problem stypox mentioned, or even improve on top of it in later updates. the link is down below

https://github.com/InfinityLoop1308/PipePipe

Copy link
Member

@TobiGr TobiGr left a comment

Choose a reason for hiding this comment

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

Annotations are missing. Once added, this can be merged

@Stypox
Copy link
Member Author

Stypox commented Aug 30, 2023

I think your commit does not provide a proper behaviour:

  • pressing the system back button correctly closes the replies fragment and brings you back to the video
  • pressing the back arrow at the top left of the screen does not close the replies fragment
  • when there are nested replies, going back correctly closes only the top fragment, but the video is always brought up even if you were looking at the replies of a nested comment, which is unexpected imo (you can test with the URL in the PR description)

@TobiGr TobiGr force-pushed the comment-replies branch 2 times, most recently from d7ecc48 to 81c4153 Compare August 31, 2023 13:01
@TobiGr
Copy link
Member

TobiGr commented Aug 31, 2023

I fixed the behaviour you pointed out above.

One thing that I noticed is that the DetailFragment is scrolled to top after it is expanded from the BottomSheetBehaviour. I pushed a second commit which should help us to scroll to the last clicked comment. However, when calling CommentsFragment.scrollToComment nothing happens. Any ideas why?

@ayyyiieneheuihues

This comment was marked as spam.

@Stypox Stypox force-pushed the comment-replies branch 2 times, most recently from 6000e23 to fb19270 Compare December 22, 2023 17:43
@TeamNewPipe TeamNewPipe deleted a comment from sonarcloud bot Dec 22, 2023
Copy link

sonarcloud bot commented Dec 22, 2023

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

2 New issues
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

@Stypox
Copy link
Member Author

Stypox commented Dec 22, 2023

I rebased, fixed various problems with going back from the replies fragment to the video details fragment, and added the @NonNull annotation as requested by @TobiGr's review. If nobody has anything against it, I will merge this PR as it is now. I might try to open another PR soon that implements PipePipe's behavior: #10018 (comment).

@AudricV AudricV added the size/giant PRs with more than 750 changed lines label Dec 22, 2023
@Stypox Stypox merged commit 2c1bb27 into TeamNewPipe:dev Dec 23, 2023
6 of 8 checks passed
@Stypox Stypox mentioned this pull request Apr 1, 2024
8 tasks
TobiGr added a commit to TeamNewPipe/website that referenced this pull request Apr 25, 2024
Update the FAQ entry according to the comment reply feature added in TeamNewPipe/NewPipe#10018
TobiGr added a commit to TeamNewPipe/website that referenced this pull request May 17, 2024
Update the FAQ entry according to the comment reply feature added in TeamNewPipe/NewPipe#10018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug feature request Issue is related to a feature in the app multiservice Issues related to multiple services playlist Anything to do with playlists in the app size/giant PRs with more than 750 changed lines
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

SoundCloud large playlist can’t load Display comment replies
10 participants