This avoids the UI being "blocked" while saving the exported collection or
apkg, issue which becomes "visible" to the user when dealing with bigger
collections.
Used only in tests.
The initializer functions code used to create the models in StdModels
were refactored as standalone functions to be used by interested tests.
Note: StdModels were both used in unit and instrumented tests. As
there's only one usage in an instrumented test I duplicated the code
to avoid the use of the testlib.
The strings for the model names were removed because we don't need
translations for strings used in tests. The "front" and "back" names
are used in CardTemplateEditor, should probably be moved to one of
the other files to not have a strings file with just two strings in
it.
After reproducing #16702, I discovered that actually, the part of the
code where the NPE occurred should not have been reached.
newModel and oldModel are two distinct objects representing the same
note type. And JSonObject's equality is defined as pointer
equality. Using id instead of actual note type repair the bug.
Since, in AnkiDroid, editing the note type through the reviewer, can't
lead to adding or removing field, this is safe to consider that if the
id is equal, the objects are equal as far as the list of field is concerned.
I fear I don't see how to test it easily. It seems it require
AndroidTest and not unit tests, and I can't find example of note editor
test. Furthermore note editor will be replaced soon, so I don't expect
it's such a big deal.
* Fixed#16702
While searching for other uses of == instead of comparing id of note
type, I did some code cleaning.
* renaming some `m` to `notetype`
* deleting a unused constructor
* correcting a wrong documentation
* remove `deepcopy` (as it's the same result as `deepClone`)
required me to build release with production signing key locally
for upload vs on CI so I could manually work through foreground
service justification process on Play Console
I don't expect it was causing a bug, but `onKeyUp` almost always
returned false, even when the key press was handled.
This is now corrected.
I had trouble understanding the `selectFieldIndex` part. I hope I
improved it. Also added a unit test, given the simplicity of this part
of the code.
I wanted to test the remaining of KeyUtils, but got error messages,
telling me
java.lang.RuntimeException: Method getUnicodeChar in android.view.KeyEvent not mocked. See https://developer.android.com/r/studio-ui/build/not-mocked for details.
at android.view.KeyEvent.getUnicodeChar(KeyEvent.java)
at com.ichi2.utils.KeyUtils.getDigit(KeyUtils.kt:30)
I'd be interested in help if it's quick to do. But otherwise, it's not
worth losing time on it.
I found the code slightly unclear and tried to improve it.
* NotetypeBasicUiModel was not related to basic note types
* isStandard and useCount did not seem to me to have a clear meaning in anki lexicon, so must be document
* toUiModel can't be appled to a standard entry as far as I understand it, and is in any case never applied to a standard note type currently, so we can remove the argument.
This folder has not been updated once in 14 years, refers to a
data source that does not exists anymore, and would be used to provide
analytics we can probably get somewhere else.
I don't expect it's worth anyone time to try repairing it.
Closes#16695. Also simplify sligthly bug #16692.
* fix: share the updated text to note editor
* fix: cloze number to increment only in increment mode
Co-authored-by: David Allison <62114487+david-allison@users.noreply.github.com>
This fixes a bug where the user couldn't add a notetype with the name
of one of the standard notetypes(even if it didn't existed), because
the code checked the new name against the existing notetypes names +
the standard notetypes names so it behaved like the name already
existed.
The change makes the code look only at the existing notetypes names.
This differs from the legacy reviewer in four things:
1. It implements `Show reminder` as an action (it is a tooltip in Anki, so I made it a snackbar here)
2. It doesn't follow the global switch in settings, as Anki desktop doesn't have one and users complained about finding the global setting unexpected
3. There is now a `Question action` setting
4. The legacy reviewer has an issue where the same configuration is carried through all cards in the review session. So if a card with a different deck config shows up, the config won't be respected. This is fixed in the new reviewer
upload-artifact already compresses on upload, so this was an
ineffective double-compression from a space perspective, and worse
when you downloaded it you had to double-uncompress
in practice it is currently unused
it was added originally because github offered no way to delete caches
cache management (including delete) is possible using github web ui now though,
and it is all I've used for months