new: modularize data.records
This commit is contained in:
@@ -6,20 +6,18 @@ import fr.ajaury.gwenedeg.player.domain.PlaybackRepository
|
||||
import fr.ajaury.gwenedeg.player.ui.viewmodel.PlayerViewModel
|
||||
import fr.ajaury.gwenedeg.preferences.data.PreferencesRepositoryImpl
|
||||
import fr.ajaury.gwenedeg.preferences.domain.PreferencesRepository
|
||||
import fr.ajaury.gwenedeg.records.data.InMemoryRecordRepository
|
||||
import fr.ajaury.gwenedeg.records.domain.RecordRepository
|
||||
import fr.ajaury.gwenedeg.records.di.recordsModule
|
||||
import fr.ajaury.gwenedeg.records.ui.viewmodel.RecordsViewModel
|
||||
import fr.ajaury.gwenedeg.resources.di.resourcesModule
|
||||
import org.koin.core.module.dsl.bind
|
||||
import org.koin.core.module.dsl.factoryOf
|
||||
import org.koin.core.module.dsl.singleOf
|
||||
import org.koin.core.module.dsl.viewModelOf
|
||||
import org.koin.dsl.module
|
||||
|
||||
val sharedModule = module {
|
||||
includes(loggingModule)
|
||||
includes(recordsModule)
|
||||
includes(resourcesModule)
|
||||
factoryOf(::InMemoryRecordRepository) { bind<RecordRepository>() }
|
||||
singleOf(::PlaybackRepositoryImpl) { bind<PlaybackRepository>() }
|
||||
singleOf(::PreferencesRepositoryImpl) { bind<PreferencesRepository>() }
|
||||
viewModelOf(::RecordsViewModel)
|
||||
|
||||
-120
@@ -1,120 +0,0 @@
|
||||
package fr.ajaury.gwenedeg.records.data
|
||||
|
||||
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(
|
||||
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 = phrase,
|
||||
audioResourcePath = "files/Chom_bev_$paddedNumber.m4a",
|
||||
subtitleResourcePath = "files/Chom_bev_${paddedNumber}_st_bzh.lrc",
|
||||
translationSubtitleResourcePath = "files/Chom_bev_${paddedNumber}_st_fr.lrc",
|
||||
)
|
||||
}
|
||||
|
||||
override fun getRecords(): Flow<List<Record>> = flowOf(records)
|
||||
|
||||
override suspend fun getRecord(id: Int): Record? = records.firstOrNull { it.id == id }
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package fr.ajaury.gwenedeg.records.domain
|
||||
|
||||
import fr.ajaury.gwenedeg.core.model.Record
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface RecordRepository {
|
||||
fun getRecords(): Flow<List<Record>>
|
||||
|
||||
suspend fun getRecord(id: Int): Record?
|
||||
}
|
||||
Reference in New Issue
Block a user