Migrate viewManager to singleton (#2656)

This commit is contained in:
Devin Binnie
2023-04-05 13:01:09 -04:00
committed by GitHub
parent 245215c678
commit 862287edff
26 changed files with 743 additions and 949 deletions

View File

@@ -31,6 +31,7 @@ import {DOWNLOADS_DROPDOWN_AUTOCLOSE_TIMEOUT, DOWNLOADS_DROPDOWN_MAX_ITEMS} from
import * as Validator from 'common/Validator';
import {localizeMessage} from 'main/i18nManager';
import {displayDownloadCompleted} from 'main/notifications';
import ViewManager from 'main/views/viewManager';
import WindowManager from 'main/windows/windowManager';
import {doubleSecToMs, getPercentage, isStringWithLength, readFilenameFromContentDispositionHeader, shouldIncrementFilename} from 'main/utils';
@@ -509,7 +510,7 @@ export class DownloadsManager extends JsonFileManager<DownloadedItems> {
log.debug('doneEventController', {state});
if (state === 'completed' && !this.open) {
displayDownloadCompleted(path.basename(item.savePath), item.savePath, WindowManager.getServerNameByWebContentsId(webContents.id) || '');
displayDownloadCompleted(path.basename(item.savePath), item.savePath, ViewManager.getViewByWebContentsId(webContents.id)?.tab.server.name ?? '');
}
const bookmark = this.bookmarks.get(this.getFileId(item));