Fixed wrong display name in chat message notification (sometimes)
This commit is contained in:
parent
cb8f25a468
commit
50bcd84df9
1 changed files with 10 additions and 9 deletions
|
@ -153,6 +153,13 @@ class NotificationsManager(private val context: Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val id = LinphoneUtils.getChatRoomId(room.localAddress, room.peerAddress)
|
||||||
|
val mute = corePreferences.chatRoomMuted(id)
|
||||||
|
if (mute) {
|
||||||
|
Log.i("[Notifications Manager] Chat room $id has been muted")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (message.errorInfo.reason == Reason.UnsupportedContent) {
|
if (message.errorInfo.reason == Reason.UnsupportedContent) {
|
||||||
Log.w("[Notifications Manager] Received message with unsupported content, do not notify")
|
Log.w("[Notifications Manager] Received message with unsupported content, do not notify")
|
||||||
return
|
return
|
||||||
|
@ -180,13 +187,7 @@ class NotificationsManager(private val context: Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val id = LinphoneUtils.getChatRoomId(room.localAddress, room.peerAddress)
|
displayIncomingChatNotification(room, message)
|
||||||
val mute = corePreferences.chatRoomMuted(id)
|
|
||||||
if (mute) {
|
|
||||||
Log.i("[Notifications Manager] Chat room $id has been muted")
|
|
||||||
} else {
|
|
||||||
displayIncomingChatNotification(room, message)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onChatRoomRead(core: Core, chatRoom: ChatRoom) {
|
override fun onChatRoomRead(core: Core, chatRoom: ChatRoom) {
|
||||||
|
@ -655,14 +656,14 @@ class NotificationsManager(private val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun displayIncomingChatNotification(room: ChatRoom, message: ChatMessage) {
|
private fun displayIncomingChatNotification(room: ChatRoom, message: ChatMessage) {
|
||||||
val friend = coreContext.contactsManager.findContactByAddress(message.fromAddress)
|
|
||||||
|
|
||||||
val notifiable = getNotifiableForRoom(room)
|
val notifiable = getNotifiableForRoom(room)
|
||||||
if (notifiable.messages.isNotEmpty() || room.unreadMessagesCount == 1) {
|
if (notifiable.messages.isNotEmpty() || room.unreadMessagesCount == 1) {
|
||||||
|
val friend = coreContext.contactsManager.findContactByAddress(message.fromAddress)
|
||||||
val notifiableMessage = getNotifiableMessage(message, friend)
|
val notifiableMessage = getNotifiableMessage(message, friend)
|
||||||
notifiable.messages.add(notifiableMessage)
|
notifiable.messages.add(notifiableMessage)
|
||||||
} else {
|
} else {
|
||||||
for (chatMessage in room.unreadHistory) {
|
for (chatMessage in room.unreadHistory) {
|
||||||
|
val friend = coreContext.contactsManager.findContactByAddress(chatMessage.fromAddress)
|
||||||
val notifiableMessage = getNotifiableMessage(chatMessage, friend)
|
val notifiableMessage = getNotifiableMessage(chatMessage, friend)
|
||||||
notifiable.messages.add(notifiableMessage)
|
notifiable.messages.add(notifiableMessage)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue