Fix & workaround for chat bubble notification
This commit is contained in:
parent
3f7f0a3d33
commit
f7ba6fc87c
2 changed files with 13 additions and 2 deletions
|
@ -86,7 +86,10 @@ class ChatBubbleActivity : GenericActivity() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Workaround for the removed notification when a chat room is marked as read
|
||||||
|
coreContext.notificationsManager.dismissNotificationUponReadChatRoom = false
|
||||||
chatRoom.markAsRead()
|
chatRoom.markAsRead()
|
||||||
|
coreContext.notificationsManager.dismissNotificationUponReadChatRoom = true
|
||||||
|
|
||||||
viewModel = ViewModelProvider(
|
viewModel = ViewModelProvider(
|
||||||
this,
|
this,
|
||||||
|
@ -147,6 +150,8 @@ class ChatBubbleActivity : GenericActivity() {
|
||||||
)
|
)
|
||||||
|
|
||||||
binding.setOpenAppClickListener {
|
binding.setOpenAppClickListener {
|
||||||
|
coreContext.notificationsManager.currentlyDisplayedChatRoomAddress = null
|
||||||
|
|
||||||
val intent = Intent(this, MainActivity::class.java)
|
val intent = Intent(this, MainActivity::class.java)
|
||||||
intent.putExtra("RemoteSipUri", remoteSipUri)
|
intent.putExtra("RemoteSipUri", remoteSipUri)
|
||||||
intent.putExtra("LocalSipUri", localSipUri)
|
intent.putExtra("LocalSipUri", localSipUri)
|
||||||
|
|
|
@ -105,6 +105,8 @@ class NotificationsManager(private val context: Context) {
|
||||||
|
|
||||||
var currentlyDisplayedChatRoomAddress: String? = null
|
var currentlyDisplayedChatRoomAddress: String? = null
|
||||||
|
|
||||||
|
var dismissNotificationUponReadChatRoom: Boolean = true
|
||||||
|
|
||||||
private val listener: CoreListenerStub = object : CoreListenerStub() {
|
private val listener: CoreListenerStub = object : CoreListenerStub() {
|
||||||
override fun onCallStateChanged(
|
override fun onCallStateChanged(
|
||||||
core: Core,
|
core: Core,
|
||||||
|
@ -166,8 +168,12 @@ class NotificationsManager(private val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onChatRoomRead(core: Core, chatRoom: ChatRoom) {
|
override fun onChatRoomRead(core: Core, chatRoom: ChatRoom) {
|
||||||
|
if (dismissNotificationUponReadChatRoom) {
|
||||||
Log.i("[Notifications Manager] Chat room [$chatRoom] has been marked as read, removing notification if any")
|
Log.i("[Notifications Manager] Chat room [$chatRoom] has been marked as read, removing notification if any")
|
||||||
dismissChatNotification(chatRoom)
|
dismissChatNotification(chatRoom)
|
||||||
|
} else {
|
||||||
|
Log.i("[Notifications Manager] Chat room [$chatRoom] has been marked as read, not removing notification, maybe because of a chat bubble?")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue