forked from ankidroid/Anki-Android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix some bugs in the new previewer + some refactors (ankidroid#15297)
* refactor: extract NoteEditorDestination in the new previewer * refactor: move editCardResult handling to the view model the goal is to ease testing * refactor: extract WebViewClient creation in PreviewerFragment onViewCreated was getting to long * fix: do not open links inside the new previewer * refactor: inline PreviewerFragment menu items properties * refactor: add header comments in PreviewerViewModel debatable, but I think this may help organize stuff * hide answer if `backside only` is disabled to match the desktop behavior * refactor: extract getting card body class * refactor: make showAnswer() independent of showQuestion() Without a `bodyclass` argument, _showAnswer() only works if _showQuestion() was called before. Also, in the desktop code, _showQuestion() is always called before _showAnswer(). Given those facts and that I didn't notice that _showAnswer() could work independently * fix: `_showQuestion() not defined` appearing in logs currentIndex's collect block was being run before the webview was initialized * make CoroutineScope.launchCatching use `EmptyCoroutineContext` so it stays similar to `.launch {}` which uses `EmptyCoroutineContext` as well, which means that tasks are launched in the current thread if a coroutine context isn't provided * add launchCatchingIO helper * refactor: rename runCatchingTask `Task` wasn't being useful in the name * refactor: move Android dependencies of the new previewer to another file * rename: backside -> backSide
- Loading branch information
Showing
5 changed files
with
262 additions
and
221 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.