Skip to content

Commit

Permalink
Merge pull request #1713 from waldo121/bug/1712-incorrect-download-ui…
Browse files Browse the repository at this point in the history
…-after-pause

Fix download pausing/resume click behaviour
  • Loading branch information
nukeop authored Sep 29, 2024
2 parents 280327b + 9f9e5d3 commit 669db8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/app/app/actions/downloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,14 @@ export const onDownloadProgress = createStandardAction(DownloadActionTypes.DOWNL
propertyName: 'completion',
value: progress
});

payload = changePropertyForItem({
downloads: payload,
uuid,
value: progress < 1 ? DownloadStatus.STARTED : DownloadStatus.FINISHED
});
if (progress >= 1) {
payload = changePropertyForItem({
downloads: payload,
uuid,
value: DownloadStatus.FINISHED
});
}


return {
payload
Expand Down
2 changes: 2 additions & 0 deletions packages/main/src/controllers/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class DownloadIpcCtrl {
if (downloadRef) {
if (downloadRef.ref.canResume()) {
downloadRef.ref.resume();
this.window?.send(IpcEvents.DOWNLOAD_STARTED, uuid);
return;
}
this.downloadItems = this.downloadItems.filter((item => item.uuid === uuid));
Expand All @@ -80,6 +81,7 @@ class DownloadIpcCtrl {
this.downloadItems = this.downloadItems.filter((item) => item.uuid !== uuid);
this.downloadItems.push({ uuid, ref: item });
this.logger.log(`Download started: ${filename}`);
this.window?.send(IpcEvents.DOWNLOAD_STARTED, uuid);
},
onProgress: (progress) => {
this.window.send(IpcEvents.DOWNLOAD_PROGRESS, {
Expand Down

0 comments on commit 669db8f

Please sign in to comment.