use new builder for failure notification

Signed-off-by: parneet-guraya <gurayaparneet@gmail.com>
This commit is contained in:
parneet-guraya 2024-01-10 01:56:36 +05:30 committed by Marcel Hibbe
parent 94a1238f28
commit d6201cf796
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -321,17 +321,20 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
getResourceString(context, R.string.nc_upload_failed_notification_text),
fileName
)
notification = mBuilder!!
val failureNotification = NotificationCompat.Builder(
context, NotificationUtils.NotificationChannels
.NOTIFICATION_CHANNEL_UPLOADS.name
)
.setContentTitle(failureTitle)
.setContentText(failureText)
.setSmallIcon(R.drawable.baseline_error_24)
.setGroup(NotificationUtils.KEY_UPLOAD_GROUP)
.setOngoing(false)
.build()
// Cancel original notification
mNotifyManager?.cancel(notificationId)
// Then show information about failure
mNotifyManager!!.notify(SystemClock.uptimeMillis().toInt(), notification)
// update current notification with failure info
mNotifyManager!!.notify(SystemClock.uptimeMillis().toInt(), failureNotification)
}
private fun getResourceString(context: Context, resourceId: Int): String {