Skip to content

Comments

Fix: Limit missing media snackbar to 2 times in new study screen #20357

Open
Mahakbajpai wants to merge 1 commit intoankidroid:mainfrom
Mahakbajpai:fix-missing-media-message
Open

Fix: Limit missing media snackbar to 2 times in new study screen #20357
Mahakbajpai wants to merge 1 commit intoankidroid:mainfrom
Mahakbajpai:fix-missing-media-message

Conversation

@Mahakbajpai
Copy link

Purpose / Description

In the new study screen, the missing media snackbar was being displayed repeatedly for every missing media event. This behavior was inconsistent with the old study screen.

This PR aligns the new study screen behavior with the old study screen by limiting the missing media snackbar display to a maximum of 2 times per card.

Fixes

Fixes #20347

Approach

  • Removed redundant hasExecuted state from MediaErrorHandler
  • Introduced controlled limiting using missingMediaCount
  • Ensured snackbar is displayed at most MAX_DISPLAY_TIMES = 2
  • Verified behavior matches old study screen

How Has This Been Tested?

Tested manually on:

  • New study screen
  • Old study screen
  • Card flip (front/back)
  • Multiple cards
  • Repeated audio playback attempts

Result:

  • Snackbar displays at most 2 times per card
  • No infinite repetition
  • Behavior consistent across study modes

@welcome
Copy link

welcome bot commented Feb 23, 2026

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.

@HS0204
Copy link
Contributor

HS0204 commented Feb 23, 2026

Hi, I'm not reviewing but since I've been waited to be assigned to this issue, so I'm commenting on it.

It looks like the logic has changes, so the unit tests need to be updated accordingly! I also recommend keeping the copyright.

When I worked on this, I just added onCardSideChange function to CardViewerViewModel because I was concerned about changing the existing logic. If the logic is being modified, it might be helpful to briefly explain the intention in PR description or approach. Just my opinion 😀 Thanks!

Additionally it'd be better if the commit length could be a bit shorter 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[New study screen] Missing media message appears repeatedly

2 participants