mirror of
https://github.com/nextcloud/android.git
synced 2024-12-19 15:33:00 +03:00
Merge pull request #14162 from nextcloud/bugfix/upload-current-file-index
BugFix - Upload Current File Index
This commit is contained in:
commit
907cd130e0
1 changed files with 7 additions and 2 deletions
|
@ -90,6 +90,7 @@ class FileUploadWorker(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var currentUploadIndex: Int = 1
|
||||||
private var lastPercent = 0
|
private var lastPercent = 0
|
||||||
private val notificationManager = UploadNotificationManager(context, viewThemeUtils)
|
private val notificationManager = UploadNotificationManager(context, viewThemeUtils)
|
||||||
private val intents = FileUploaderIntents(context)
|
private val intents = FileUploaderIntents(context)
|
||||||
|
@ -167,7 +168,7 @@ class FileUploadWorker(
|
||||||
setWorkerState(user.get(), uploadsPerPage)
|
setWorkerState(user.get(), uploadsPerPage)
|
||||||
|
|
||||||
run uploads@{
|
run uploads@{
|
||||||
uploadsPerPage.forEachIndexed { currentUploadIndex, upload ->
|
uploadsPerPage.forEach { upload ->
|
||||||
if (isStopped) {
|
if (isStopped) {
|
||||||
return@uploads
|
return@uploads
|
||||||
}
|
}
|
||||||
|
@ -181,12 +182,16 @@ class FileUploadWorker(
|
||||||
uploadFileOperation,
|
uploadFileOperation,
|
||||||
cancelPendingIntent = intents.startIntent(uploadFileOperation),
|
cancelPendingIntent = intents.startIntent(uploadFileOperation),
|
||||||
startIntent = intents.notificationStartIntent(uploadFileOperation),
|
startIntent = intents.notificationStartIntent(uploadFileOperation),
|
||||||
currentUploadIndex = currentUploadIndex + 1,
|
currentUploadIndex = currentUploadIndex,
|
||||||
totalUploadSize = totalUploadSize
|
totalUploadSize = totalUploadSize
|
||||||
)
|
)
|
||||||
|
|
||||||
val result = upload(uploadFileOperation, user.get())
|
val result = upload(uploadFileOperation, user.get())
|
||||||
|
|
||||||
|
if (result.isSuccess) {
|
||||||
|
currentUploadIndex += 1
|
||||||
|
}
|
||||||
|
|
||||||
currentUploadFileOperation = null
|
currentUploadFileOperation = null
|
||||||
|
|
||||||
fileUploaderDelegate.sendBroadcastUploadFinished(
|
fileUploaderDelegate.sendBroadcastUploadFinished(
|
||||||
|
|
Loading…
Reference in a new issue