Fixed display issue when creating 1-1 encrypted chat rooms
This commit is contained in:
parent
1d20314726
commit
886f225016
2 changed files with 15 additions and 9 deletions
|
@ -122,11 +122,15 @@ class ChatMessagesListViewModel(private val chatRoom: ChatRoom) : ViewModel() {
|
|||
}
|
||||
|
||||
override fun onConferenceJoined(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||
addEvent(eventLog)
|
||||
if (!chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt())) {
|
||||
addEvent(eventLog)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onConferenceLeft(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||
addEvent(eventLog)
|
||||
if (!chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt())) {
|
||||
addEvent(eventLog)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onEphemeralMessageDeleted(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||
|
|
|
@ -45,14 +45,15 @@ class ChatRoomViewModelFactory(private val chatRoom: ChatRoom) :
|
|||
class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactViewModelInterface {
|
||||
override val contact = MutableLiveData<Contact>()
|
||||
|
||||
override val displayName: String by lazy {
|
||||
when {
|
||||
chatRoom.hasCapability(ChatRoomCapabilities.Basic.toInt()) -> LinphoneUtils.getDisplayName(chatRoom.peerAddress)
|
||||
chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()) -> LinphoneUtils.getDisplayName(chatRoom.participants.firstOrNull()?.address ?: chatRoom.peerAddress)
|
||||
chatRoom.hasCapability(ChatRoomCapabilities.Conference.toInt()) -> chatRoom.subject.orEmpty()
|
||||
else -> chatRoom.peerAddress.asStringUriOnly()
|
||||
override val displayName: String
|
||||
get() {
|
||||
return when {
|
||||
chatRoom.hasCapability(ChatRoomCapabilities.Basic.toInt()) -> LinphoneUtils.getDisplayName(chatRoom.peerAddress)
|
||||
chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()) -> LinphoneUtils.getDisplayName(chatRoom.participants.firstOrNull()?.address ?: chatRoom.peerAddress)
|
||||
chatRoom.hasCapability(ChatRoomCapabilities.Conference.toInt()) -> chatRoom.subject.orEmpty()
|
||||
else -> chatRoom.peerAddress.asStringUriOnly()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override val securityLevel: ChatRoomSecurityLevel
|
||||
get() = chatRoom.securityLevel
|
||||
|
@ -172,6 +173,7 @@ class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactViewModelI
|
|||
override fun onConferenceJoined(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||
contactLookup()
|
||||
updateSecurityIcon()
|
||||
subject.value = chatRoom.subject
|
||||
}
|
||||
|
||||
override fun onSecurityEvent(chatRoom: ChatRoom, eventLog: EventLog) {
|
||||
|
|
Loading…
Reference in a new issue