Skip to content

Commit 460320c

Browse files
tobiasKaminskyalperozturk96
authored andcommitted
If quota is exceeded show notification, stop afterwards
Signed-off-by: tobiasKaminsky <[email protected]>
1 parent 9a5def6 commit 460320c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/src/main/java/com/nextcloud/client/jobs/upload/UploadNotificationManager.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult
1717
import com.owncloud.android.operations.UploadFileOperation
1818
import com.owncloud.android.ui.notifications.NotificationUtils
1919
import com.owncloud.android.utils.theme.ViewThemeUtils
20+
import kotlin.random.Random
2021

2122
class UploadNotificationManager(private val context: Context, viewThemeUtils: ViewThemeUtils, id: Int) :
2223
WorkerNotificationManager(id, context, viewThemeUtils, R.string.foreground_service_upload) {
@@ -77,7 +78,8 @@ class UploadNotificationManager(private val context: Context, viewThemeUtils: Vi
7778
conflictsResolveIntent: PendingIntent?,
7879
cancelUploadActionIntent: PendingIntent?,
7980
credentialIntent: PendingIntent?,
80-
errorMessage: String
81+
errorMessage: String,
82+
showNewNotification: Boolean = false
8183
) {
8284
if (uploadFileOperation.isMissingPermissionThrown) {
8385
return
@@ -116,7 +118,7 @@ class UploadNotificationManager(private val context: Context, viewThemeUtils: Vi
116118
setContentText(errorMessage)
117119
}
118120

119-
if (resultCode.isFileSpecificError()) {
121+
if (resultCode.isFileSpecificError() || showNewNotification) {
120122
showNewNotification(uploadFileOperation)
121123
} else {
122124
showNotification()
@@ -146,7 +148,7 @@ class UploadNotificationManager(private val context: Context, viewThemeUtils: Vi
146148
private fun showNewNotification(operation: UploadFileOperation) {
147149
notificationManager.notify(
148150
NotificationUtils.createUploadNotificationTag(operation.file),
149-
FileUploadWorker.NOTIFICATION_ERROR_ID,
151+
Random.Default.nextInt(),
150152
notificationBuilder.build()
151153
)
152154
}

0 commit comments

Comments
 (0)