Merge pull request #2100 from nextcloud/bugfix/2078/RuntimeException-for-cancelExistingNotificationsForRoom

Catch RuntimeException thrown by NotificationManager
This commit is contained in:
Andy Scherzinger 2022-05-27 13:06:19 +02:00 committed by GitHub
commit 10753d039e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1709,14 +1709,19 @@ class ChatController(args: Bundle) :
binding.messageInputView.findViewById<ImageButton>(R.id.attachmentButton)?.visibility = View.VISIBLE
}
@Suppress("Detekt.TooGenericExceptionCaught")
private fun cancelNotificationsForCurrentConversation() {
if (conversationUser != null) {
if (!TextUtils.isEmpty(roomToken)) {
try {
NotificationUtils.cancelExistingNotificationsForRoom(
applicationContext,
conversationUser,
roomToken!!
)
} catch (e: RuntimeException) {
Log.w(TAG, "Cancel notifications for current conversation results with an error.", e)
}
}
}
}