mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
Remove extra info from files export
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
4ff5a37d56
commit
71706f79c2
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.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.work.Worker
|
import androidx.work.Worker
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import com.nextcloud.client.account.User
|
import com.nextcloud.client.account.User
|
||||||
|
@ -69,9 +70,7 @@ class FilesExportWork(
|
||||||
|
|
||||||
val successfulExports = exportFiles(fileIDs)
|
val successfulExports = exportFiles(fileIDs)
|
||||||
|
|
||||||
// show notification
|
|
||||||
showSuccessNotification(successfulExports)
|
showSuccessNotification(successfulExports)
|
||||||
|
|
||||||
return Result.success()
|
return Result.success()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,19 +118,12 @@ class FilesExportWork(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showErrorNotification(successfulExports: Int) {
|
private fun showErrorNotification(successfulExports: Int) {
|
||||||
if (successfulExports == 0) {
|
val message = if (successfulExports == 0) {
|
||||||
showNotification(
|
appContext.resources.getQuantityString(R.plurals.export_failed, successfulExports, successfulExports)
|
||||||
appContext.resources.getQuantityString(R.plurals.export_failed, successfulExports, successfulExports)
|
|
||||||
)
|
|
||||||
} else {
|
} 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) {
|
private fun showSuccessNotification(successfulExports: Int) {
|
||||||
|
@ -147,14 +139,9 @@ class FilesExportWork(
|
||||||
private fun showNotification(message: String) {
|
private fun showNotification(message: String) {
|
||||||
val notificationId = SecureRandom().nextInt()
|
val notificationId = SecureRandom().nextInt()
|
||||||
|
|
||||||
val notificationBuilder = NotificationCompat.Builder(
|
val notificationBuilder = NotificationCompat.Builder(appContext, NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD)
|
||||||
appContext,
|
|
||||||
NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD
|
|
||||||
)
|
|
||||||
.setSmallIcon(R.drawable.notification_icon)
|
.setSmallIcon(R.drawable.notification_icon)
|
||||||
.setLargeIcon(BitmapFactory.decodeResource(appContext.resources, R.drawable.notification_icon))
|
.setContentTitle(message)
|
||||||
.setSubText(user.accountName)
|
|
||||||
.setContentText(message)
|
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
|
|
||||||
viewThemeUtils.androidx.themeNotificationCompatBuilder(appContext, notificationBuilder)
|
viewThemeUtils.androidx.themeNotificationCompatBuilder(appContext, notificationBuilder)
|
||||||
|
|
Loading…
Reference in a new issue