@@ -14,10 +14,10 @@ import com.nextcloud.utils.extensions.isFileSpecificError
1414import com.nextcloud.utils.numberFormatter.NumberFormatter
1515import com.owncloud.android.R
1616import com.owncloud.android.lib.common.operations.RemoteOperationResult
17+ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode
1718import com.owncloud.android.operations.UploadFileOperation
1819import com.owncloud.android.ui.notifications.NotificationUtils
1920import com.owncloud.android.utils.theme.ViewThemeUtils
20- import kotlin.random.Random
2121
2222class UploadNotificationManager (private val context : Context , viewThemeUtils : ViewThemeUtils , id : Int ) :
2323 WorkerNotificationManager (id, context, viewThemeUtils, R .string.foreground_service_upload) {
@@ -78,8 +78,7 @@ class UploadNotificationManager(private val context: Context, viewThemeUtils: Vi
7878 conflictsResolveIntent : PendingIntent ? ,
7979 cancelUploadActionIntent : PendingIntent ? ,
8080 credentialIntent : PendingIntent ? ,
81- errorMessage : String ,
82- showNewNotification : Boolean = false
81+ errorMessage : String
8382 ) {
8483 if (uploadFileOperation.isMissingPermissionThrown) {
8584 return
@@ -118,7 +117,7 @@ class UploadNotificationManager(private val context: Context, viewThemeUtils: Vi
118117 setContentText(errorMessage)
119118 }
120119
121- if (resultCode.isFileSpecificError() || showNewNotification ) {
120+ if (resultCode.isFileSpecificError()) {
122121 showNewNotification(uploadFileOperation)
123122 } else {
124123 showNotification()
@@ -148,7 +147,7 @@ class UploadNotificationManager(private val context: Context, viewThemeUtils: Vi
148147 private fun showNewNotification (operation : UploadFileOperation ) {
149148 notificationManager.notify(
150149 NotificationUtils .createUploadNotificationTag(operation.file),
151- Random . Default .nextInt (),
150+ operation.file.hashCode (),
152151 notificationBuilder.build()
153152 )
154153 }
@@ -170,6 +169,17 @@ class UploadNotificationManager(private val context: Context, viewThemeUtils: Vi
170169 )
171170 }
172171
172+ fun showQuotaExceedNotification (operation : UploadFileOperation , resultCode : ResultCode ) {
173+ notifyForFailedResult(
174+ operation,
175+ resultCode,
176+ null ,
177+ null ,
178+ null ,
179+ context.getString(R .string.upload_quota_exceeded)
180+ )
181+ }
182+
173183 fun showConnectionErrorNotification () {
174184 notificationManager.cancel(getId())
175185
0 commit comments