Skip to content

Commit

Permalink
feat: Make menu item enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
erdkse committed Sep 27, 2021
1 parent 7069b4c commit 62845e5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
9 changes: 2 additions & 7 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,10 @@ ipcMain.on('quit-and-install', () => {
autoUpdater.quitAndInstall();
});

const checkNewVersion = async () => {
export const checkNewVersion = async () => {
try {
mainStore.dispatch(updateNewVersion(NewVersion.Checking));
const a = await autoUpdater.checkForUpdates();
console.log(a);
await autoUpdater.checkForUpdates();
} catch (error) {
mainStore.dispatch(updateNewVersion(NewVersion.Errored));
}
Expand Down Expand Up @@ -195,10 +194,6 @@ function createWindow() {
win.webContents.openDevTools();
}

win.once('ready-to-show', async () => {
await checkNewVersion();
});

autoUpdater.on('update-available', () => {
mainStore.dispatch(updateNewVersion(NewVersion.Available));
});
Expand Down
6 changes: 3 additions & 3 deletions electron/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
import {UiState} from '@models/ui';
import {openGitHub, openDocumentation} from '@utils/shell';
import {isInPreviewModeSelector} from '@redux/selectors';
import {checkNewVersion} from './main';

const isMac = process.platform === 'darwin';

Expand All @@ -32,9 +33,8 @@ const appMenu = (win: BrowserWindow, store: any): MenuItemConstructorOptions =>
},
{
label: 'Check for Update',
enabled: false,
click: () => {
console.log('Check for update');
click: async () => {
await checkNewVersion();
},
},
{type: 'separator'},
Expand Down
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 62845e5

Please sign in to comment.