feat(player): show Bangumi episode comments - #68
Conversation
|
Warning Review limit reached
Next review available in: 94 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAdds Bangumi episode comment models, HTML retrieval and parsing, scraper and dependency-injection wiring, paginated playback state, and a TV comments panel with focus navigation, spoilers, images, retries, and pagination. ChangesBangumi episode comments
Estimated code review effort: 4 (Complex) | ~60 minutes Mergeability Score: 🟡 Moderate · up to The comments panel can still accept IPv4-mapped addresses that reach loopback or private hosts, and an older request can overwrite state for a newer playback session. These can expose local network targets or show stale panel state, so the PR is not merge-ready until the security and session-state issues are fixed; runtime compatibility and focus behavior also need owner follow-up. Sequence Diagram(s)sequenceDiagram
participant Viewer
participant PlayerScreen
participant PlayerViewModel
participant BangumiScraper
participant BangumiApiClient
participant BangumiCommentsPanel
Viewer->>PlayerScreen: Open comments
PlayerScreen->>PlayerViewModel: loadEpisodeComments()
PlayerViewModel->>BangumiScraper: getEpisodeComments(episodeId)
BangumiScraper->>BangumiApiClient: Fetch episode comments
BangumiApiClient-->>PlayerViewModel: Parsed comment Result
PlayerViewModel-->>BangumiCommentsPanel: EpisodeCommentsUiState
BangumiCommentsPanel-->>Viewer: Render comments and pagination
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
ui-tv/src/test/kotlin/com/miruplay/tv/ui/player/PlayerTimelineFocusTest.kt (1)
63-83: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winTest the comments fallback branch.
This test provides one audio track, so focus moves to the audio action. It does not execute the new fallback at
PlayerScreen.ktLine 1141. Add a case with empty audio and subtitle lists, then assert that the “评论” action receives focus after pressing Down.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ui-tv/src/test/kotlin/com/miruplay/tv/ui/player/PlayerTimelineFocusTest.kt` around lines 63 - 83, The PlayerTimelineFocusTest currently exercises audio focus instead of the comments fallback. Add a test case using empty audioTracks and subtitles, trigger the Down navigation from the timeline, and assert that the “评论” action receives focus while preserving the existing test behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@gradle/libs.versions.toml`:
- Line 31: Update the Android app module configuration to enable core-library
desugaring and add the required NIO desugared library dependency for Jsoup
1.23.1. Configure the desugaring dependency using the existing version-catalog
Jsoup setup, ensuring the app packaging scraper-core can compile and run with
the required APIs.
In `@ui-tv/src/main/kotlin/com/miruplay/tv/ui/player/BangumiCommentsPanel.kt`:
- Around line 66-69: Update the LaunchedEffect in BangumiCommentsPanel so its
keys use state.comments.isNotEmpty() and state.errorMessage instead of the
complete state.comments list, preserving the existing focus request condition
for initial content and errors while preventing pagination appends from
resetting focus.
- Around line 287-312: Update safeBangumiCommentImageUrl to detect IPv4-mapped
IPv6 hosts, normalize the embedded IPv4 address, and run it through the existing
IPv4 local-target checks so mapped loopback, private, link-local, and
unspecified addresses are rejected. Preserve current handling for other IPv6 and
hostname inputs, and add corresponding cases to BangumiCommentsPanelTest.
In `@ui-tv/src/main/kotlin/com/miruplay/tv/ui/player/PlayerViewModel.kt`:
- Around line 253-263: In the comment-loading coroutine around getCachedEpisode
and the _episodeComments updates, re-check that the source remains active and
episodeCommentsGeneration is still current immediately after the metadata
lookup. Return without updating state when either guard fails, before applying
the missing-Bangumi error or isLoading=true.
---
Nitpick comments:
In `@ui-tv/src/test/kotlin/com/miruplay/tv/ui/player/PlayerTimelineFocusTest.kt`:
- Around line 63-83: The PlayerTimelineFocusTest currently exercises audio focus
instead of the comments fallback. Add a test case using empty audioTracks and
subtitles, trigger the Down navigation from the timeline, and assert that the
“评论” action receives focus while preserving the existing test behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 5c92e3cb-fd0d-405a-a7d3-12e66432ec90
📒 Files selected for processing (15)
app/build.gradle.ktsgradle/libs.versions.tomlrepository-api/src/main/kotlin/com/miruplay/tv/repository/BangumiEpisodeComments.ktscraper-core/build.gradle.ktsscraper-core/src/main/kotlin/com/miruplay/tv/scraper/core/BangumiApiClient.ktscraper-core/src/main/kotlin/com/miruplay/tv/scraper/core/BangumiEpisodeCommentHtmlParser.ktscraper-core/src/test/kotlin/com/miruplay/tv/scraper/core/BangumiApiClientTest.ktscraper-core/src/test/kotlin/com/miruplay/tv/scraper/core/BangumiEpisodeCommentHtmlParserTest.ktscraper/src/main/kotlin/com/miruplay/tv/scraper/BangumiScraper.ktscraper/src/main/kotlin/com/miruplay/tv/scraper/di/ScraperModule.ktui-tv/src/main/kotlin/com/miruplay/tv/ui/player/BangumiCommentsPanel.ktui-tv/src/main/kotlin/com/miruplay/tv/ui/player/PlayerScreen.ktui-tv/src/main/kotlin/com/miruplay/tv/ui/player/PlayerViewModel.ktui-tv/src/test/kotlin/com/miruplay/tv/ui/player/BangumiCommentsPanelTest.ktui-tv/src/test/kotlin/com/miruplay/tv/ui/player/PlayerTimelineFocusTest.kt
Summary
Implementation
Verification
./gradlew test lint :app:assembleDebug(1160 tasks, successful)./gradlew :scraper-core:test :ui-tv:testDebugUnitTest :ui-tv:lint :app:assembleDebuggit diff --checkadb install -r; verified DPAD focus reaches Comments, error/retry focus, panel back handling, and no crash without clearing app dataSummary by CodeRabbit
New Features
Security
Tests