mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
use new builder for failure notification
Signed-off-by: parneet-guraya <gurayaparneet@gmail.com>
This commit is contained in:
parent
94a1238f28
commit
d6201cf796
@ -268,7 +268,7 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
|
|||||||
mNotifyManager?.cancel(notificationId)
|
mNotifyManager?.cancel(notificationId)
|
||||||
// summary notification would not get dismissed automatically if child notifications are cancelled programmatically
|
// summary notification would not get dismissed automatically if child notifications are cancelled programmatically
|
||||||
// so check if only 1 notification left if yes then cancel it because that would be summary notification
|
// so check if only 1 notification left if yes then cancel it because that would be summary notification
|
||||||
if(getActiveUploadNotifications() == 1){
|
if (getActiveUploadNotifications() == 1) {
|
||||||
mNotifyManager?.cancel(NotificationUtils.GROUP_SUMMARY_NOTIFICATION_ID)
|
mNotifyManager?.cancel(NotificationUtils.GROUP_SUMMARY_NOTIFICATION_ID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,17 +321,20 @@ class UploadAndShareFilesWorker(val context: Context, workerParameters: WorkerPa
|
|||||||
getResourceString(context, R.string.nc_upload_failed_notification_text),
|
getResourceString(context, R.string.nc_upload_failed_notification_text),
|
||||||
fileName
|
fileName
|
||||||
)
|
)
|
||||||
notification = mBuilder!!
|
val failureNotification = NotificationCompat.Builder(
|
||||||
|
context, NotificationUtils.NotificationChannels
|
||||||
|
.NOTIFICATION_CHANNEL_UPLOADS.name
|
||||||
|
)
|
||||||
.setContentTitle(failureTitle)
|
.setContentTitle(failureTitle)
|
||||||
.setContentText(failureText)
|
.setContentText(failureText)
|
||||||
.setSmallIcon(R.drawable.baseline_error_24)
|
.setSmallIcon(R.drawable.baseline_error_24)
|
||||||
|
.setGroup(NotificationUtils.KEY_UPLOAD_GROUP)
|
||||||
.setOngoing(false)
|
.setOngoing(false)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
// Cancel original notification
|
|
||||||
mNotifyManager?.cancel(notificationId)
|
mNotifyManager?.cancel(notificationId)
|
||||||
// Then show information about failure
|
// update current notification with failure info
|
||||||
mNotifyManager!!.notify(SystemClock.uptimeMillis().toInt(), notification)
|
mNotifyManager!!.notify(SystemClock.uptimeMillis().toInt(), failureNotification)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getResourceString(context: Context, resourceId: Int): String {
|
private fun getResourceString(context: Context, resourceId: Int): String {
|
||||||
|
Loading…
Reference in New Issue
Block a user