Fixed secured chat room button in contact/history if existing chat room is found but in terminated state
This commit is contained in:
parent
df396f5abd
commit
ae59117596
2 changed files with 7 additions and 2 deletions
|
@ -115,7 +115,9 @@ class ContactViewModel(friend: Friend, async: Boolean = false) : MessageNotifier
|
||||||
val chatRoom = LinphoneUtils.createOneToOneChatRoom(address, isSecured)
|
val chatRoom = LinphoneUtils.createOneToOneChatRoom(address, isSecured)
|
||||||
|
|
||||||
if (chatRoom != null) {
|
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
|
waitForChatRoomCreation.value = false
|
||||||
chatRoomCreatedEvent.value = Event(chatRoom)
|
chatRoomCreatedEvent.value = Event(chatRoom)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -188,8 +188,11 @@ class CallLogViewModel(val callLog: CallLog, private val isRelated: Boolean = fa
|
||||||
fun startChat(isSecured: Boolean) {
|
fun startChat(isSecured: Boolean) {
|
||||||
waitForChatRoomCreation.value = true
|
waitForChatRoomCreation.value = true
|
||||||
val chatRoom = LinphoneUtils.createOneToOneChatRoom(callLog.remoteAddress, isSecured)
|
val chatRoom = LinphoneUtils.createOneToOneChatRoom(callLog.remoteAddress, isSecured)
|
||||||
|
|
||||||
if (chatRoom != null) {
|
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
|
waitForChatRoomCreation.value = false
|
||||||
chatRoomCreatedEvent.value = Event(chatRoom)
|
chatRoomCreatedEvent.value = Event(chatRoom)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue