fix(download): hook downloadDeleteEvent in BaseFetchButton to reset UI on cancel#2598
fix(download): hook downloadDeleteEvent in BaseFetchButton to reset UI on cancel#2598LeC-D wants to merge 1 commit intorecloudstream:masterfrom
Conversation
fire-light42
left a comment
There was a problem hiding this comment.
Please review our AI Policy https://github.com/recloudstream/cloudstream/blob/master/AI-POLICY.md
|
Hi @fire-light42, thanks for pointing to the AI policy. To be transparent: this fix was developed with AI assistance (GitHub Copilot / Claude for context exploration). I'm fully responsible for understanding and verifying the code — the approach directly mirrors the existing Let me know if you have any concerns about the implementation itself! |
|
Updated the PR description to include the AI usage disclosure directly in the body, as required by the AI Policy. Thanks for flagging this, @fire-light42! |
|
Rebased on upstream |
|
Thank you for your contribution! I will test and review soon. The code looks good, but getting these things right can be tricky. Do not concern yourself with merge conflicts or keeping the branch up to date, I will resolve any conflicts if necessary 👍 |
Fixes #1227
Problem
When a download is cancelled from a notification, the download button UI (in episode list, result screen, etc.) is not updated. The button keeps showing a stale download state instead of resetting.
Root cause
downloadDeleteEventwas implemented as a stub inBaseFetchButtonbut the event subscription was commented out inonAttachedToWindow/onDetachedFromWindow, so the callback was never invoked.Fix
downloadDeleteEvent(data: Int): when the deleted ID matchespersistentId, callresetView()to bring the button back to its initial state.VideoDownloadManager.downloadDeleteEventinonAttachedToWindow.onDetachedFromWindowto avoid memory leaks.This pattern is identical to how
downloadStatusEventanddownloadProgressEventare already handled in the same class.AI Usage Disclosure
This fix was developed with AI assistance (GitHub Copilot / Claude for context exploration), per the project's AI Policy. I am fully responsible for understanding and verifying the code. The approach directly mirrors existing patterns already in
BaseFetchButton, and the change has been manually reviewed and tested.