Skip to content

Commit

Permalink
code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
NIkita Fedrunov committed Feb 9, 2022
1 parent def8a4f commit 2f4de46
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions changelog.d/5183.sdk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`join` and `leave` methods moved from MembershipService to RoomService and SpaceService to split logic for rooms and spaces
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ class SpaceHierarchyTest : InstrumentedTest {
// Test part one of the rooms

val bRoomId = spaceBInfo.roomIds.first()
val bRoom = session.getRoom(bRoomId)

commonTestHelper.waitWithLatch { latch ->
val flatAChildren = session.getFlattenRoomSummaryChildrenOfLive(spaceAInfo.spaceId)
Expand All @@ -360,7 +359,7 @@ class SpaceHierarchyTest : InstrumentedTest {
}

// part from b room
bRoom!!.leave(null)
session.leaveRoom(bRoomId)
// The room should have disapear from flat children
flatAChildren.observeForever(childObserver)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ interface SpaceService {

/**
* Leave the space, or reject an invitation.
* @param roomId the roomId of the space to leave
* @param spaceId the spaceId of the space to leave
* @param reason optional reason for leaving the space
*/
suspend fun leaveSpace(roomId: String, reason: String? = null)
suspend fun leaveSpace(spaceId: String, reason: String? = null)

// fun getSpaceParentsOfRoom(roomId: String) : List<SpaceSummary>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ internal class DefaultSpaceService @Inject constructor(
return joinSpaceTask.execute(JoinSpaceTask.Params(spaceIdOrAlias, reason, viaServers))
}

override suspend fun leaveSpace(roomId: String, reason: String?) {
leaveRoomTask.execute(LeaveRoomTask.Params(roomId, reason))
override suspend fun leaveSpace(spaceId: String, reason: String?) {
leaveRoomTask.execute(LeaveRoomTask.Params(spaceId, reason))
}

override suspend fun rejectInvite(spaceId: String, reason: String?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,9 @@ class RoomListViewModel @AssistedInject constructor(
)
}

val room = session.getRoom(roomId) ?: return@withState
viewModelScope.launch {
try {
session.joinRoom(room.roomId)
session.joinRoom(roomId)
analyticsTracker.capture(action.roomSummary.toAnalyticsJoinedRoom())
// We do not update the joiningRoomsIds here, because, the room is not joined yet regarding the sync data.
// Instead, we wait for the room to be joined
Expand Down

0 comments on commit 2f4de46

Please sign in to comment.