Add release date to about menu (#2505)

This commit is contained in:
Opender Singh 2020-08-13 08:59:30 +12:00 committed by GitHub
parent 48783e5063
commit 61b27ae3c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 48 deletions

View File

@ -7,8 +7,10 @@ import {
changelogUrl,
getAppLongName,
getAppName,
getAppReleaseDate,
getAppVersion,
isDevelopment,
isLinux,
isMac,
MNEMONIC_SYM,
} from '../common/constants';
@ -292,59 +294,51 @@ export function createWindow() {
],
};
const aboutDetail = [
`OS ${os.type()} ${os.arch()} ${os.release()}`,
`Version ${getAppLongName()} ${getAppVersion()}`,
`Shell ${process.versions.electron}`,
`Node ${process.versions.node}`,
`V8 ${process.versions.v8}`,
`Architecture ${process.arch}`,
Curl.getVersion(),
].join('\n');
const aboutMenuClickHandler = async () => {
const copy = 'Copy';
const ok = 'OK';
const aboutMsgOptions = {
type: 'info',
title: getAppName(),
message: getAppLongName(),
detail: aboutDetail,
noLink: true,
const buttons = isLinux() ? [copy, ok] : [ok, copy];
const detail = [
`Version: ${getAppLongName()} ${getAppVersion()}`,
`Release date: ${getAppReleaseDate()}`,
`OS: ${os.type()} ${os.arch()} ${os.release()}`,
`Electron: ${process.versions.electron}`,
`Node: ${process.versions.node}`,
`V8: ${process.versions.v8}`,
`Architecture: ${process.arch}`,
`node-libcurl: ${Curl.getVersion()}`,
].join('\n');
const msgBox = await dialog.showMessageBox({
type: 'info',
title: getAppName(),
message: getAppLongName(),
detail,
buttons,
defaultId: buttons.indexOf(ok),
cancelId: buttons.indexOf(ok),
noLink: true,
});
if (msgBox.response === buttons.indexOf(copy)) {
clipboard.writeText(detail);
}
};
if (isMac()) {
applicationMenu.submenu.unshift(
{
label: `A${MNEMONIC_SYM}bout ${getAppName()}`,
click: async () => {
const buttons = ['OK', 'Copy'];
const msgBox = await dialog.showMessageBox({
...aboutMsgOptions,
buttons: buttons,
defaultId: buttons.indexOf('OK'),
cancelId: buttons.indexOf('OK'),
});
if (msgBox.response === buttons.indexOf('Copy')) {
clipboard.writeText(aboutDetail);
}
},
click: aboutMenuClickHandler,
},
{ type: 'separator' },
);
} else {
helpMenu.submenu.unshift({
helpMenu.submenu.push({
label: `${MNEMONIC_SYM}About`,
click: async () => {
const buttons = ['Copy', 'OK'];
const msgBox = await dialog.showMessageBox({
...aboutMsgOptions,
buttons: buttons,
defaultId: buttons.indexOf('OK'),
cancelId: buttons.indexOf('OK'),
});
if (msgBox.response === buttons.indexOf('Copy')) {
clipboard.writeText(aboutDetail);
}
},
click: aboutMenuClickHandler,
});
}

View File

@ -13,12 +13,7 @@ import Plugins from '../settings/plugins';
import Theme from '../settings/theme';
import * as models from '../../../models/index';
import { Curl } from 'node-libcurl';
import {
getAppName,
getAppVersion,
getAppReleaseDate,
isInsomnia,
} from '../../../common/constants';
import { getAppName, getAppVersion, isInsomnia } from '../../../common/constants';
import Tooltip from '../tooltip';
import { setTheme } from '../../../plugins/misc';
import * as session from '../../../account/session';
@ -104,7 +99,7 @@ class SettingsModal extends PureComponent {
<ModalHeader>
{getAppName()} Preferences
<span className="faint txt-sm">
&nbsp;&nbsp;&nbsp; v{getAppVersion()} ({getAppReleaseDate()})
&nbsp;&nbsp;&nbsp; v{getAppVersion()}
<Tooltip position="bottom" message={Curl.getVersion()}>
<i className="fa fa-info-circle" />
</Tooltip>

View File

@ -20,6 +20,7 @@ if (process.env.NODE_ENV === 'development') {
'process.env.APP_RENDER_URL': JSON.stringify(`http://localhost:${PORT}/renderer.html`),
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.INSOMNIA_ENV': JSON.stringify('development'),
'process.env.RELEASE_DATE': JSON.stringify(new Date()),
}),
];
} else {