From 7b585ade94bd1a135a6a15d449e337fb73aec72e Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 24 Mar 2025 21:23:17 +0100 Subject: [PATCH 1/2] clear logs --- desktop/main.ts | 40 ++++------------------------------------ 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/desktop/main.ts b/desktop/main.ts index 4191d609efa3..3921622d97da 100644 --- a/desktop/main.ts +++ b/desktop/main.ts @@ -19,8 +19,6 @@ import type {CreateDownloadQueueModule, DownloadItem} from './createDownloadQueu import serve from './electron-serve'; import ELECTRON_EVENTS from './ELECTRON_EVENTS'; -console.log('[dev] main'); - const createDownloadQueue = require('./createDownloadQueue').default; const port = process.env.PORT ?? 8082; @@ -139,9 +137,7 @@ const preferredLocale: Locale = CONST.LOCALES.DEFAULT; const appProtocol = CONST.DEEPLINK_BASE_URL.replace('://', ''); const quitAndInstallWithUpdate = () => { - console.log('[dev] quitAndInstallWithUpdate'); if (!downloadedVersion) { - console.log('[dev] !downloadedVersion'); return; } hasUpdate = true; @@ -155,16 +151,13 @@ const manuallyCheckForUpdates = (menuItem?: MenuItem, browserWindow?: BaseWindow // eslint-disable-next-line no-param-reassign -- menu item flags like enabled or visible can be dynamically toggled by mutating the object menuItem.enabled = false; } - console.log('[dev] manuallyCheckForUpdates'); autoUpdater .checkForUpdates() .catch((error: unknown) => { - console.log('[dev] manuallyCheckForUpdates: catch'); isSilentUpdating = false; return {error}; }) .then((result) => { - console.log('[dev] manuallyCheckForUpdates: then'); const downloadPromise = result && 'downloadPromise' in result ? result.downloadPromise : undefined; if (!browserWindow) { @@ -219,12 +212,7 @@ const showKeyboardShortcutsPage = (browserWindow: BrowserWindow) => { /** Actual auto-update listeners */ const electronUpdater = (browserWindow: BrowserWindow): PlatformSpecificUpdater => ({ init: () => { - console.log('[dev] electronUpdater.init'); autoUpdater.on(ELECTRON_EVENTS.UPDATE_DOWNLOADED, (info) => { - console.log('[dev] ELECTRON_EVENTS.UPDATE_DOWNLOADED'); - console.log('[dev] info:', info); - console.log('[dev] isSilentUpdating:', isSilentUpdating); - const systemMenu = Menu.getApplicationMenu(); const updateMenuItem = systemMenu?.getMenuItemById(`update`); const checkForUpdatesMenuItem = systemMenu?.getMenuItemById(`checkForUpdates`); @@ -232,54 +220,38 @@ const electronUpdater = (browserWindow: BrowserWindow): PlatformSpecificUpdater downloadedVersion = info.version; if (updateMenuItem) { - console.log('[dev] updateMenuItem', updateMenuItem); updateMenuItem.visible = true; } if (checkForUpdatesMenuItem) { - console.log('[dev] checkForUpdatesMenuItem', checkForUpdatesMenuItem); checkForUpdatesMenuItem.visible = false; } if (browserWindow.isVisible() && !isSilentUpdating) { - console.log('[dev] browserWindow.isVisible() && !isSilentUpdating'); browserWindow.webContents.send(ELECTRON_EVENTS.UPDATE_DOWNLOADED, info.version); } else { - console.log('[dev] else'); - autoUpdater .checkForUpdates() .then((result) => { - console.log('[dev] result', result); if (result?.updateInfo.version === downloadedVersion) { - console.log('[dev] if - versions match, installing'); quitAndInstallWithUpdate(); } else { - console.log('[dev] else - downloading new update'); return autoUpdater.downloadUpdate().then(() => { - console.log('[dev] download complete, installing'); quitAndInstallWithUpdate(); }); } }) .catch((error) => { - console.log('[dev] error', error); log.error('Error during update check or download:', error); }); } }); - console.log('[dev] ipcMain.on(ELECTRON_EVENTS.START_UPDATE, quitAndInstallWithUpdate)'); ipcMain.on(ELECTRON_EVENTS.START_UPDATE, () => { - console.log('[dev] ELECTRON_EVENTS.START_UPDATE'); quitAndInstallWithUpdate(); }); - autoUpdater.checkForUpdates().then((result) => { - console.log('[dev] update result 1: ', result); - }); + autoUpdater.checkForUpdates(); }, update: () => { - autoUpdater.checkForUpdates().then((result) => { - console.log('[dev] update result 2:', result); - }); + autoUpdater.checkForUpdates(); }, }); @@ -306,7 +278,7 @@ const mainWindow = (): Promise => { // Prod and staging set the icon in the electron-builder config, so only update it here for dev if (__DEV__) { - console.log('CONFIG: ', CONFIG); + console.debug('CONFIG: ', CONFIG); app.dock.setIcon(`${__dirname}/../icon-dev.png`); app.setName('New Expensify Dev'); } @@ -406,6 +378,7 @@ const mainWindow = (): Promise => { } callback({responseHeaders: details.responseHeaders}); }); + /* eslint-enable */ // Prod and staging overwrite the app name in the electron-builder config, so only update it here for dev if (__DEV__) { @@ -661,11 +634,8 @@ const mainWindow = (): Promise => { browserWindow.show(); }); - console.log('[dev] expectedUpdateVersion:', expectedUpdateVersion); - console.log('[dev] app.getVersion():', app.getVersion()); // Hide the app if we expected to upgrade to a new version but never did. if (expectedUpdateVersion && app.getVersion() !== expectedUpdateVersion) { - console.log('[dev] expectedUpdateVersion && app.getVersion() !== expectedUpdateVersion'); browserWindow.hide(); app.hide(); } @@ -713,7 +683,6 @@ const mainWindow = (): Promise => { // Automatically check for and install the latest version in the background ipcMain.on(ELECTRON_EVENTS.SILENT_UPDATE, () => { - console.log('[dev] ELECTRON_EVENTS.SILENT_UPDATE'); if (isSilentUpdating) { return; } @@ -744,7 +713,6 @@ const mainWindow = (): Promise => { return; } - console.log('[dev] checkForUpdates(electronUpdater(browserWindowRef));'); checkForUpdates(electronUpdater(browserWindowRef)); }) ); From c090118fc64f861b8101bf96a00bdf3d8b85cc03 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 2 Apr 2025 10:59:15 +0200 Subject: [PATCH 2/2] clear logs --- desktop/main.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/desktop/main.ts b/desktop/main.ts index c81eb2d86bf6..acbf5ddf004f 100644 --- a/desktop/main.ts +++ b/desktop/main.ts @@ -145,28 +145,18 @@ const quitAndInstallWithUpdate = () => { }; const verifyAndInstallLatestVersion = (): void => { - console.log('[dev] verifyAndInstallLatestVersion'); - autoUpdater .checkForUpdates() .then((result) => { - console.log('[dev] verifyAndInstallLatestVersion: result', result); - console.log('[dev] verifyAndInstallLatestVersion: downloadedVersion', downloadedVersion); - if (result?.updateInfo.version === downloadedVersion) { - console.log('[dev] verifyAndInstallLatestVersion: if - versions match, installing'); return quitAndInstallWithUpdate(); } - console.log('[dev] verifyAndInstallLatestVersion: else - downloading new update'); - return autoUpdater.downloadUpdate().then(() => { - console.log('[dev] verifyAndInstallLatestVersion: download complete, installing'); return quitAndInstallWithUpdate(); }); }) .catch((error) => { - console.log('[dev] verifyAndInstallLatestVersion: error', error); log.error('Error during update check or download:', error); }); };