fix: missing media error on new study screen#20359
Open
HS0204 wants to merge 1 commit intoankidroid:mainfrom
Open
fix: missing media error on new study screen#20359HS0204 wants to merge 1 commit intoankidroid:mainfrom
HS0204 wants to merge 1 commit intoankidroid:mainfrom
Conversation
- Updated the new study screen logic to match the old screen. - The execution flags(hasExecueted) is reset to `false` when showing the answer so that missing media can be counted properly.
|
First PR! 🚀 We sincerely appreciate that you have taken the time to propose a change to AnkiDroid! Please have patience with us as we are all volunteers - we will get to this as soon as possible. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose / Description
In the new study screen, media errors were not being counted correctly. This caused the error snackbar to appear repeatedly, which could be annoying for users.
This was caused by
hasExecutednot being reset on card side changes. This PR restores the previous behaviour by aligning the logic with the old screen implementation. Snackbar will no longer be displayed in after being missing media error counted twice.Fixes
Approach
To minimise unexpected side effects, the logic of the new study screen was aligned with the old screen.
When media errors occur, the previous logic follows these steps:
processMissingMedia()inMediaErrorHandler.ktis called.missingMediaCountmay be incremented.hasExecutedflag plays an role in above process and must be reset whenever the card side changes.hasExecutedwas reset viaonCardSideChange()insidedisplayCardAnswer()inAbstractFlashcardViewer.ktwhen the card side changed.onCardSideChange()was missing, so it has been added.How Has This Been Tested?
MediaErrorHandlerTest. (honestly the logic isn't changed)Old Screen Recording
Previous New Screen Recording
Fixed New Screen Recording
Learning (optional, can help others)
hasExecutedmanagement intoMediaErrorHandler.ktto avoid relying on external updates. However, this would be a larger change than required for this issue, so I limited the fix to the current logic.hasExecuted. It seems that it was intended to manage media error counting per card rather than globally. While this could be improved, refactoring it would be exceed the scope of this issue. It may be better addressed in a separate task.Checklist
Please, go through these checks before submitting the PR.