Fixed newly created chat room being read only
This commit is contained in:
parent
210f4a46b2
commit
c6c146d213
1 changed files with 14 additions and 4 deletions
|
@ -113,9 +113,15 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
||||||
|
|
||||||
private val chatRoomListener: ChatRoomListenerStub = object : ChatRoomListenerStub() {
|
private val chatRoomListener: ChatRoomListenerStub = object : ChatRoomListenerStub() {
|
||||||
override fun onStateChanged(chatRoom: ChatRoom, state: ChatRoom.State) {
|
override fun onStateChanged(chatRoom: ChatRoom, state: ChatRoom.State) {
|
||||||
if (state == ChatRoom.State.Created || state == ChatRoom.State.Terminated) {
|
updateChatRoomReadOnlyState()
|
||||||
isReadOnly.value = chatRoom.isReadOnly
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onConferenceJoined(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||||
|
updateChatRoomReadOnlyState()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onConferenceLeft(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||||
|
updateChatRoomReadOnlyState()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +134,7 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
||||||
|
|
||||||
attachFileEnabled.value = true
|
attachFileEnabled.value = true
|
||||||
sendMessageEnabled.value = false
|
sendMessageEnabled.value = false
|
||||||
isReadOnly.value = chatRoom.isReadOnly || (chatRoom.hasCapability(ChatRoomCapabilities.Conference.toInt()) && chatRoom.participants.isEmpty())
|
updateChatRoomReadOnlyState()
|
||||||
|
|
||||||
val recorderParams = coreContext.core.createRecorderParams()
|
val recorderParams = coreContext.core.createRecorderParams()
|
||||||
if (corePreferences.voiceMessagesFormatMkv) {
|
if (corePreferences.voiceMessagesFormatMkv) {
|
||||||
|
@ -511,4 +517,8 @@ class ChatMessageSendingViewModel(private val chatRoom: ChatRoom) : ViewModel()
|
||||||
private fun isPlayerClosed(): Boolean {
|
private fun isPlayerClosed(): Boolean {
|
||||||
return !this::voiceRecordingPlayer.isInitialized || voiceRecordingPlayer.state == Player.State.Closed
|
return !this::voiceRecordingPlayer.isInitialized || voiceRecordingPlayer.state == Player.State.Closed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun updateChatRoomReadOnlyState() {
|
||||||
|
isReadOnly.value = chatRoom.isReadOnly || (chatRoom.hasCapability(ChatRoomCapabilities.Conference.toInt()) && chatRoom.participants.isEmpty())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue