GithubHelp home page GithubHelp logo

Comments (2)

kanahia1 avatar kanahia1 commented on May 29, 2024 1

Great Idea ✨ to create a discussion channel

from apps-android-commons.

ShashwatKedia avatar ShashwatKedia commented on May 29, 2024

After a lot of debugging and uploading a decent amount of pictures on Commons, this is the flow I observed (posting here for everyone's benefit) :

(Just so everyone understands the reference, STATE_QUEUED means, the item will have a ‘Queued’ tag and STATE_IN_PROGRESS means, the item will have a non-started progress bar animation)

  1. When the upload starts for the first time, all pictures are by default given the STATE_QUEUED in UploadPresenter.
  2. In UploadWorker’s doWork(), all items which are in STATE_QUEUED & STATE_QUEUED_LIMITED_CONNECTION_MODE are converted to STATE_IN_PROGRESS.
  3. In UploadWorker’s doWork(), for the current item getting uploaded, the state is again set to STATE_IN_PROGRESS and continues that till it gets uploaded successfully and gets the STATE_COMPLETED or pauses and gets the STATE_PAUSED or fails and gets the STATE_FAILED.
  4. If the current item upload succeeds, then the same process (step 3) is repeated for the next item.
  5. If the user closes the app, and comes back to ContributionsFragment, then all other items in STATE_IN_PROGRESS are converted to STATE_QUEUED by checkAndResumeStuckUploads() in MainActivity.
  6. If any item’s upload fails, it goes to STATE_FAILED and stays as it is, till either the user hits the retry button or the user closes the app and reopens it (since retryUploads() is called in onResume() of MainActivity) and they are given the STATE_QUEUED in restartUploads(), and step 2 follows. The STATE_FAILED items are not automatically re-tried, even if there is no other item left to be uploaded until the user closes the app or opens another activity and reopens MainActivity.

There are some issues with the pause and resume buttons as well, but since they are not a part of the given task, it would be better to discuss them here.

(i) I suggest to set the state to STATE_IN_PROGRESS only when the item is currently being uploaded, that is to skip step 2 and go to step 3 directly. By, doing this, only the current item being uploaded will have a progress bar and the rest will have a Queued or Failed or Paused tag.
(ii) I recommend to start the upload of the Failed items, when no other item is left to be uploaded, even when the user doesn’t close and reopen the app.
(iii) I also suggest to set the tag of STATE_QUEUED items with a 'Queued (N)' tag, where 'N' represents the position of the image in the uploads queue, which will update as and when another image is paused or fails or gets uploaded successfully.

This will create a standard upload flow, wherein only the item currently getting uploaded will have a progress bar and other items will have a 'Queued (N)' tag or 'Paused' or 'Failed' tag.

Below, I have attached a rough flowchart of what an ideal flow should be, according to me :

Final Flow SS

Suggestions and feedback regarding the above flow are more than welcome :)

from apps-android-commons.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.