From 6a590344de90180c0871844bfbc567b20e05e15e Mon Sep 17 00:00:00 2001 From: Antoine Jaury Date: Wed, 1 Jul 2026 17:39:06 +0200 Subject: [PATCH] refactor: centralize domain models into `core.model` module --- .../records/data/InMemoryRecordRepository.kt | 123 ++++++++++++++---- .../ajaury/gwenedeg/records/ui/RecordView.kt | 11 +- 2 files changed, 103 insertions(+), 31 deletions(-) diff --git a/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/records/data/InMemoryRecordRepository.kt b/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/records/data/InMemoryRecordRepository.kt index f872ca0..83cf4ea 100644 --- a/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/records/data/InMemoryRecordRepository.kt +++ b/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/records/data/InMemoryRecordRepository.kt @@ -1,44 +1,113 @@ package fr.ajaury.gwenedeg.records.data -import fr.ajaury.gwenedeg.records.domain.RecordRepository +import fr.ajaury.gwenedeg.core.model.Phrase import fr.ajaury.gwenedeg.core.model.Record +import fr.ajaury.gwenedeg.records.domain.RecordRepository import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flowOf class InMemoryRecordRepository : RecordRepository { private val records = listOf( - "An onestiz" to "La politesse", - "En em brezantiñ" to "Se présenter", - "An amzer a ra" to "Le temps qu'il fait", - "E komz get unan arall" to "Parler avec quelqu'un d'autre", - "Me hag ar brezhoneg" to "Moi et le breton", - "Ar yec'hed" to "La santé", - "Deskriviñ" to "Décrire", - "Me 'gar / Ne garan ket" to "J'aime / Je n'aime pas", - "C'hoantoù" to "Les envies", - "Penaos 'peus kavet...?" to "Comment as-tu trouvé... ?", - "Oberiantizoù" to "Les activités", - "Debriñ hag evet" to "Manger et boire", - "Bale, pourmen ha beajiñ" to "Marcher, se promener et voyager", - "Ma c'horf (1)" to "Mon corps (1)", - "Ma c'horf (2)" to "Mon corps (2)", - "Dle eo / ret eo / dav eo / mall eo..." to "Il faut que... / Il est temps que (de) ...", - "Deizioù ar sizhun" to "Les jours de la semaine", - "Mizioù ha kourzoù ar blez" to "Les mois et les saisons de l'année", - "Bez'zo / N'eus ket..." to "Il y a / Il n'y a pas...", - "Banne.../Tamm..." to "Un peu...", - "Stad a vuhez (1)" to "Situation de vie (1)", - "Stad a vuhez (2)" to "Situation de vie (2)", - "Lec'hiiñ" to "Situer", - ).mapIndexed { index, (title, titleTranslation) -> + Phrase( + transcription = "An onestiz", + translation = "La politesse", + ), + Phrase( + transcription = "En em brezantiñ", + translation = "Se présenter", + ), + Phrase( + transcription = "An amzer a ra", + translation = "Le temps qu'il fait", + ), + Phrase( + transcription = "E komz get unan arall", + translation = "Parler avec quelqu'un d'autre", + ), + Phrase( + transcription = "Me hag ar brezhoneg", + translation = "Moi et le breton", + ), + Phrase( + transcription = "Ar yec'hed", + translation = "La santé", + ), + Phrase( + transcription = "Deskriviñ", + translation = "Décrire", + ), + Phrase( + transcription = "Me 'gar / Ne garan ket", + translation = "J'aime / Je n'aime pas", + ), + Phrase( + transcription = "C'hoantoù", + translation = "Les envies", + ), + Phrase( + transcription = "Penaos 'peus kavet...?", + translation = "Comment as-tu trouvé... ?", + ), + Phrase( + transcription = "Oberiantizoù", + translation = "Les activités", + ), + Phrase( + transcription = "Debriñ hag evet", + translation = "Manger et boire", + ), + Phrase( + transcription = "Bale, pourmen ha beajiñ", + translation = "Marcher, se promener et voyager", + ), + Phrase( + transcription = "Ma c'horf (1)", + translation = "Mon corps (1)", + ), + Phrase( + transcription = "Ma c'horf (2)", + translation = "Mon corps (2)", + ), + Phrase( + transcription = "Dle eo / ret eo / dav eo / mall eo...", + translation = "Il faut que... / Il est temps que (de) ...", + ), + Phrase( + transcription = "Deizioù ar sizhun", + translation = "Les jours de la semaine", + ), + Phrase( + transcription = "Mizioù ha kourzoù ar blez", + translation = "Les mois et les saisons de l'année", + ), + Phrase( + transcription = "Bez'zo / N'eus ket...", + translation = "Il y a / Il n'y a pas...", + ), + Phrase( + transcription = "Banne.../Tamm...", + translation = "Un peu...", + ), + Phrase( + transcription = "Stad a vuhez (1)", + translation = "Situation de vie (1)", + ), + Phrase( + transcription = "Stad a vuhez (2)", + translation = "Situation de vie (2)", + ), + Phrase( + transcription = "Lec'hiiñ", + translation = "Situer", + ), + ).mapIndexed { index, phrase -> val number = index + 1 val paddedNumber = number.toString().padStart(2, '0') Record( id = number, index = number, - title = title, - titleTranslation = titleTranslation, + title = phrase, audioResourcePath = "files/Chom_bev_$paddedNumber.m4a", subtitleResourcePath = "files/Chom_bev_${paddedNumber}_st_bzh.lrc", translationSubtitleResourcePath = "files/Chom_bev_${paddedNumber}_st_fr.lrc", diff --git a/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/records/ui/RecordView.kt b/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/records/ui/RecordView.kt index d889ddf..c939a5a 100644 --- a/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/records/ui/RecordView.kt +++ b/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/records/ui/RecordView.kt @@ -14,6 +14,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import fr.ajaury.gwenedeg.core.model.Phrase import fr.ajaury.gwenedeg.core.model.Record @Composable @@ -35,8 +36,8 @@ fun RecordView( fontFamily = FontFamily.Monospace, ) Column { - Text(text = record.title) - record.titleTranslation?.let { translation -> + Text(text = record.title.transcription) + record.title.translation?.let { translation -> Text( text = translation, style = MaterialTheme.typography.bodySmall, @@ -55,8 +56,10 @@ private fun RecordViewPreview() { Record( id = 1, index = 1, - title = "Sample Record", - titleTranslation = "Exemple d'enregistrement", + title = Phrase( + transcription = "Sample Record", + translation = "Exemple d'enregistrement", + ), audioResourcePath = "files/Chom_bev_01.ogg", subtitleResourcePath = "files/Chom_bev_01_st_bzh.lrc", ),