Disabled Clear All button when downloads include only the application update and when they also include files, clear only the files (#2294)
This commit is contained in:
@@ -157,10 +157,16 @@ export class DownloadsManager extends JsonFileManager<DownloadedItems> {
|
||||
clearDownloadsDropDown = () => {
|
||||
log.debug('DownloadsManager.clearDownloadsDropDown');
|
||||
|
||||
this.saveAll({});
|
||||
this.fileSizes = new Map();
|
||||
if (this.hasUpdate()) {
|
||||
this.saveAll({
|
||||
[APP_UPDATE_KEY]: this.downloads[APP_UPDATE_KEY],
|
||||
});
|
||||
} else {
|
||||
this.saveAll({});
|
||||
this.toggleAppMenuDownloadsEnabled(false);
|
||||
}
|
||||
this.closeDownloadsDropdown();
|
||||
this.toggleAppMenuDownloadsEnabled(false);
|
||||
this.fileSizes = new Map();
|
||||
}
|
||||
|
||||
showFileInFolder = (item?: DownloadedItem) => {
|
||||
@@ -282,6 +288,10 @@ export class DownloadsManager extends JsonFileManager<DownloadedItems> {
|
||||
WindowManager.sendToRenderer(HIDE_DOWNLOADS_DROPDOWN_BUTTON_BADGE);
|
||||
}
|
||||
|
||||
hasUpdate = () => {
|
||||
return Boolean(this.downloads[APP_UPDATE_KEY]?.type === DownloadItemTypeEnum.UPDATE);
|
||||
}
|
||||
|
||||
private markFileAsDeleted = (item: DownloadedItem) => {
|
||||
const fileId = this.getDownloadedFileId(item);
|
||||
const file = this.downloads[fileId];
|
||||
|
Reference in New Issue
Block a user