fix(change-note-types): don't discard undo queue#20249
Draft
david-allison wants to merge 5 commits intoankidroid:mainfrom
Draft
fix(change-note-types): don't discard undo queue#20249david-allison wants to merge 5 commits intoankidroid:mainfrom
david-allison wants to merge 5 commits intoankidroid:mainfrom
Conversation
**launchCatchingRequiringOneWaySync** - This didn't belong in the DeckPicker **userAcceptsSchemaChange()** - extract to a more centralized location **userAcceptsSchemaChange(col)** - delete; unused
Removed dead code Documented undo behaviour
Since we are no longer in Java, `ConfirmModSchemaException` is no longer a checked exception, so we can add in Anki's 'check' parameter Also improves documentation of the method Fixes 20246
… queue Renamed to launchCatchingRequiringOneWaySyncDiscardUndo For issue 20172
The backend method `changeNotetypeOfNotes` internally updates the schema does not not discard the undo queue. https://github.com/ankitects/anki/blob/83c615cc7f9aef3c336936fa797671965538f89c/rslib/src/notetype/notetypechange.rs#L216-L222 Before this PR, we called `modSchema()`, which updated the schema and discarded the undo/study queues Upstream Anki relies on implicit knowledge to handle backend methods which update the schema: they show a dialog if a schema change is needed, then call the backend method I attempted to introduce a 'guard context' (my terminology), using Kotlin's experimental context parameters so this check was enforced by code, but there was a dex issue: 20247 So I continued using Anki's approach: call `launchCatchingRequiringOneWaySync` before a backend method which modifies the collection I then removed the `modSchema(check = true)` call Fixes 20172
Member
Author
|
I wasn't aware, but the 'one-way sync' icon now disappears when the undo occurs. |
5 tasks
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
The backend method
changeNotetypeOfNotesinternally updates the schema does not not discard the undo queue.https://github.com/ankitects/anki/blob/83c615cc7f9aef3c336936fa797671965538f89c/rslib/src/notetype/notetypechange.rs#L216-L222
Before this PR, we called
modSchema(), which updated the schema and discarded the undo/study queuesFixes
Approach
Upstream Anki relies on implicit knowledge to handle backend methods which update the schema: they show a dialog if a schema change is needed, then call the backend method
I attempted to introduce a 'guard context' (my terminology), using Kotlin's experimental context parameters so this check was enforced by code, but there was a dex issue:
So I continued using Anki's approach: call
launchCatchingRequiringOneWaySyncbefore a backend method which modifies the collectionI then removed the
modSchema(check = true)callHow Has This Been Tested?
Learning (optional, can help others)
Loads of stuff in the stacked PR
Checklist