Skip to content

Commit

Permalink
Android: Remove migration code in UploadTask.
Browse files Browse the repository at this point in the history
The migration code from version 4.0.9 to 4.0.10 has been deleted from the UploadTask. This code was previously necessary to handle uploads through different worker instances, but its purpose is no longer relevant or needed in the current context.
  • Loading branch information
nvahalik committed Jul 18, 2024
1 parent 5f394aa commit 37c132c
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions src/android/UploadTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,10 @@ public final class UploadTask extends Worker {

private PendingUpload nextPendingUpload;

private static boolean firstMigrationFlag = false;

public UploadTask(@NonNull Context context, @NonNull WorkerParameters workerParams) {

super(context, workerParams);

// Migrating code from 4.0.9 to 4.0.10 - Check if upload comes from another worker and does not exists in table
String oldUploadTaskId = workerParams.getInputData().getString(KEY_INPUT_ID);
if (!firstMigrationFlag && oldUploadTaskId != null && AckDatabase.getInstance(getApplicationContext()).pendingUploadDao().getById(oldUploadTaskId) == null) {
FileTransferBackground.logMessage("Migrating upload " + oldUploadTaskId);
AckDatabase.getInstance(getApplicationContext()).pendingUploadDao().insert(new PendingUpload(oldUploadTaskId, workerParams.getInputData()));
FileTransferBackground.logMessage("Retrying migrated upload " + oldUploadTaskId + " after some seconds...");
firstMigrationFlag = true;
}

nextPendingUpload = AckDatabase.getInstance(getApplicationContext()).pendingUploadDao().getFirstPendingEntry();

if (httpClient == null) {
Expand Down Expand Up @@ -147,15 +136,6 @@ public Result doWork() {
return Result.retry();
}

// Migrating code from 4.0.9 to 4.0.10 - Check if upload comes from another worker and does not exists in table
String oldUploadTaskId = getInputData().getString(KEY_INPUT_ID);
if (oldUploadTaskId != null && AckDatabase.getInstance(getApplicationContext()).pendingUploadDao().getById(oldUploadTaskId) == null && firstMigrationFlag == true) {
FileTransferBackground.logMessage("Migrating upload " + oldUploadTaskId);
AckDatabase.getInstance(getApplicationContext()).pendingUploadDao().insert(new PendingUpload(oldUploadTaskId, getInputData()));
FileTransferBackground.logMessage("Retrying migrated upload " + oldUploadTaskId + " after some seconds...");
return Result.success();
}

do {
nextPendingUpload = AckDatabase.getInstance(getApplicationContext()).pendingUploadDao().getFirstPendingEntry();

Expand Down

0 comments on commit 37c132c

Please sign in to comment.