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

Refactor(MediaCheckDialog): Media check to use ViewModel #17943

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

criticalAY
Copy link
Contributor

@criticalAY criticalAY commented Feb 8, 2025

Purpose / Description

Migrates the logic of MediaCheck to ViewModel
Split the dialog logic, use different dialog for result and conformation

Fixes

Approach

Use ViewModel to handle the media check dialog and its result

How Has This Been Tested?

Tested on Google emulator API31
Screen_recording_20250220_045658.webm

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

github-actions bot commented Feb 8, 2025

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 Ref(MediaCheckDialog): Media check to use ViewModel Refactor(MediaCheckDialog): Media check to use ViewModel Feb 8, 2025
@criticalAY criticalAY added the Blocked by dependency Currently blocked by some other dependent / related change label Feb 8, 2025
@criticalAY criticalAY force-pushed the media-dialog-viewmodel branch from bc072d9 to 7a503ca Compare February 9, 2025 17:14
@criticalAY criticalAY force-pushed the media-dialog-viewmodel branch 2 times, most recently from 18ef3d5 to 6b62901 Compare February 10, 2025 13:52
@criticalAY criticalAY added Needs Review and removed Blocked by dependency Currently blocked by some other dependent / related change Has Conflicts labels Feb 10, 2025
@criticalAY criticalAY force-pushed the media-dialog-viewmodel branch from 6b62901 to 337a7d4 Compare February 17, 2025 20:42
@criticalAY criticalAY added the Needs Author Reply Waiting for a reply from the original author label Feb 19, 2025
@criticalAY criticalAY force-pushed the media-dialog-viewmodel branch 3 times, most recently from 93508d4 to 124a991 Compare February 19, 2025 23:25
@criticalAY criticalAY removed the Needs Author Reply Waiting for a reply from the original author label Feb 19, 2025
@criticalAY
Copy link
Contributor Author

criticalAY commented Feb 19, 2025

  • I have updated the latest test recording

To resolve the issue in

I am migrating the result from dialog to fragment. Why? Because the string builder is taking a lot of time to render strings i.e. 10k or 30k file names etc so its a heavy task for it, I have replicated the Anki behaviour in the fragment i.e. how it closes and how the user can interact with it

@criticalAY criticalAY force-pushed the media-dialog-viewmodel branch 2 times, most recently from 9090d16 to 37301c4 Compare February 19, 2025 23:47
@david-allison david-allison added the Review High Priority Request for high priority review label Feb 20, 2025
Copy link
Member

@lukstbit lukstbit left a comment

Choose a reason for hiding this comment

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

I don't see why you introduced the current granularity with the number of commits. Reverting any of the first three commits will render the other two commits useless as the content is tightly tied together. It also makes reviewing harder.

So please squash the first three commits into a single commit.

Requested some changes, the implementation seems fine.

android:id="@+id/file_name_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="11dp"
Copy link
Member

Choose a reason for hiding this comment

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

No, this needs to be sp or look into one of the textApperance styles.

Copy link
Member

Choose a reason for hiding this comment

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

This wasn't fixed.

R.string.check_media_delete_unused,
)

setOnClickListener {
Copy link
Member

Choose a reason for hiding this comment

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

This button shows a confirmation dialog before starting to delete and we should do this as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

Copy link
Member

Choose a reason for hiding this comment

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

This wasn't implemented, show an AlertDialog here and ask for confirmation and then initiate the delete process.

@lukstbit lukstbit added the Needs Author Reply Waiting for a reply from the original author label Feb 23, 2025
@criticalAY criticalAY force-pushed the media-dialog-viewmodel branch from 37301c4 to 6ef3989 Compare February 24, 2025 08:35
feat: add media check fragment file
- feat: adapter for media check result
- refactor: confirm media check dialog
@criticalAY criticalAY force-pushed the media-dialog-viewmodel branch from 6ef3989 to 425ac64 Compare February 24, 2025 09:01
- refactor: replace media check result dialog with fragment
- refactor: remove unused parameter in Media.kt
@criticalAY criticalAY force-pushed the media-dialog-viewmodel branch from 425ac64 to 961d458 Compare February 24, 2025 09:08
@criticalAY criticalAY removed the Needs Author Reply Waiting for a reply from the original author label Feb 24, 2025
@@ -1226,6 +1221,17 @@ open class DeckPicker :
}
}

private fun showMediaCheckDialog() {
Copy link
Member

Choose a reason for hiding this comment

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

Name proposal: showMediaCheckConfirmationDialog()

android:id="@+id/file_name_textview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="11dp"
Copy link
Member

Choose a reason for hiding this comment

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

This wasn't fixed.

R.string.check_media_delete_unused,
)

setOnClickListener {
Copy link
Member

Choose a reason for hiding this comment

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

This wasn't implemented, show an AlertDialog here and ask for confirmation and then initiate the delete process.

text =
TR.mediaCheckDeleteUnused().toSentenceCase(
requireContext(),
R.string.check_media_delete_unused,
Copy link
Member

Choose a reason for hiding this comment

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

This string is used only here. It should be removed from 03-dialogs.xml and added to sentence case xml.

@lukstbit lukstbit added the Needs Author Reply Waiting for a reply from the original author label Feb 27, 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 Review High Priority Request for high priority review Strings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

App becomes unresponsive after clicking Check media
3 participants