diff --git a/core/src/commonMain/kotlin/ua/syt0r/kanji/presentation/screen/main/screen/practice_letter/use_case/GetLetterPracticeQueueItemDataUseCase.kt b/core/src/commonMain/kotlin/ua/syt0r/kanji/presentation/screen/main/screen/practice_letter/use_case/GetLetterPracticeQueueItemDataUseCase.kt index bfdf15fb..aa19a4b6 100644 --- a/core/src/commonMain/kotlin/ua/syt0r/kanji/presentation/screen/main/screen/practice_letter/use_case/GetLetterPracticeQueueItemDataUseCase.kt +++ b/core/src/commonMain/kotlin/ua/syt0r/kanji/presentation/screen/main/screen/practice_letter/use_case/GetLetterPracticeQueueItemDataUseCase.kt @@ -3,6 +3,7 @@ package ua.syt0r.kanji.presentation.screen.main.screen.practice_letter.use_case import ua.syt0r.kanji.core.app_data.AppDataRepository import ua.syt0r.kanji.core.app_data.data.JapaneseWord import ua.syt0r.kanji.core.app_data.data.ReadingType +import ua.syt0r.kanji.core.app_data.data.withEmptyFurigana import ua.syt0r.kanji.core.app_data.data.withEncodedText import ua.syt0r.kanji.core.japanese.RomajiConverter import ua.syt0r.kanji.core.japanese.getKanaInfo @@ -50,8 +51,11 @@ class DefaultGetLetterPracticeQueueItemDataUseCase( ) } - val encodedWords = encodeWords(descriptor.character, words) - + val encodedWords = encodeWords( + character = descriptor.character, + words = words, + isReadingPractice = descriptor is LetterPracticeQueueItemDescriptor.Reading + ) return when (descriptor) { is LetterPracticeQueueItemDescriptor.Writing -> { @@ -158,9 +162,18 @@ class DefaultGetLetterPracticeQueueItemDataUseCase( } } - private fun encodeWords(character: String, words: List): List { + private fun encodeWords( + character: String, + words: List, + isReadingPractice: Boolean + ): List { return words.map { word -> - word.copy(readings = word.readings.map { it.withEncodedText(character) }) + word.copy( + readings = word.readings.map { + it.withEncodedText(character) + .let { if (isReadingPractice) it.withEmptyFurigana() else it } + } + ) } }