-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 ForgetCardsDialog and potentially fix a bug #17176
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I'm okay with both the refactor (despite its size) and of course the bug fix (that one is tiny + appears obvious in diff view)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactoring is great
One question from an unusual, but correct line of code
Treat this as an approval if either a comment is added, or undoableOp
is used
AnkiDroid/src/main/java/com/ichi2/anki/scheduling/ForgetCardsDialog.kt
Outdated
Show resolved
Hide resolved
The refactoring mainly removes the associated ViewModel as it only had two simple properties and a method to call an activity method to do its work. ForgetCardsDialog was refactored: - simplify the dialog customization - simplify the dialog itself by removing the need to pass the target cards ids. With these changes the dialog becomes a simple UI panel from which the user to select his desired options. The cards ids are fetched by the activity itself when they are actually needed - use modern communication(FragmentResult) between the dialog fragment and the holder activity doing the work - create utility methods so activities using the dialog can easily do so
The call scheduler.forgetCards() produces OpChanges for: browser_table: true card: true mtime: true study_queues: true
b6d3f0d
to
07303e9
Compare
Review request was handled, used undoableOp
Purpose / Description
First commit is a refactoring for the code around ForgetCardsDialog, looked verbose for what it was doing.
Second commit is an attempt to fix the linked issue. With that change when the current card's progress is reset the reviewer removes the card and changes the counts. This seems to be the behavior on desktop, at least from what I saw. I'm not sure about this, but I also don't see any issues with having that call in production.
There are no UI changes but just to be transparent:
Fixes
How Has This Been Tested?
Ran the tests, everything seems to work.
Checklist