Skip to content

Conversation

Isira-Seneviratne
Copy link
Member

@Isira-Seneviratne Isira-Seneviratne commented Feb 2, 2025

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

  • Display the stream uploader avatar on comments that they have replied to, similar to the YouTube app.
  • Refactored the video detail fragments to share a common view model, so that multiple network requests are not needed.

TODO:

  • Fix issues introduced by migrating video detail logic to the view model.
  • Migrate more backend logic from VideoDetailFragment to the view model.

Before/After Screenshots/Screen Record

Before After
Before After

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. You can find more info and a video demonstration on this wiki page.

Due diligence

@github-actions github-actions bot added the size/medium PRs with less than 250 changed lines label Feb 2, 2025
@AudricV AudricV added GUI Issue is related to the graphical user interface multiservice Issues related to multiple services comments Anything to do with comments and comment replies under videos/audios rewrite Issues and PRs related to rewrite labels Feb 2, 2025
Comment on lines 31 to 40
val streamState = url
.map {
try {
Resource.Success(ExtractorHelper.getStreamInfo(serviceId, it, true).await())
} catch (e: Exception) {
Resource.Error(e)
}
}
.flowOn(Dispatchers.IO)
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), Resource.Loading)
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this result in loading twice StreamInfo when VideoDetailFragment is loaded, as loading calls for player and comments would be concurrent?

If so, then this approach must be not be used due to the time and resources used to fetch info (especially for YouTube streams).

Copy link
Member Author

Choose a reason for hiding this comment

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

Couldn't the cache value be used instead, by setting the boolean to false?

Copy link
Member

Choose a reason for hiding this comment

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

No, the solution to this is to have the VideoDetailFragment pass the channel avatar URL to the comment section (null at the beginning, then set once video info load). This is probably hard to do now, but will be easy once the VDF is also written in Compose.

Copy link
Member

Choose a reason for hiding this comment

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

@Isira-Seneviratne for now could you make VideoDetailFragment pass a state flow to the comments fragment in some way, that allows the comments fragment to know about the currently selected uploader?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. I was planning to do some refactoring of the video detail fragment anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Stypox I have refactored the video detail related fragments to use a common view model.

Copy link

sonarqubecloud bot commented Jun 7, 2025

@TeamNewPipe TeamNewPipe deleted a comment from sonarqubecloud bot Jun 7, 2025
@TeamNewPipe TeamNewPipe deleted a comment from sonarqubecloud bot Jun 7, 2025
@github-actions github-actions bot added size/giant PRs with more than 750 changed lines and removed size/medium PRs with less than 250 changed lines labels Aug 31, 2025
@github-project-automation github-project-automation bot moved this to In Progress in Rewrite Aug 31, 2025
@Isira-Seneviratne Isira-Seneviratne force-pushed the Uploader-reply-indicator branch from d5f4fc9 to 6a66bcd Compare August 31, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comments Anything to do with comments and comment replies under videos/audios GUI Issue is related to the graphical user interface multiservice Issues related to multiple services rewrite Issues and PRs related to rewrite size/giant PRs with more than 750 changed lines
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants