Fixed duplicated chat room if we are invited back in one we left while on the chat rooms list
This commit is contained in:
parent
c8bd7ea229
commit
101d9aa931
1 changed files with 8 additions and 0 deletions
|
@ -153,6 +153,14 @@ class ChatRoomsListViewModel : ErrorReportingViewModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addChatRoom(chatRoom: ChatRoom) {
|
private fun addChatRoom(chatRoom: ChatRoom) {
|
||||||
|
val exists = chatRooms.value.orEmpty().find {
|
||||||
|
it.chatRoom.localAddress.weakEqual(chatRoom.localAddress) && it.chatRoom.peerAddress.weakEqual(chatRoom.peerAddress)
|
||||||
|
}
|
||||||
|
if (exists != null) {
|
||||||
|
Log.w("[Chat Rooms] Do not add chat room to list, it's already here")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val list = arrayListOf<ChatRoomViewModel>()
|
val list = arrayListOf<ChatRoomViewModel>()
|
||||||
val viewModel = ChatRoomViewModel(chatRoom)
|
val viewModel = ChatRoomViewModel(chatRoom)
|
||||||
list.add(viewModel)
|
list.add(viewModel)
|
||||||
|
|
Loading…
Reference in a new issue