zulip-desktop
zulip-desktop copied to clipboard
Added progress bar for electron
- Added progress on the icon to show progress of files downloaded.
- Dialog box for asking file location is switched on by default.
- File location where the file is downloaded is opened by default.
What's this PR do? This PR is in reference to #1252 , where the user gets no notification about the file downloaded. This is currently Work in Progress, as it requires a review.
Any background context you want to provide? I used electron's native progress-bar to show the progress made on downloading. Since I didn't have the size of files downloaded, I used kind of a "hacky" way to deal out of it. If i could get the progress of how much file is being downloaded (i.e x MB/ y MB) format, I can show a real-time progress bar
Also this is currently below the
Screenshots?
It currently looks like this
I have tested this PR on:
- [ ] Windows
- [ ] Linux/Ubuntu
- [x] macOS
Future: I'm looking for external packages in TypeScript, which provides a progress-bar in the UI, so i can render a component on the screen itself.
@akashnimare @andersk @vsvipul Please if you could review this PR, it would be great.
https://user-images.githubusercontent.com/93476421/214092465-225c3f78-0024-4131-8cec-2dccd72ed44d.mov
This is how it currently looks. Look at the bottom of the dock icon, you can see the progress bar.
Thanks for the contribution! This looks to be just getting asymptotically close to 100%, with no notion of how long the downlaod actually will take. This may actually be more confusing for users, since they may be wondering why a big file is "stuck."
The download provides a Content-Length response header on it, which tells you how big the file is. You should be able to use this to make the progress bar accurate.
Hey @alexmv, thanks for the review. I updated the file now. I didn't use Content-Length
, as i couldn't pass the headers into WebContents. I had to change the entire downloading scheme, and use fetch
for using the above.
Instead I found a workaround, I explored the downloadItem
in electron, and found two member functions which are useful for us, namely getTotalBytes()
, and getReceivedBytes()
, which solves our problem, and updates the progress bar live with the downloading of the file.
I hope now it works fine, and gets merged
This fixes #1252
hey @alexmv @andersk @timabbott, will you please review this PR?
Heads up @varun-s22, we just merged some commits that conflict with the changes you made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/main
branch and resolve your pull request's merge conflicts accordingly.