From 37c132c8d19929245df705891556d6cd608d14e9 Mon Sep 17 00:00:00 2001 From: Nick Vahalik Date: Wed, 17 Jul 2024 21:12:55 -0500 Subject: [PATCH] Android: Remove migration code in UploadTask. 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. --- src/android/UploadTask.java | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/android/UploadTask.java b/src/android/UploadTask.java index 9d371b07..eeca9e71 100644 --- a/src/android/UploadTask.java +++ b/src/android/UploadTask.java @@ -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) { @@ -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();