Fixed empty 1-1 chat room temporary visible in chat rooms list
This commit is contained in:
parent
3f2fb12b38
commit
a2a98f90d5
2 changed files with 13 additions and 4 deletions
|
@ -55,7 +55,9 @@ class ChatRoomsListViewModel : ErrorReportingViewModel() {
|
|||
private val listener: CoreListenerStub = object : CoreListenerStub() {
|
||||
override fun onChatRoomStateChanged(core: Core, chatRoom: ChatRoom, state: ChatRoom.State) {
|
||||
if (state == ChatRoom.State.Created) {
|
||||
addChatRoom(chatRoom)
|
||||
if (chatRoom in core.chatRooms) { // Don't add empty chat room if 1-1 depending on policy
|
||||
addChatRoom(chatRoom)
|
||||
}
|
||||
} else if (state == ChatRoom.State.TerminationFailed) {
|
||||
Log.e("[Chat Rooms] Group chat room removal for address ${chatRoom.peerAddress.asStringUriOnly()} has failed !")
|
||||
onErrorEvent.value = Event(R.string.chat_room_removal_failed_snack)
|
||||
|
@ -63,11 +65,19 @@ class ChatRoomsListViewModel : ErrorReportingViewModel() {
|
|||
}
|
||||
|
||||
override fun onMessageSent(core: Core, chatRoom: ChatRoom, message: ChatMessage) {
|
||||
if (findChatRoomIndex(chatRoom) != 0) reorderChatRooms()
|
||||
when (findChatRoomIndex(chatRoom)) {
|
||||
-1 -> addChatRoom(chatRoom)
|
||||
0 -> {}
|
||||
else -> reorderChatRooms()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMessageReceived(core: Core, chatRoom: ChatRoom, message: ChatMessage) {
|
||||
if (findChatRoomIndex(chatRoom) != 0) reorderChatRooms()
|
||||
when (findChatRoomIndex(chatRoom)) {
|
||||
-1 -> addChatRoom(chatRoom)
|
||||
0 -> {}
|
||||
else -> reorderChatRooms()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.linphone.core.AudioDevice
|
|||
import org.linphone.core.Core
|
||||
import org.linphone.core.CoreListenerStub
|
||||
import org.linphone.core.EcCalibratorStatus
|
||||
import org.linphone.core.tools.Log
|
||||
import org.linphone.utils.Event
|
||||
import org.linphone.utils.PermissionHelper
|
||||
|
||||
|
|
Loading…
Reference in a new issue