mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Remove extra info from files export
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
b594c35323
commit
1ffbca4fb5
1 changed files with 7 additions and 20 deletions
|
@ -31,6 +31,7 @@ import android.content.Intent
|
|||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
import android.graphics.BitmapFactory
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.work.Worker
|
||||
import androidx.work.WorkerParameters
|
||||
import com.nextcloud.client.account.User
|
||||
|
@ -69,9 +70,7 @@ class FilesExportWork(
|
|||
|
||||
val successfulExports = exportFiles(fileIDs)
|
||||
|
||||
// show notification
|
||||
showSuccessNotification(successfulExports)
|
||||
|
||||
return Result.success()
|
||||
}
|
||||
|
||||
|
@ -119,19 +118,12 @@ 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
|
||||
)
|
||||
)
|
||||
appContext.resources.getQuantityString(R.plurals.export_partially_failed, successfulExports, successfulExports)
|
||||
}
|
||||
showNotification(message)
|
||||
}
|
||||
|
||||
private fun showSuccessNotification(successfulExports: Int) {
|
||||
|
@ -147,14 +139,9 @@ class FilesExportWork(
|
|||
private fun showNotification(message: String) {
|
||||
val notificationId = SecureRandom().nextInt()
|
||||
|
||||
val notificationBuilder = NotificationCompat.Builder(
|
||||
appContext,
|
||||
NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD
|
||||
)
|
||||
val notificationBuilder = NotificationCompat.Builder(appContext, 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)
|
||||
|
|
Loading…
Reference in a new issue