Restart uploads after app restart

Signed-off-by: Jonas Mayer <jonas.a.mayer@gmx.net>
This commit is contained in:
Jonas Mayer 2024-01-18 19:39:14 +01:00 committed by Jonas Mayer
parent 5ba3201bc5
commit 878052991c
2 changed files with 9 additions and 3 deletions

View file

@ -148,7 +148,11 @@ class FileUploadWorker(
uploadsStorageManager.getCurrentAndPendingUploadsForAccountPageAscById(lastId, accountName)
}
if(isStopped){
Log_OC.d(TAG, "FileUploadWorker for account $accountName was stopped")
}else{
Log_OC.d(TAG, "No more pending uploads for account $accountName, stopping work")
}
return Result.success()
}

View file

@ -44,6 +44,7 @@ import com.owncloud.android.datamodel.SyncedFolder;
import com.owncloud.android.datamodel.SyncedFolderProvider;
import com.owncloud.android.datamodel.UploadsStorageManager;
import com.owncloud.android.db.OCUpload;
import com.owncloud.android.db.UploadResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import org.lukhnos.nnio.file.FileVisitResult;
@ -173,13 +174,14 @@ public final class FilesSyncHelper {
final UserAccountManager accountManager,
final ConnectivityService connectivityService,
final PowerManagementService powerManagementService) {
final Context context = MainApp.getAppContext();
boolean accountExists;
boolean whileChargingOnly = true;
boolean useWifiOnly = true;
// Make all in progress downloads failed to restart upload worker
uploadsStorageManager.failInProgressUploads(UploadResult.SERVICE_INTERRUPTED);
OCUpload[] failedUploads = uploadsStorageManager.getFailedUploads();
for (OCUpload failedUpload : failedUploads) {