Add some tests on RoomFlowNode

This commit is contained in:
ganfra 2023-04-14 15:34:41 +02:00
parent 3854e879e9
commit 776e9bd221
14 changed files with 240 additions and 31 deletions

View file

@ -83,6 +83,7 @@ class RoomFlowNode @AssistedInject constructor(
Timber.v("OnCreate")
plugins<LifecycleCallback>().forEach { it.onFlowCreated(inputs.room) }
appNavigationStateService.onNavigateToRoom(id, inputs.room.roomId)
fetchRoomMembers()
},
onDestroy = {
Timber.v("OnDestroy")
@ -91,8 +92,6 @@ class RoomFlowNode @AssistedInject constructor(
appNavigationStateService.onLeavingRoom(id)
}
)
lifecycleScope.fetchRoomMembers()
roomMembershipObserver.updates
.filter { update -> update.roomId == inputs.room.roomId && !update.isUserInRoom }
.onEach {
@ -101,7 +100,7 @@ class RoomFlowNode @AssistedInject constructor(
.launchIn(lifecycleScope)
}
private fun CoroutineScope.fetchRoomMembers() = launch {
private fun fetchRoomMembers() = lifecycleScope.launch {
val room = inputs.room
room.fetchMembers()
.onFailure {