mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-14 16:25:05 +01:00
Handle new subject for call recording notification
see https://github.com/nextcloud/spreed/pull/8837 Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
004f719490
commit
8b1a809464
@ -347,8 +347,8 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
|
|||||||
if ("recording" == ncNotification.objectType) {
|
if ("recording" == ncNotification.objectType) {
|
||||||
val notificationDialogData = NotificationDialogData()
|
val notificationDialogData = NotificationDialogData()
|
||||||
|
|
||||||
notificationDialogData.title = context?.getString(R.string.record_file_available).orEmpty()
|
notificationDialogData.title = pushMessage.subject
|
||||||
notificationDialogData.text = ncNotification.subject.orEmpty()
|
notificationDialogData.text = pushMessage.text.orEmpty()
|
||||||
|
|
||||||
for (action in ncNotification.actions!!) {
|
for (action in ncNotification.actions!!) {
|
||||||
if (action.primary) {
|
if (action.primary) {
|
||||||
@ -371,9 +371,12 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun enrichPushMessageByNcNotificationData(
|
private fun enrichPushMessageByNcNotificationData(
|
||||||
ncNotification: com.nextcloud.talk.models.json.notifications.Notification?
|
ncNotification: com.nextcloud.talk.models.json.notifications.Notification
|
||||||
) {
|
) {
|
||||||
if (ncNotification!!.messageRichParameters != null &&
|
pushMessage.objectId = ncNotification.objectId
|
||||||
|
pushMessage.timestamp = ncNotification.datetime!!.millis
|
||||||
|
|
||||||
|
if (ncNotification.messageRichParameters != null &&
|
||||||
ncNotification.messageRichParameters!!.size > 0
|
ncNotification.messageRichParameters!!.size > 0
|
||||||
) {
|
) {
|
||||||
pushMessage.text = getParsedMessage(
|
pushMessage.text = getParsedMessage(
|
||||||
@ -385,9 +388,6 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
|
|||||||
}
|
}
|
||||||
|
|
||||||
val subjectRichParameters = ncNotification.subjectRichParameters
|
val subjectRichParameters = ncNotification.subjectRichParameters
|
||||||
|
|
||||||
pushMessage.timestamp = ncNotification.datetime!!.millis
|
|
||||||
|
|
||||||
if (subjectRichParameters != null && subjectRichParameters.size > 0) {
|
if (subjectRichParameters != null && subjectRichParameters.size > 0) {
|
||||||
val callHashMap = subjectRichParameters["call"]
|
val callHashMap = subjectRichParameters["call"]
|
||||||
val userHashMap = subjectRichParameters["user"]
|
val userHashMap = subjectRichParameters["user"]
|
||||||
@ -408,9 +408,6 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
|
|||||||
if (callHashMap.containsKey("call-type")) {
|
if (callHashMap.containsKey("call-type")) {
|
||||||
conversationType = callHashMap["call-type"]
|
conversationType = callHashMap["call-type"]
|
||||||
}
|
}
|
||||||
if ("recording" == ncNotification.objectType) {
|
|
||||||
conversationType = "recording"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
val notificationUser = NotificationUser()
|
val notificationUser = NotificationUser()
|
||||||
if (userHashMap != null && userHashMap.isNotEmpty()) {
|
if (userHashMap != null && userHashMap.isNotEmpty()) {
|
||||||
@ -424,8 +421,13 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
|
|||||||
notificationUser.name = guestHashMap["name"]
|
notificationUser.name = guestHashMap["name"]
|
||||||
pushMessage.notificationUser = notificationUser
|
pushMessage.notificationUser = notificationUser
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
pushMessage.subject = ncNotification.subject.orEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("recording" == ncNotification.objectType) {
|
||||||
|
conversationType = "recording"
|
||||||
}
|
}
|
||||||
pushMessage.objectId = ncNotification.objectId
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("MagicNumber")
|
@Suppress("MagicNumber")
|
||||||
@ -487,13 +489,13 @@ class NotificationWorker(context: Context, workerParams: WorkerParameters) : Wor
|
|||||||
.setSmallIcon(smallIcon)
|
.setSmallIcon(smallIcon)
|
||||||
.setCategory(category)
|
.setCategory(category)
|
||||||
.setPriority(priority)
|
.setPriority(priority)
|
||||||
|
.setContentTitle(contentTitle)
|
||||||
|
.setContentText(contentText)
|
||||||
.setSubText(baseUrl)
|
.setSubText(baseUrl)
|
||||||
.setWhen(pushMessage.timestamp)
|
.setWhen(pushMessage.timestamp)
|
||||||
.setShowWhen(true)
|
.setShowWhen(true)
|
||||||
.setContentIntent(pendingIntent)
|
.setContentIntent(pendingIntent)
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
.setContentTitle(contentTitle)
|
|
||||||
.setContentText(contentText)
|
|
||||||
.setColor(context!!.resources.getColor(R.color.colorPrimary))
|
.setColor(context!!.resources.getColor(R.color.colorPrimary))
|
||||||
|
|
||||||
val notificationInfoBundle = Bundle()
|
val notificationInfoBundle = Bundle()
|
||||||
|
Loading…
Reference in New Issue
Block a user