Fixed secured chat room button in contact/history if existing chat room is found but in terminated state

This commit is contained in:
Sylvain Berfini 2022-06-14 13:06:37 +02:00
parent df396f5abd
commit ae59117596
2 changed files with 7 additions and 2 deletions

View file

@ -115,7 +115,9 @@ class ContactViewModel(friend: Friend, async: Boolean = false) : MessageNotifier
val chatRoom = LinphoneUtils.createOneToOneChatRoom(address, isSecured)
if (chatRoom != null) {
if (chatRoom.state == ChatRoom.State.Created) {
val state = chatRoom.state
Log.i("[Contact Detail] Found existing chat room in state $state")
if (state == ChatRoom.State.Created || state == ChatRoom.State.Terminated) {
waitForChatRoomCreation.value = false
chatRoomCreatedEvent.value = Event(chatRoom)
} else {

View file

@ -188,8 +188,11 @@ class CallLogViewModel(val callLog: CallLog, private val isRelated: Boolean = fa
fun startChat(isSecured: Boolean) {
waitForChatRoomCreation.value = true
val chatRoom = LinphoneUtils.createOneToOneChatRoom(callLog.remoteAddress, isSecured)
if (chatRoom != null) {
if (chatRoom.state == ChatRoom.State.Created) {
val state = chatRoom.state
Log.i("[History Detail] Found existing chat room in state $state")
if (state == ChatRoom.State.Created || state == ChatRoom.State.Terminated) {
waitForChatRoomCreation.value = false
chatRoomCreatedEvent.value = Event(chatRoom)
} else {