diff --git a/core/data/src/main/java/com/droidknights/app/core/data/repository/DefaultSessionRepository.kt b/core/data/src/main/java/com/droidknights/app/core/data/repository/DefaultSessionRepository.kt index 0582667e..7231f514 100644 --- a/core/data/src/main/java/com/droidknights/app/core/data/repository/DefaultSessionRepository.kt +++ b/core/data/src/main/java/com/droidknights/app/core/data/repository/DefaultSessionRepository.kt @@ -33,7 +33,7 @@ internal class DefaultSessionRepository @Inject constructor( ?: error("Session not found with id: $sessionId") } - override suspend fun getBookmarkedSessionIds(): Flow> { + override fun getBookmarkedSessionIds(): Flow> { return bookmarkIds.filterNotNull() } diff --git a/core/data/src/main/java/com/droidknights/app/core/data/repository/SessionRepository.kt b/core/data/src/main/java/com/droidknights/app/core/data/repository/SessionRepository.kt index cd61ad8b..b32c025b 100644 --- a/core/data/src/main/java/com/droidknights/app/core/data/repository/SessionRepository.kt +++ b/core/data/src/main/java/com/droidknights/app/core/data/repository/SessionRepository.kt @@ -9,7 +9,7 @@ interface SessionRepository { suspend fun getSession(sessionId: String): Session - suspend fun getBookmarkedSessionIds(): Flow> + fun getBookmarkedSessionIds(): Flow> suspend fun bookmarkSession(sessionId: String, bookmark: Boolean) } diff --git a/core/domain/src/main/java/com/droidknights/app/core/domain/usecase/GetBookmarkedSessionIdsUseCase.kt b/core/domain/src/main/java/com/droidknights/app/core/domain/usecase/GetBookmarkedSessionIdsUseCase.kt index 1f08ff03..cf67b859 100644 --- a/core/domain/src/main/java/com/droidknights/app/core/domain/usecase/GetBookmarkedSessionIdsUseCase.kt +++ b/core/domain/src/main/java/com/droidknights/app/core/domain/usecase/GetBookmarkedSessionIdsUseCase.kt @@ -8,7 +8,7 @@ class GetBookmarkedSessionIdsUseCase @Inject constructor( private val sessionRepository: SessionRepository, ) { - suspend operator fun invoke(): Flow> { + operator fun invoke(): Flow> { return sessionRepository.getBookmarkedSessionIds() } } diff --git a/core/domain/src/main/java/com/droidknights/app/core/domain/usecase/GetBookmarkedSessionsUseCase.kt b/core/domain/src/main/java/com/droidknights/app/core/domain/usecase/GetBookmarkedSessionsUseCase.kt index 9edf3b48..f571b58f 100644 --- a/core/domain/src/main/java/com/droidknights/app/core/domain/usecase/GetBookmarkedSessionsUseCase.kt +++ b/core/domain/src/main/java/com/droidknights/app/core/domain/usecase/GetBookmarkedSessionsUseCase.kt @@ -10,7 +10,7 @@ class GetBookmarkedSessionsUseCase @Inject constructor( private val getBookmarkedSessionIdsUseCase: GetBookmarkedSessionIdsUseCase, ) { - suspend operator fun invoke(): Flow> = + operator fun invoke(): Flow> = combine( getSessionsUseCase(), getBookmarkedSessionIdsUseCase() diff --git a/core/domain/src/main/java/com/droidknights/app/core/domain/usecase/GetSessionsUseCase.kt b/core/domain/src/main/java/com/droidknights/app/core/domain/usecase/GetSessionsUseCase.kt index 774acc71..34cefacf 100644 --- a/core/domain/src/main/java/com/droidknights/app/core/domain/usecase/GetSessionsUseCase.kt +++ b/core/domain/src/main/java/com/droidknights/app/core/domain/usecase/GetSessionsUseCase.kt @@ -9,7 +9,7 @@ import kotlinx.coroutines.flow.flow class GetSessionsUseCase @Inject constructor( private val sessionRepository: SessionRepository, ) { - suspend operator fun invoke(): Flow> { + operator fun invoke(): Flow> { return flow { emit(sessionRepository.getSessions()) } diff --git a/core/domain/src/test/java/com/droidknights/app/core/domain/usecase/FakeSessionRepository.kt b/core/domain/src/test/java/com/droidknights/app/core/domain/usecase/FakeSessionRepository.kt index 9841660f..5b7d1b04 100644 --- a/core/domain/src/test/java/com/droidknights/app/core/domain/usecase/FakeSessionRepository.kt +++ b/core/domain/src/test/java/com/droidknights/app/core/domain/usecase/FakeSessionRepository.kt @@ -18,7 +18,7 @@ internal class FakeSessionRepository( return sessions.first { it.id == sessionId } } - override suspend fun getBookmarkedSessionIds(): Flow> { + override fun getBookmarkedSessionIds(): Flow> { return flow { emit(bookmarkedSessionIds) } } diff --git a/feature/session/src/test/java/com/droidknights/app/feature/session/SessionViewModelTest.kt b/feature/session/src/test/java/com/droidknights/app/feature/session/SessionViewModelTest.kt index ec82509e..95a1b6f4 100644 --- a/feature/session/src/test/java/com/droidknights/app/feature/session/SessionViewModelTest.kt +++ b/feature/session/src/test/java/com/droidknights/app/feature/session/SessionViewModelTest.kt @@ -41,7 +41,7 @@ internal class SessionViewModelTest { @Test fun `세션 데이터를 확인할 수 있다`() = runTest { // given - coEvery { getSessionsUseCase() } returns listOf(fakeSession) + coEvery { getSessionsUseCase() } returns flowOf(listOf(fakeSession)) coEvery { getBookmarkedSessionIdsUseCase() } returns flowOf(emptySet()) viewModel = SessionViewModel(getSessionsUseCase, getBookmarkedSessionIdsUseCase)