diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/EntitiesDI.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/EntitiesDI.kt new file mode 100644 index 0000000..39b2d01 --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/EntitiesDI.kt @@ -0,0 +1,4 @@ +package com.github.insanusmokrassar.PsychomatrixBase.di + +interface EntitiesDI { +} \ No newline at end of file diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/PresentationLayerDI.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/PresentationLayerDI.kt new file mode 100644 index 0000000..e456218 --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/PresentationLayerDI.kt @@ -0,0 +1,9 @@ +package com.github.insanusmokrassar.PsychomatrixBase.di + +import com.github.insanusmokrassar.PsychomatrixBase.presentation.presenters.DatePickerPresenter + +interface PresentationLayerDI : UseCasesDI { + + val datePickerPresenter: DatePickerPresenter + +} \ No newline at end of file diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/UIDI.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/UIDI.kt new file mode 100644 index 0000000..1b89c96 --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/UIDI.kt @@ -0,0 +1,7 @@ +package com.github.insanusmokrassar.PsychomatrixBase.di + +import com.github.insanusmokrassar.PsychomatrixBase.presentation.presenters.DatePickerPresenter + +interface UIDI : PresentationLayerDI { + +} \ No newline at end of file diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/UseCasesDI.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/UseCasesDI.kt new file mode 100644 index 0000000..169b94a --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/UseCasesDI.kt @@ -0,0 +1,7 @@ +package com.github.insanusmokrassar.PsychomatrixBase.di + +import com.github.insanusmokrassar.PsychomatrixBase.domain.UseCases.CalculatePsychomatrixByDate + +interface UseCasesDI : EntitiesDI { + val calculatePsychomatrixByDate: CalculatePsychomatrixByDate +} \ No newline at end of file diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/EntitiesDIImpl.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/EntitiesDIImpl.kt new file mode 100644 index 0000000..97fac88 --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/EntitiesDIImpl.kt @@ -0,0 +1,7 @@ +package com.github.insanusmokrassar.PsychomatrixBase.di.realisations + +import com.github.insanusmokrassar.PsychomatrixBase.di.EntitiesDI + +open class EntitiesDIImpl : EntitiesDI { + +} diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/PresentationLayerDIImpl.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/PresentationLayerDIImpl.kt new file mode 100644 index 0000000..3e87595 --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/PresentationLayerDIImpl.kt @@ -0,0 +1,15 @@ +package com.github.insanusmokrassar.PsychomatrixBase.di.realisations + +import com.github.insanusmokrassar.PsychomatrixBase.di.PresentationLayerDI +import com.github.insanusmokrassar.PsychomatrixBase.presentation.presenters.DatePickerPresenter +import com.github.insanusmokrassar.PsychomatrixBase.presentation.presenters.DefaultRealisations.DatePickerPresenterImpl + +open class PresentationLayerDIImpl : PresentationLayerDI, UseCasesDIImpl() { + + override val datePickerPresenter: DatePickerPresenter by lazy { + DatePickerPresenterImpl( + calculatePsychomatrixByDate + ) + } + +} \ No newline at end of file diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/UIDIImpl.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/UIDIImpl.kt new file mode 100644 index 0000000..97ed62c --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/UIDIImpl.kt @@ -0,0 +1,7 @@ +package com.github.insanusmokrassar.PsychomatrixBase.di.realisations + +import com.github.insanusmokrassar.PsychomatrixBase.di.UIDI + +class UIDIImpl : UIDI, PresentationLayerDIImpl() { + +} diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/UseCasesDIImpl.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/UseCasesDIImpl.kt new file mode 100644 index 0000000..7915a18 --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/di/realisations/UseCasesDIImpl.kt @@ -0,0 +1,13 @@ +package com.github.insanusmokrassar.PsychomatrixBase.di.realisations + +import com.github.insanusmokrassar.PsychomatrixBase.di.UseCasesDI +import com.github.insanusmokrassar.PsychomatrixBase.domain.UseCases.CalculatePsychomatrixByDate +import com.github.insanusmokrassar.PsychomatrixBase.domain.interactors.CalculatePsychomatrixByDateInteractor + +open class UseCasesDIImpl : UseCasesDI, EntitiesDIImpl() { + + override val calculatePsychomatrixByDate: CalculatePsychomatrixByDate by lazy { + CalculatePsychomatrixByDateInteractor() + } + +} diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/UseCases/UserCalculatePsychomatrixByDate.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/UseCases/CalculatePsychomatrixByDate.kt similarity index 93% rename from src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/UseCases/UserCalculatePsychomatrixByDate.kt rename to src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/UseCases/CalculatePsychomatrixByDate.kt index 7fa6dc3..588bcc5 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/UseCases/UserCalculatePsychomatrixByDate.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/UseCases/CalculatePsychomatrixByDate.kt @@ -6,7 +6,7 @@ import kotlinx.coroutines.experimental.channels.ReceiveChannel import org.joda.time.DateTime import java.util.* -interface UserCalculatePsychomatrixByDate { +interface CalculatePsychomatrixByDate { suspend fun calculate(date: Long): Deferred suspend fun calculate(date: DateTime): Deferred suspend fun calculate(date: Date): Deferred diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/interactors/UserCalculatePsychomatrixByDateInteractor.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/interactors/CalculatePsychomatrixByDateInteractor.kt similarity index 91% rename from src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/interactors/UserCalculatePsychomatrixByDateInteractor.kt rename to src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/interactors/CalculatePsychomatrixByDateInteractor.kt index 1829198..8efca8d 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/interactors/UserCalculatePsychomatrixByDateInteractor.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/interactors/CalculatePsychomatrixByDateInteractor.kt @@ -1,6 +1,6 @@ package com.github.insanusmokrassar.PsychomatrixBase.domain.interactors -import com.github.insanusmokrassar.PsychomatrixBase.domain.UseCases.UserCalculatePsychomatrixByDate +import com.github.insanusmokrassar.PsychomatrixBase.domain.UseCases.CalculatePsychomatrixByDate import com.github.insanusmokrassar.PsychomatrixBase.domain.entities.Psychomatrix import com.github.insanusmokrassar.PsychomatrixBase.utils.extensions.SUBSCRIPTIONS_MEDIUM import kotlinx.coroutines.experimental.Deferred @@ -10,7 +10,7 @@ import kotlinx.coroutines.experimental.channels.ReceiveChannel import org.joda.time.DateTime import java.util.* -class UserCalculatePsychomatrixByDateInteractor : UserCalculatePsychomatrixByDate { +class CalculatePsychomatrixByDateInteractor : CalculatePsychomatrixByDate { private val psychomatrixCreatedBroadcast = BroadcastChannel(SUBSCRIPTIONS_MEDIUM) override suspend fun calculate(date: Long): Deferred { diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/presentation/presenters/DefaultRealisations/DatePickerPresenterImpl.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/presentation/presenters/DefaultRealisations/DatePickerPresenterImpl.kt index 2197e51..a3d3543 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/presentation/presenters/DefaultRealisations/DatePickerPresenterImpl.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/presentation/presenters/DefaultRealisations/DatePickerPresenterImpl.kt @@ -1,6 +1,6 @@ package com.github.insanusmokrassar.PsychomatrixBase.presentation.presenters.DefaultRealisations -import com.github.insanusmokrassar.PsychomatrixBase.domain.UseCases.UserCalculatePsychomatrixByDate +import com.github.insanusmokrassar.PsychomatrixBase.domain.UseCases.CalculatePsychomatrixByDate import com.github.insanusmokrassar.PsychomatrixBase.domain.entities.Psychomatrix import com.github.insanusmokrassar.PsychomatrixBase.presentation.presenters.DatePickerPresenter import com.github.insanusmokrassar.PsychomatrixBase.utils.extensions.SUBSCRIPTIONS_MEDIUM @@ -10,7 +10,7 @@ import kotlinx.coroutines.experimental.launch import org.joda.time.DateTime class DatePickerPresenterImpl( - private val userCalculatePsychomatrixByDate: UserCalculatePsychomatrixByDate + private val CalculatePsychomatrixByDate: CalculatePsychomatrixByDate ) : DatePickerPresenter { private val psychomatrixCreateBroadcastChannel = BroadcastChannel(SUBSCRIPTIONS_MEDIUM) @@ -24,7 +24,7 @@ class DatePickerPresenterImpl( override fun userPickDate(date: DateTime) { launch { - userCalculatePsychomatrixByDate.calculate(date).await().also { + CalculatePsychomatrixByDate.calculate(date).await().also { psychomatrixCreateBroadcastChannel.send(it) } }