mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
Merge pull request #12053 from nextcloud/feature/use-m3-files-export-notification
Remove Extra Info from Files Export Notification
This commit is contained in:
commit
c3a5c5c8eb
1 changed files with 19 additions and 19 deletions
|
@ -29,7 +29,6 @@ import android.content.ContentResolver
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
import android.graphics.BitmapFactory
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.work.Worker
|
||||
import androidx.work.WorkerParameters
|
||||
|
@ -69,9 +68,7 @@ class FilesExportWork(
|
|||
|
||||
val successfulExports = exportFiles(fileIDs)
|
||||
|
||||
// show notification
|
||||
showSuccessNotification(successfulExports)
|
||||
|
||||
return Result.success()
|
||||
}
|
||||
|
||||
|
@ -105,7 +102,13 @@ class FilesExportWork(
|
|||
|
||||
@Throws(IllegalStateException::class)
|
||||
private fun exportFile(ocFile: OCFile) {
|
||||
FileExportUtils().exportFile(ocFile.fileName, ocFile.mimeType, contentResolver, ocFile, null)
|
||||
FileExportUtils().exportFile(
|
||||
ocFile.fileName,
|
||||
ocFile.mimeType,
|
||||
contentResolver,
|
||||
ocFile,
|
||||
null
|
||||
)
|
||||
}
|
||||
|
||||
private fun downloadFile(ocFile: OCFile) {
|
||||
|
@ -119,19 +122,16 @@ class FilesExportWork(
|
|||
}
|
||||
|
||||
private fun showErrorNotification(successfulExports: Int) {
|
||||
if (successfulExports == 0) {
|
||||
showNotification(
|
||||
val message = if (successfulExports == 0) {
|
||||
appContext.resources.getQuantityString(R.plurals.export_failed, successfulExports, successfulExports)
|
||||
)
|
||||
} else {
|
||||
showNotification(
|
||||
appContext.resources.getQuantityString(
|
||||
R.plurals.export_partially_failed,
|
||||
successfulExports,
|
||||
successfulExports
|
||||
)
|
||||
)
|
||||
}
|
||||
showNotification(message)
|
||||
}
|
||||
|
||||
private fun showSuccessNotification(successfulExports: Int) {
|
||||
|
@ -152,9 +152,7 @@ class FilesExportWork(
|
|||
NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD
|
||||
)
|
||||
.setSmallIcon(R.drawable.notification_icon)
|
||||
.setLargeIcon(BitmapFactory.decodeResource(appContext.resources, R.drawable.notification_icon))
|
||||
.setSubText(user.accountName)
|
||||
.setContentText(message)
|
||||
.setContentTitle(message)
|
||||
.setAutoCancel(true)
|
||||
|
||||
viewThemeUtils.androidx.themeNotificationCompatBuilder(appContext, notificationBuilder)
|
||||
|
@ -166,7 +164,8 @@ class FilesExportWork(
|
|||
appContext,
|
||||
notificationId,
|
||||
actionIntent,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE
|
||||
PendingIntent.FLAG_CANCEL_CURRENT or
|
||||
PendingIntent.FLAG_IMMUTABLE
|
||||
)
|
||||
notificationBuilder.addAction(
|
||||
NotificationCompat.Action(
|
||||
|
@ -176,7 +175,8 @@ class FilesExportWork(
|
|||
)
|
||||
)
|
||||
|
||||
val notificationManager = appContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
val notificationManager = appContext
|
||||
.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
notificationManager.notify(notificationId, notificationBuilder.build())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue