Skip to content

Commit

Permalink
fix: Remove obsolete started parameter in UploadRequest (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
PavlosTze authored Jan 17, 2025
1 parent cf13c9f commit 0641d4c
Showing 1 changed file with 0 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ abstract class UploadRequest<B : UploadRequest<B>>
constructor(protected val context: Context, protected var serverUrl: String) : Persistable {

private var uploadId = UUID.randomUUID().toString()
private var started: Boolean = false
protected var maxRetries = UploadServiceConfig.retryPolicy.defaultMaxRetries
protected var autoDeleteSuccessfullyUploadedFiles = false
protected var notificationConfig: (context: Context, uploadId: String) -> UploadNotificationConfig =
Expand Down Expand Up @@ -65,18 +64,11 @@ constructor(protected val context: Context, protected var serverUrl: String) : P
* generated uploadId
*/
open fun startUpload(): String {
check(!started) {
"You have already called startUpload() on this Upload request instance once and you " +
"cannot call it multiple times. Check your code."
}

check(!UploadService.taskList.contains(uploadTaskParameters.id)) {
"You have tried to perform startUpload() using the same uploadID of an " +
"already running task. You're trying to use the same ID for multiple uploads."
}

started = true

return context.startNewUpload(
params = uploadTaskParameters,
notificationConfig = notificationConfig(context, uploadId)
Expand Down

0 comments on commit 0641d4c

Please sign in to comment.