mirror of
https://github.com/InsanusMokrassar/PsychomatrixBase.git
synced 2024-11-15 04:43:58 +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.data.repository.PsychomatrixCeilDescriptionRepository
|
||||||
import com.github.insanusmokrassar.PsychomatrixBase.domain.UseCases.CeilDescriptionUseCase
|
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
|
import com.github.insanusmokrassar.PsychomatrixBase.utils.extensions.subscribe
|
||||||
|
|
||||||
abstract class PsychomatrixCeilDescriptionRepositoryImpl(
|
const val CEILS_DESCRIPTION_ENGLISH="en_US"
|
||||||
ceilDescriptionUseCase: CeilDescriptionUseCase
|
|
||||||
|
class PsychomatrixCeilDescriptionRepositoryImpl(
|
||||||
|
ceilDescriptionUseCase: CeilDescriptionUseCase,
|
||||||
|
language: String = CEILS_DESCRIPTION_ENGLISH
|
||||||
) : PsychomatrixCeilDescriptionRepository {
|
) : PsychomatrixCeilDescriptionRepository {
|
||||||
|
|
||||||
|
private val ceilsDescriptionsRoot: CeilsDescriptionsRoot = resolveCeilsDescriptionsByLanguage(language)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
ceilDescriptionUseCase.openCeilDescriptionRequestedSubscription().subscribe {
|
ceilDescriptionUseCase.openCeilDescriptionRequestedSubscription().subscribe {
|
||||||
getCeilDescription(it).also {
|
getCeilDescription(it).also {
|
||||||
description ->
|
description ->
|
||||||
ceilDescriptionUseCase.descriptionReady(
|
ceilDescriptionUseCase.descriptionReady(
|
||||||
it, description
|
it,
|
||||||
|
description
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getCeilDescription(psychomatrixCeilInfo: PsychomatrixCeilInfo): CeilDescription {
|
||||||
|
return ceilsDescriptionsRoot.resolveCeilDescription(psychomatrixCeilInfo)
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user