Skip to content

Commit

Permalink
fix: renamed to RemoveSourceFileWorker
Browse files Browse the repository at this point in the history
  • Loading branch information
Aitorbp committed Aug 13, 2024
1 parent 96f1aa7 commit b18aeb7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import androidx.work.WorkManager
import androidx.work.workDataOf
import com.owncloud.android.domain.BaseUseCase
import com.owncloud.android.domain.camerauploads.model.UploadBehavior
import com.owncloud.android.workers.RemoveLocalFileWorker
import com.owncloud.android.workers.RemoveSourceFileWorker
import com.owncloud.android.workers.UploadFileFromContentUriWorker
import timber.log.Timber

Expand All @@ -47,7 +47,7 @@ class UploadFileFromContentUriUseCase(
UploadFileFromContentUriWorker.KEY_PARAM_UPLOAD_PATH to params.uploadPath,
UploadFileFromContentUriWorker.KEY_PARAM_UPLOAD_ID to params.uploadIdInStorageManager
)
val inputDataRemoveLocalFileWorker = workDataOf(
val inputDataRemoveSourceFileWorker = workDataOf(
UploadFileFromContentUriWorker.KEY_PARAM_CONTENT_URI to params.contentUri.toString(),
)

Expand All @@ -66,11 +66,11 @@ class UploadFileFromContentUriUseCase(

val behavior = UploadBehavior.fromString(params.behavior)
if (behavior == UploadBehavior.MOVE) {
val removeLocalFileWorker = OneTimeWorkRequestBuilder<RemoveLocalFileWorker>()
.setInputData(inputDataRemoveLocalFileWorker)
val removeSourceFileWorker = OneTimeWorkRequestBuilder<RemoveSourceFileWorker>()
.setInputData(inputDataRemoveSourceFileWorker)
.build()
workManager.beginWith(uploadFileFromContentUriWorker)
.then(removeLocalFileWorker) // File is already uploaded, so the original one can be removed if the behaviour is MOVE
.then(removeSourceFileWorker) // File is already uploaded, so the original one can be removed if the behaviour is MOVE
.enqueue()
} else {
workManager.enqueue(uploadFileFromContentUriWorker)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import androidx.work.WorkManager
import androidx.work.workDataOf
import com.owncloud.android.domain.BaseUseCase
import com.owncloud.android.domain.camerauploads.model.UploadBehavior
import com.owncloud.android.workers.RemoveLocalFileWorker
import com.owncloud.android.workers.RemoveSourceFileWorker
import com.owncloud.android.workers.UploadFileFromContentUriWorker
import com.owncloud.android.workers.UploadFileFromFileSystemWorker
import timber.log.Timber
Expand All @@ -46,7 +46,7 @@ class UploadFileFromSystemUseCase(
UploadFileFromFileSystemWorker.KEY_PARAM_UPLOAD_PATH to params.uploadPath,
UploadFileFromFileSystemWorker.KEY_PARAM_UPLOAD_ID to params.uploadIdInStorageManager
)
val inputDataRemoveLocalFileWorker = workDataOf(
val inputDataRemoveSourceFileWorker = workDataOf(
UploadFileFromContentUriWorker.KEY_PARAM_CONTENT_URI to params.sourcePath,
)

Expand All @@ -63,11 +63,11 @@ class UploadFileFromSystemUseCase(

val behavior = UploadBehavior.fromString(params.behavior)
if (behavior == UploadBehavior.MOVE) {
val removeLocalFileWorker = OneTimeWorkRequestBuilder<RemoveLocalFileWorker>()
.setInputData(inputDataRemoveLocalFileWorker)
val removeSourceFileWorker = OneTimeWorkRequestBuilder<RemoveSourceFileWorker>()
.setInputData(inputDataRemoveSourceFileWorker)
.build()
workManager.beginWith(uploadFileFromSystemWorker)
.then(removeLocalFileWorker) // File is already uploaded, so the original one can be removed if the behaviour is MOVE
.then(removeSourceFileWorker) // File is already uploaded, so the original one can be removed if the behaviour is MOVE
.enqueue()
} else {
workManager.enqueue(uploadFileFromSystemWorker)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import com.owncloud.android.workers.UploadFileFromContentUriWorker.Companion.KEY
import org.koin.core.component.KoinComponent
import timber.log.Timber

class RemoveLocalFileWorker(
class RemoveSourceFileWorker(
private val appContext: Context,
private val workerParameters: WorkerParameters
) : CoroutineWorker(
Expand Down

0 comments on commit b18aeb7

Please sign in to comment.