File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
services/appnavstate/api/src/main/kotlin/io/element/android/services/appnavstate/api Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -17,18 +17,16 @@ import javax.inject.Inject
17
17
18
18
/* *
19
19
* Holds the active rooms for a given session so they can be reused instead of instantiating new ones.
20
- *
21
- * This works as a FILO (First In Last Out) stack, meaning that the last room added for a session will be the first one to be removed.
22
20
*/
23
21
@SingleIn(AppScope ::class )
24
22
class ActiveRoomsHolder @Inject constructor() {
25
- private val rooms = ConcurrentHashMap <SessionId , MutableList <JoinedRoom >>()
23
+ private val rooms = ConcurrentHashMap <SessionId , MutableSet <JoinedRoom >>()
26
24
27
25
/* *
28
26
* Adds a new held room for the given sessionId.
29
27
*/
30
28
fun addRoom (room : JoinedRoom ) {
31
- val roomsForSessionId = rooms.getOrPut(key = room.sessionId, defaultValue = { mutableListOf () })
29
+ val roomsForSessionId = rooms.getOrPut(key = room.sessionId, defaultValue = { mutableSetOf () })
32
30
if (roomsForSessionId.none { it.roomId == room.roomId }) {
33
31
// We don't want to add the same room multiple times
34
32
roomsForSessionId.add(room)
You can’t perform that action at this time.
0 commit comments