Rename CurrentCallObserver to CurrentCallService

This commit is contained in:
Benoit Marty
2024-11-06 17:24:26 +01:00
parent 1e44eb3538
commit 04274b8384
7 changed files with 23 additions and 23 deletions

View File

@@ -13,7 +13,7 @@ import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import io.element.android.features.call.api.CurrentCall
import io.element.android.features.call.api.CurrentCallObserver
import io.element.android.features.call.api.CurrentCallService
import io.element.android.features.roomcall.api.RoomCallState
import io.element.android.libraries.architecture.Presenter
import io.element.android.libraries.matrix.api.room.MatrixRoom
@@ -22,7 +22,7 @@ import javax.inject.Inject
class RoomCallStatePresenter @Inject constructor(
private val room: MatrixRoom,
private val currentCallObserver: CurrentCallObserver,
private val currentCallService: CurrentCallService,
) : Presenter<RoomCallState> {
@Composable
override fun present(): RoomCallState {
@@ -34,7 +34,7 @@ class RoomCallStatePresenter @Inject constructor(
room.sessionId in roomInfo?.activeRoomCallParticipants.orEmpty()
}
}
val currentCall by currentCallObserver.currentCall.collectAsState()
val currentCall by currentCallService.currentCall.collectAsState()
val isUserLocallyInTheCall by remember {
derivedStateOf {
(currentCall as? CurrentCall.RoomCall)?.roomId == room.roomId

View File

@@ -9,8 +9,8 @@ package io.element.android.features.roomcall.impl
import com.google.common.truth.Truth.assertThat
import io.element.android.features.call.api.CurrentCall
import io.element.android.features.call.api.CurrentCallObserver
import io.element.android.features.call.test.FakeCurrentCallObserver
import io.element.android.features.call.api.CurrentCallService
import io.element.android.features.call.test.FakeCurrentCallService
import io.element.android.features.roomcall.api.RoomCallState
import io.element.android.libraries.matrix.api.room.MatrixRoom
import io.element.android.libraries.matrix.test.room.FakeMatrixRoom
@@ -112,7 +112,7 @@ class RoomCallStatePresenterTest {
}
val presenter = createRoomCallStatePresenter(
matrixRoom = room,
currentCallObserver = FakeCurrentCallObserver(initialValue = CurrentCall.RoomCall(room.roomId)),
currentCallService = FakeCurrentCallService(initialValue = CurrentCall.RoomCall(room.roomId)),
)
presenter.test {
skipItems(1)
@@ -138,10 +138,10 @@ class RoomCallStatePresenterTest {
)
)
}
val currentCallObserver = FakeCurrentCallObserver(initialValue = CurrentCall.RoomCall(room.roomId))
val currentCallService = FakeCurrentCallService(initialValue = CurrentCall.RoomCall(room.roomId))
val presenter = createRoomCallStatePresenter(
matrixRoom = room,
currentCallObserver = currentCallObserver
currentCallService = currentCallService
)
presenter.test {
skipItems(1)
@@ -152,7 +152,7 @@ class RoomCallStatePresenterTest {
isUserLocallyInTheCall = true,
)
)
currentCallObserver.setCurrentCall(CurrentCall.None)
currentCallService.setCurrentCall(CurrentCall.None)
assertThat(awaitItem()).isEqualTo(
RoomCallState.OnGoing(
canJoinCall = true,
@@ -189,11 +189,11 @@ class RoomCallStatePresenterTest {
private fun createRoomCallStatePresenter(
matrixRoom: MatrixRoom,
currentCallObserver: CurrentCallObserver = FakeCurrentCallObserver(),
currentCallService: CurrentCallService = FakeCurrentCallService(),
): RoomCallStatePresenter {
return RoomCallStatePresenter(
room = matrixRoom,
currentCallObserver = currentCallObserver,
currentCallService = currentCallService,
)
}
}