Fix & workaround for chat bubble notification

This commit is contained in:
Sylvain Berfini 2021-09-13 16:39:50 +02:00
parent 3f7f0a3d33
commit f7ba6fc87c
2 changed files with 13 additions and 2 deletions

View file

@ -86,7 +86,10 @@ class ChatBubbleActivity : GenericActivity() {
return
}
// Workaround for the removed notification when a chat room is marked as read
coreContext.notificationsManager.dismissNotificationUponReadChatRoom = false
chatRoom.markAsRead()
coreContext.notificationsManager.dismissNotificationUponReadChatRoom = true
viewModel = ViewModelProvider(
this,
@ -147,6 +150,8 @@ class ChatBubbleActivity : GenericActivity() {
)
binding.setOpenAppClickListener {
coreContext.notificationsManager.currentlyDisplayedChatRoomAddress = null
val intent = Intent(this, MainActivity::class.java)
intent.putExtra("RemoteSipUri", remoteSipUri)
intent.putExtra("LocalSipUri", localSipUri)

View file

@ -105,6 +105,8 @@ class NotificationsManager(private val context: Context) {
var currentlyDisplayedChatRoomAddress: String? = null
var dismissNotificationUponReadChatRoom: Boolean = true
private val listener: CoreListenerStub = object : CoreListenerStub() {
override fun onCallStateChanged(
core: Core,
@ -166,8 +168,12 @@ class NotificationsManager(private val context: Context) {
}
override fun onChatRoomRead(core: Core, chatRoom: ChatRoom) {
Log.i("[Notifications Manager] Chat room [$chatRoom] has been marked as read, removing notification if any")
dismissChatNotification(chatRoom)
if (dismissNotificationUponReadChatRoom) {
Log.i("[Notifications Manager] Chat room [$chatRoom] has been marked as read, removing notification if any")
dismissChatNotification(chatRoom)
} else {
Log.i("[Notifications Manager] Chat room [$chatRoom] has been marked as read, not removing notification, maybe because of a chat bubble?")
}
}
}