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
|
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 |
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.