architecture fixes

This commit is contained in:
InsanusMokrassar 2018-09-07 20:36:55 +08:00
parent 2d2ee91c61
commit 15f0b19ee6
3 changed files with 7 additions and 1 deletions

View File

@ -46,7 +46,7 @@ class ModifyPsychomatrixUseCaseInteractor : ModifyPsychomatrixUseCase {
private fun asMutablePsychomatrix(psychomatrix: Psychomatrix): MutablePsychomatrix {
return currentPsychomatrixes.firstOrNull {
it == psychomatrix
it.date == psychomatrix.date
} ?: MutablePsychomatrix(psychomatrix).also {
currentPsychomatrixes.add(it)
}

View File

@ -33,6 +33,10 @@ class ModifyPsychomatrixPresenterImpl(
return modifyPsychomatrixUseCase.openPsychomatrixChangedSubscription()
}
override suspend fun tryToDoOperation(psychomatrix: Psychomatrix, operation: Operation): Deferred<Boolean> {
return modifyPsychomatrixUseCase.makeConvert(psychomatrix, operation)
}
override suspend fun twoGrowFourAvailable(psychomatrix: Psychomatrix): Deferred<Boolean> {
return async {
(availableConverts[psychomatrix] ?: updateConvertsOfPsychomatrix(psychomatrix)).contains(TwoGrowFour)

View File

@ -11,6 +11,8 @@ interface ModifyPsychomatrixPresenter {
fun openPsychomatrixChangedSubscription(): ReceiveChannel<PsychomatrixOperationIsConvert>
suspend fun tryToDoOperation(psychomatrix: Psychomatrix, operation: Operation): Deferred<Boolean>
suspend fun twoGrowFourAvailable(psychomatrix: Psychomatrix): Deferred<Boolean>
suspend fun fourGrowTwoAvailable(psychomatrix: Psychomatrix): Deferred<Boolean>