architecture fixes

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

No files matched your search

@@ -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)
}
@@ -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)
@@ -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>