This is similar to #1016 but should be easier to implement since we don't need @electron/get support for canceling an individual download. Currently if you click "Download All Versions" there's no way to cancel that, which is pretty bad since that can be hundreds of downloads. The only way to cancel is to quit the app.
This shouldn't be too difficult to fix, in the for loop which downloads all versions we should just check if isDownloadingAll is still true after each download and break if it's not. The other change would be when isDownloadingAll is true, render a "Stop Downloads" button in place of the "Download All Versions" button, and clicking that will set isDownloadingAll to false.
It will need to move isDownloadingAll to AppState as well (isDeletingAll too) since downloads continue after the user leaves settings, and it would probably be confusing if switching settings tabs or leaving settings stopped the downloads. Currently leaving the settings tab means the isDownloadingAll state is lost and the button could be clicked again or "Remove All Versions" could be clicked, so moving the state to AppState will fix that.
|
public async handleDownloadAll(): Promise<void> { |
|
this.setState({ isDownloadingAll: true }); |
|
|
|
const { downloadVersion, versionsToShow } = this.props.appState; |
|
|
|
for (const ver of versionsToShow) { |
|
await downloadVersion(ver); |
|
} |
|
|
|
this.setState({ isDownloadingAll: false }); |
|
} |
This is similar to #1016 but should be easier to implement since we don't need
@electron/getsupport for canceling an individual download. Currently if you click "Download All Versions" there's no way to cancel that, which is pretty bad since that can be hundreds of downloads. The only way to cancel is to quit the app.This shouldn't be too difficult to fix, in the for loop which downloads all versions we should just check if
isDownloadingAllis still true after each download andbreakif it's not. The other change would be whenisDownloadingAllis true, render a "Stop Downloads" button in place of the "Download All Versions" button, and clicking that will setisDownloadingAllto false.It will need to move
isDownloadingAlltoAppStateas well (isDeletingAlltoo) since downloads continue after the user leaves settings, and it would probably be confusing if switching settings tabs or leaving settings stopped the downloads. Currently leaving the settings tab means theisDownloadingAllstate is lost and the button could be clicked again or "Remove All Versions" could be clicked, so moving the state toAppStatewill fix that.fiddle/src/renderer/components/settings-electron.tsx
Lines 115 to 125 in 11b54b9