diff --git a/app/attachments.ts b/app/attachments.ts index 0ce1ea3b4204..5e3adaf1d8bd 100644 --- a/app/attachments.ts +++ b/app/attachments.ts @@ -3,8 +3,6 @@ import { join, relative, normalize } from 'path'; import fastGlob from 'fast-glob'; -import glob from 'glob'; -import pify from 'pify'; import fse from 'fs-extra'; import { map, isString } from 'lodash'; import normalizePath from 'normalize-path'; @@ -113,16 +111,6 @@ export const getAllDraftAttachments = async ( return map(files, file => relative(dir, file)); }; -export const getBuiltInImages = async (): Promise> => { - const dir = join(__dirname, '../images'); - const pattern = join(dir, '**', '*.svg'); - - // Note: we cannot use fast-glob here because, inside of .asar files, readdir will not - // honor the withFileTypes flag: https://github.com/electron/electron/issues/19074 - const files = await pify(glob)(pattern, { nodir: true }); - return map(files, file => relative(dir, file)); -}; - export const clearTempPath = (userDataPath: string): Promise => { const tempPath = getTempPath(userDataPath); return fse.emptyDir(tempPath); diff --git a/app/main.ts b/app/main.ts index bd4423a2c6fd..144594e51184 100644 --- a/app/main.ts +++ b/app/main.ts @@ -2222,27 +2222,6 @@ ipc.on('delete-all-data', () => { } }); -ipc.on('get-built-in-images', async () => { - if (!mainWindow) { - getLogger().warn('ipc/get-built-in-images: No mainWindow!'); - return; - } - - try { - const images = await attachments.getBuiltInImages(); - mainWindow.webContents.send('get-success-built-in-images', null, images); - } catch (error) { - if (mainWindow && mainWindow.webContents) { - mainWindow.webContents.send('get-success-built-in-images', error.message); - } else { - getLogger().error( - 'Error handling get-built-in-images:', - Errors.toLogFormat(error) - ); - } - } -}); - ipc.on('get-config', async event => { const theme = await getResolvedThemeSetting(); diff --git a/ts/background.ts b/ts/background.ts index c58d98c87ba6..f06babe46745 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -543,19 +543,6 @@ export async function startApp(): Promise { startInteractionMode(); - // Load these images now to ensure that they don't flicker on first use - window.preloadedImages = []; - function preload(list: ReadonlyArray) { - for (let index = 0, max = list.length; index < max; index += 1) { - const image = new Image(); - image.src = `./images/${list[index]}`; - window.preloadedImages.push(image); - } - } - - const builtInImages = await window.IPC.getBuiltInImages(); - preload(builtInImages); - // We add this to window here because the default Node context is erased at the end // of preload.js processing window.setImmediate = window.nodeSetImmediate; diff --git a/ts/window.d.ts b/ts/window.d.ts index 241e266a8f34..e1b1b4659516 100644 --- a/ts/window.d.ts +++ b/ts/window.d.ts @@ -70,7 +70,6 @@ export type IPCType = { }; drawAttention: () => void; getAutoLaunch: () => Promise; - getBuiltInImages: () => Promise>; getMediaCameraPermissions: () => Promise; getMediaPermissions: () => Promise; logAppLoadedEvent?: (options: { processedCount?: number }) => void; diff --git a/ts/windows/main/phase1-ipc.ts b/ts/windows/main/phase1-ipc.ts index 48a947837cb1..c9d4ea4f6b2b 100644 --- a/ts/windows/main/phase1-ipc.ts +++ b/ts/windows/main/phase1-ipc.ts @@ -83,17 +83,6 @@ const IPC: IPCType = { ipc.send('draw-attention'); }, getAutoLaunch: () => ipc.invoke('get-auto-launch'), - getBuiltInImages: () => - new Promise((resolve, reject) => { - ipc.once('get-success-built-in-images', (_event, error, value) => { - if (error) { - return reject(new Error(error)); - } - - return resolve(value); - }); - ipc.send('get-built-in-images'); - }), getMediaPermissions: () => ipc.invoke('settings:get:mediaPermissions'), getMediaCameraPermissions: () => ipc.invoke('settings:get:mediaCameraPermissions'),