Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve Check Media dialog #17842

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

criticalAY
Copy link
Contributor

Purpose / Description

Make the media check dialog consistent with Anki, and allow tagging missing media file notes

Fixes

How Has This Been Tested?

image
Screenshot 2025-01-20 at 1 58 40 AM

Learning (optional, can help others)

More about the Anki codebase

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Copy link
Contributor

Important

Maintainers: This PR contains Strings changes

  1. Sync Translations before merging this PR and wait for the action to complete
  2. Review and merge the auto-generated PR in order to sync all user-submitted translations
  3. Sync Translations again and merge the PR so the huge automated string changes caused by merging this PR are by themselves and easy to review

@criticalAY criticalAY changed the title feat: Improve Check Media feat: Improve Check Media dialog Jan 19, 2025
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue with tagMissing, but this is great!

@@ -33,6 +36,8 @@ class MediaCheckDialog : AsyncDialogFragment() {
fun mediaCheck()

fun deleteUnused(unused: List<String>)

fun tagMissing(missingMediaNotes: List<Long>?)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the ViewModel, or a Fragment listener, we want to move away from interfaces

Comment on lines +114 to +132
val noHaveFormatted = noHave.joinToString("\n") { TR.mediaCheckMissingFile(it) }
val unusedFormatted = unused.joinToString("\n") { TR.mediaCheckUnusedFile(it) }

val formattedList =
buildString {
if (noHaveFormatted.isNotEmpty()) {
append(TR.mediaCheckMissingHeader())
append("\n")
append(noHaveFormatted)
append("\n\n")
}

if (unusedFormatted.isNotEmpty()) {
append(TR.mediaCheckUnusedHeader())
append("\n")
append(unusedFormatted)
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be useful to extract to a method so we can test it

@@ -196,6 +239,7 @@ class MediaCheckDialog : AsyncDialogFragment() {
UNUSED to ArrayList(checkList.unusedFileNames),
INVALID to ArrayList(checkList.invalidFileNames),
MEDIA_CHECK_DIALOG_TYPE_KEY to dialogType.code,
MISSING_MEDIA_NOTES to ArrayList(checkList.missingMediaNotes).toList(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will eventually throw a TransactionTooLargeException. When?

Comment on lines +114 to +116
val noHaveFormatted = noHave.joinToString("\n") { TR.mediaCheckMissingFile(it) }
val unusedFormatted = unused.joinToString("\n") { TR.mediaCheckUnusedFile(it) }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name the arguments

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Author Reply Waiting for a reply from the original author Needs Review Strings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Check Media: tag cards + show list of media references
2 participants