mirror of
https://github.com/InsanusMokrassar/PsychomatrixBase.git
synced 2024-11-14 20:33:57 +00:00
update PsychomatrixCeilDescriptionRepositoryImpl
This commit is contained in:
parent
a21003fa78
commit
c6df4dae25
@ -2,19 +2,34 @@ package com.github.insanusmokrassar.PsychomatrixBase.data.repository.realisation
|
||||
|
||||
import com.github.insanusmokrassar.PsychomatrixBase.data.repository.PsychomatrixCeilDescriptionRepository
|
||||
import com.github.insanusmokrassar.PsychomatrixBase.domain.UseCases.CeilDescriptionUseCase
|
||||
import com.github.insanusmokrassar.PsychomatrixBase.domain.entities.CeilDescription
|
||||
import com.github.insanusmokrassar.PsychomatrixBase.domain.entities.PsychomatrixCeilInfo
|
||||
import com.github.insanusmokrassar.PsychomatrixBase.utils.CeilDescriptions.models.CeilsDescriptionsRoot
|
||||
import com.github.insanusmokrassar.PsychomatrixBase.utils.CeilDescriptions.resolveCeilsDescriptionsByLanguage
|
||||
import com.github.insanusmokrassar.PsychomatrixBase.utils.extensions.subscribe
|
||||
|
||||
abstract class PsychomatrixCeilDescriptionRepositoryImpl(
|
||||
ceilDescriptionUseCase: CeilDescriptionUseCase
|
||||
const val CEILS_DESCRIPTION_ENGLISH="en_US"
|
||||
|
||||
class PsychomatrixCeilDescriptionRepositoryImpl(
|
||||
ceilDescriptionUseCase: CeilDescriptionUseCase,
|
||||
language: String = CEILS_DESCRIPTION_ENGLISH
|
||||
) : PsychomatrixCeilDescriptionRepository {
|
||||
|
||||
private val ceilsDescriptionsRoot: CeilsDescriptionsRoot = resolveCeilsDescriptionsByLanguage(language)
|
||||
|
||||
init {
|
||||
ceilDescriptionUseCase.openCeilDescriptionRequestedSubscription().subscribe {
|
||||
getCeilDescription(it).also {
|
||||
description ->
|
||||
ceilDescriptionUseCase.descriptionReady(
|
||||
it, description
|
||||
it,
|
||||
description
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getCeilDescription(psychomatrixCeilInfo: PsychomatrixCeilInfo): CeilDescription {
|
||||
return ceilsDescriptionsRoot.resolveCeilDescription(psychomatrixCeilInfo)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user