Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handled Download states w.r.t Electron across app restarts #2490

Merged

Conversation

Palanikannan1437
Copy link
Contributor

Closes #2489

Issue in brief

When the user pauses a download and then closes the app, on reopening the app they aren't able to resume the download or even remove the download from list!

Suggested Fixes/Changes

Since in Electron, when the app is closed, automatically the cancelled state is triggered by electron for the DownloadItem, but unfortunately due to the abrupt quitting of the app by the user, the cancelled state doesn't get updated properly in our data store!

Hence in-order to tackle the above situation, I thought of changing the state of all the downloads (except completed ones) to cancelled as the app starts and hence I've made the following change:

  • When the app is first loaded after the restart i.e. when APP_SETTINGS_LOADED is called upon...
  • I iterate through all the download items and change their status and state to cancelled if their previous states were progressing or paused!
  • The status of a DownloadItem is paused if the user had paused the download before closing the app
  • The status of a DownloadItem is progressing if the download was in progress while closing the app

Demo of the above Suggested Changes

  • Now the user is able to retry the cancelled download and even remove it from the list!
downloads-across-restarts.mp4

@jeanfbrito jeanfbrito merged commit 27373b5 into RocketChat:master Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

After closing the app, we aren't able to resume any download after a restart
2 participants