From de5b1893ad4a04148feb72cbd4b43313846d5699 Mon Sep 17 00:00:00 2001 From: John O'Reilly Date: Mon, 19 Jul 2021 21:34:51 +0100 Subject: [PATCH] fix regression in web clients --- .../com/surrus/common/repository/PeopleInSpaceRepository.kt | 3 ++- compose-web/src/jsMain/kotlin/Main.kt | 3 ++- web/src/main/kotlin/Main.kt | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/src/commonMain/kotlin/com/surrus/common/repository/PeopleInSpaceRepository.kt b/common/src/commonMain/kotlin/com/surrus/common/repository/PeopleInSpaceRepository.kt index af46cd0..6fc19a1 100644 --- a/common/src/commonMain/kotlin/com/surrus/common/repository/PeopleInSpaceRepository.kt +++ b/common/src/commonMain/kotlin/com/surrus/common/repository/PeopleInSpaceRepository.kt @@ -17,6 +17,7 @@ import kotlin.coroutines.CoroutineContext interface PeopleInSpaceRepositoryInterface { fun fetchPeopleAsFlow(): Flow> fun pollISSPosition(): Flow + suspend fun fetchPeople(): List } class PeopleInSpaceRepository : KoinComponent, PeopleInSpaceRepositoryInterface { @@ -61,7 +62,7 @@ class PeopleInSpaceRepository : KoinComponent, PeopleInSpaceRepositoryInterface } // Used by web client atm - suspend fun fetchPeople() = peopleInSpaceApi.fetchPeople().people + override suspend fun fetchPeople() = peopleInSpaceApi.fetchPeople().people // called from Kotlin/Native clients fun startObservingPeopleUpdates(success: (List) -> Unit) { diff --git a/compose-web/src/jsMain/kotlin/Main.kt b/compose-web/src/jsMain/kotlin/Main.kt index a235909..df0b93f 100644 --- a/compose-web/src/jsMain/kotlin/Main.kt +++ b/compose-web/src/jsMain/kotlin/Main.kt @@ -3,6 +3,7 @@ import com.surrus.common.di.initKoin import com.surrus.common.remote.Assignment import com.surrus.common.remote.IssPosition import com.surrus.common.repository.PeopleInSpaceRepository +import com.surrus.common.repository.PeopleInSpaceRepositoryInterface import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.flow.collect import org.jetbrains.compose.common.foundation.layout.Column @@ -14,7 +15,7 @@ private val koin = initKoin(enableNetworkLogs = true).koin @InternalCoroutinesApi fun main() { - val repo = koin.get() + val repo = koin.get() renderComposable(rootElementId = "root") { Style(TextStyles) diff --git a/web/src/main/kotlin/Main.kt b/web/src/main/kotlin/Main.kt index 092cc43..eed2a9d 100644 --- a/web/src/main/kotlin/Main.kt +++ b/web/src/main/kotlin/Main.kt @@ -1,6 +1,7 @@ import co.touchlab.kermit.Kermit import com.surrus.common.di.initKoin import com.surrus.common.repository.PeopleInSpaceRepository +import com.surrus.common.repository.PeopleInSpaceRepositoryInterface import kotlinx.coroutines.InternalCoroutinesApi import org.koin.core.component.KoinComponent import org.koin.core.component.get @@ -9,7 +10,7 @@ import react.createContext import react.dom.render object AppDependencies : KoinComponent { - val repository: PeopleInSpaceRepository + val repository: PeopleInSpaceRepositoryInterface val logger: Kermit init {