Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove obsolete started parameter in UploadRequest #673

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading