android icon indicating copy to clipboard operation
android copied to clipboard

Migrate FileUploader, etc to WorkManager

Open tobiasKaminsky opened this issue 3 years ago • 1 comments

As of https://github.com/nextcloud/android/issues/10692 we need to migrate FileUploader, SynchronizeFileOperation and SynchronizeFolderOperation before we can bump sdk again.

This needs to be done before November due to Gplay restrictions.

tobiasKaminsky avatar Sep 01 '22 12:09 tobiasKaminsky

  • centralize functions to start upload within FileUploader
    • either use fileUploader intent (old) or uploadWorker (new)
  • adopt from FileUploader.onStartCommand to worker
    • retry: start worker with retry-command to upload one by one
    • start new uploads: add them to db, start worker to upload one by one
  • write new uploderWorker
    • one worker, which checks after start for current state of onWifi/charging
    • gather fitting uploads from UploadsStorageManager
    • upload each file one by one
  • make FileUploaderBinder to work with both implementation
  • uploadWorker only enabled for Android 12+ and dev version

This will then be one worker to process whole queue, which is always in UploadsStorageManager (FileUploader had an internal mPendingUploads queue, which we shall not adopt).

@AlvaroBrey for review

tobiasKaminsky avatar Sep 12 '22 10:09 tobiasKaminsky