diff options
author | André Oliveira <37463445+SpecialAro@users.noreply.github.com> | 2022-06-30 14:35:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-30 13:35:45 +0000 |
commit | 13c51fdf5b9fd42a244bc1620e7e96c80a080f66 (patch) | |
tree | 739b9f24cad3f12183c974947f25a9a37c099285 | |
parent | fix: don't break when when service is undefined on adding a new service (#400) (diff) | |
download | ferdium-app-13c51fdf5b9fd42a244bc1620e7e96c80a080f66.tar.gz ferdium-app-13c51fdf5b9fd42a244bc1620e7e96c80a080f66.tar.zst ferdium-app-13c51fdf5b9fd42a244bc1620e7e96c80a080f66.zip |
Feature: Copy Ferdium info from the 'About' dialog into the clipboard (#402)
Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
-rw-r--r-- | src/environment-remote.ts | 26 | ||||
-rw-r--r-- | src/i18n/locales/en-US.json | 1 | ||||
-rw-r--r-- | src/index.ts | 6 | ||||
-rw-r--r-- | src/lib/Menu.js | 57 |
4 files changed, 47 insertions, 43 deletions
diff --git a/src/environment-remote.ts b/src/environment-remote.ts index 0cd5d2ce4..bb14448a3 100644 --- a/src/environment-remote.ts +++ b/src/environment-remote.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { join } from 'path'; | 1 | import { join } from 'path'; |
2 | import osName from 'os-name'; | ||
3 | import { api as electronApi } from './electron-util'; | 2 | import { api as electronApi } from './electron-util'; |
4 | import { | 3 | import { |
5 | LIVE_FERDIUM_API, | 4 | LIVE_FERDIUM_API, |
@@ -14,16 +13,7 @@ import { | |||
14 | LOCAL_TODOS_FRONTEND_URL, | 13 | LOCAL_TODOS_FRONTEND_URL, |
15 | PRODUCTION_TODOS_FRONTEND_URL, | 14 | PRODUCTION_TODOS_FRONTEND_URL, |
16 | } from './config'; | 15 | } from './config'; |
17 | import { | 16 | import { isWindows } from './environment'; |
18 | chromeVersion, | ||
19 | electronVersion, | ||
20 | isWindows, | ||
21 | nodeVersion, | ||
22 | osArch, | ||
23 | } from './environment'; | ||
24 | |||
25 | // @ts-expect-error Cannot find module './buildInfo.json' or its corresponding type declarations. | ||
26 | import * as buildInfo from './buildInfo.json'; | ||
27 | 17 | ||
28 | export const { app } = electronApi; | 18 | export const { app } = electronApi; |
29 | export const ferdiumVersion: string = app.getVersion(); | 19 | export const ferdiumVersion: string = app.getVersion(); |
@@ -89,17 +79,3 @@ export const API_VERSION: string = 'v1'; | |||
89 | export const WS_API: string = wsApi; | 79 | export const WS_API: string = wsApi; |
90 | export const WEBSITE: string = web; | 80 | export const WEBSITE: string = web; |
91 | export const TODOS_FRONTEND: string = todos; | 81 | export const TODOS_FRONTEND: string = todos; |
92 | |||
93 | export function aboutAppDetails(): string { | ||
94 | return [ | ||
95 | `Version: ${ferdiumVersion}`, | ||
96 | `Electron: ${electronVersion}`, | ||
97 | `Chrome: ${chromeVersion}`, | ||
98 | `Node.js: ${nodeVersion}`, | ||
99 | `Platform: ${osName()}`, | ||
100 | `Arch: ${osArch}`, | ||
101 | `Build date: ${new Date(Number(buildInfo.timestamp))}`, | ||
102 | `Git SHA: ${buildInfo.gitHashShort}`, | ||
103 | `Git branch: ${buildInfo.gitBranch}`, | ||
104 | ].join('\n'); | ||
105 | } | ||
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index f4871f207..1690a6067 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json | |||
@@ -115,6 +115,7 @@ | |||
115 | "menu.services": "Services", | 115 | "menu.services": "Services", |
116 | "menu.services.activatePreviousService": "Activate previous service", | 116 | "menu.services.activatePreviousService": "Activate previous service", |
117 | "menu.services.addNewService": "Add New Service...", | 117 | "menu.services.addNewService": "Add New Service...", |
118 | "menu.services.copyToClipboard": "Copy to clipboard", | ||
118 | "menu.services.goHome": "Home", | 119 | "menu.services.goHome": "Home", |
119 | "menu.services.setNextServiceActive": "Activate next service", | 120 | "menu.services.setNextServiceActive": "Activate next service", |
120 | "menu.todos": "Todos", | 121 | "menu.todos": "Todos", |
diff --git a/src/index.ts b/src/index.ts index 0fccac6e9..786b95a69 100644 --- a/src/index.ts +++ b/src/index.ts | |||
@@ -26,7 +26,6 @@ import { DEFAULT_APP_SETTINGS, DEFAULT_WINDOW_OPTIONS } from './config'; | |||
26 | import { isMac, isWindows, isLinux, altKey } from './environment'; | 26 | import { isMac, isWindows, isLinux, altKey } from './environment'; |
27 | import { | 27 | import { |
28 | isDevMode, | 28 | isDevMode, |
29 | aboutAppDetails, | ||
30 | userDataRecipesPath, | 29 | userDataRecipesPath, |
31 | userDataPath, | 30 | userDataPath, |
32 | } from './environment-remote'; | 31 | } from './environment-remote'; |
@@ -166,11 +165,6 @@ if (!retrieveSettingValue('enableGPUAcceleration', false)) { | |||
166 | app.disableHardwareAcceleration(); | 165 | app.disableHardwareAcceleration(); |
167 | } | 166 | } |
168 | 167 | ||
169 | app.setAboutPanelOptions({ | ||
170 | applicationVersion: aboutAppDetails(), | ||
171 | version: '', | ||
172 | }); | ||
173 | |||
174 | const createWindow = () => { | 168 | const createWindow = () => { |
175 | // Remember window size | 169 | // Remember window size |
176 | const mainWindowState = windowStateKeeper({ | 170 | const mainWindowState = windowStateKeeper({ |
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index d3a3163b9..7b048d3fa 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -9,6 +9,7 @@ import { | |||
9 | } from '@electron/remote'; | 9 | } from '@electron/remote'; |
10 | import { autorun, observable } from 'mobx'; | 10 | import { autorun, observable } from 'mobx'; |
11 | import { defineMessages } from 'react-intl'; | 11 | import { defineMessages } from 'react-intl'; |
12 | import osName from 'os-name'; | ||
12 | import { | 13 | import { |
13 | CUSTOM_WEBSITE_RECIPE_ID, | 14 | CUSTOM_WEBSITE_RECIPE_ID, |
14 | GITHUB_FERDIUM_URL, | 15 | GITHUB_FERDIUM_URL, |
@@ -27,8 +28,12 @@ import { | |||
27 | addNewServiceShortcutKey, | 28 | addNewServiceShortcutKey, |
28 | splitModeToggleShortcutKey, | 29 | splitModeToggleShortcutKey, |
29 | muteFerdiumShortcutKey, | 30 | muteFerdiumShortcutKey, |
31 | electronVersion, | ||
32 | chromeVersion, | ||
33 | nodeVersion, | ||
34 | osArch, | ||
30 | } from '../environment'; | 35 | } from '../environment'; |
31 | import { aboutAppDetails, ferdiumVersion } from '../environment-remote'; | 36 | import { ferdiumVersion } from '../environment-remote'; |
32 | import { todoActions } from '../features/todos/actions'; | 37 | import { todoActions } from '../features/todos/actions'; |
33 | import { workspaceActions } from '../features/workspaces/actions'; | 38 | import { workspaceActions } from '../features/workspaces/actions'; |
34 | import { workspaceStore } from '../features/workspaces/index'; | 39 | import { workspaceStore } from '../features/workspaces/index'; |
@@ -36,6 +41,9 @@ import apiBase, { serverBase } from '../api/apiBase'; | |||
36 | import { openExternalUrl } from '../helpers/url-helpers'; | 41 | import { openExternalUrl } from '../helpers/url-helpers'; |
37 | import globalMessages from '../i18n/globalMessages'; | 42 | import globalMessages from '../i18n/globalMessages'; |
38 | 43 | ||
44 | // @ts-expect-error Cannot find module '../buildInfo.json' or its corresponding type declarations. | ||
45 | import * as buildInfo from '../buildInfo.json'; | ||
46 | |||
39 | const menuItems = defineMessages({ | 47 | const menuItems = defineMessages({ |
40 | edit: { | 48 | edit: { |
41 | id: 'menu.edit', | 49 | id: 'menu.edit', |
@@ -325,6 +333,14 @@ const menuItems = defineMessages({ | |||
325 | id: 'menu.services.goHome', | 333 | id: 'menu.services.goHome', |
326 | defaultMessage: 'Home', | 334 | defaultMessage: 'Home', |
327 | }, | 335 | }, |
336 | ok: { | ||
337 | id: 'global.ok', | ||
338 | defaultMessage: 'Ok', | ||
339 | }, | ||
340 | copyToClipboard: { | ||
341 | id: 'menu.services.copyToClipboard', | ||
342 | defaultMessage: 'Copy to clipboard', | ||
343 | }, | ||
328 | }); | 344 | }); |
329 | 345 | ||
330 | function getActiveService() { | 346 | function getActiveService() { |
@@ -797,10 +813,6 @@ class FranzMenu { | |||
797 | accelerator: `${altKey()}+F`, | 813 | accelerator: `${altKey()}+F`, |
798 | submenu: [ | 814 | submenu: [ |
799 | { | 815 | { |
800 | label: intl.formatMessage(menuItems.about), | ||
801 | role: 'about', | ||
802 | }, | ||
803 | { | ||
804 | type: 'separator', | 816 | type: 'separator', |
805 | }, | 817 | }, |
806 | { | 818 | { |
@@ -856,15 +868,36 @@ class FranzMenu { | |||
856 | ], | 868 | ], |
857 | }); | 869 | }); |
858 | 870 | ||
871 | const aboutAppDetails = [ | ||
872 | `Version: ${ferdiumVersion}`, | ||
873 | `Electron: ${electronVersion}`, | ||
874 | `Chrome: ${chromeVersion}`, | ||
875 | `Node.js: ${nodeVersion}`, | ||
876 | `Platform: ${osName()}`, | ||
877 | `Arch: ${osArch}`, | ||
878 | `Build date: ${new Date(Number(buildInfo.timestamp))}`, | ||
879 | `Git SHA: ${buildInfo.gitHashShort}`, | ||
880 | `Git branch: ${buildInfo.gitBranch}`, | ||
881 | ].join('\n'); | ||
882 | |||
859 | const about = { | 883 | const about = { |
860 | label: intl.formatMessage(menuItems.about), | 884 | label: intl.formatMessage(menuItems.about), |
861 | click: () => { | 885 | click: () => { |
862 | dialog.showMessageBox({ | 886 | dialog |
863 | type: 'info', | 887 | .showMessageBox({ |
864 | title: 'Ferdium', | 888 | type: 'info', |
865 | message: 'Ferdium', | 889 | title: 'Ferdium', |
866 | detail: aboutAppDetails(), | 890 | message: 'Ferdium', |
867 | }); | 891 | detail: aboutAppDetails, |
892 | buttons: [intl.formatMessage(menuItems.copyToClipboard), intl.formatMessage(menuItems.ok)], | ||
893 | }) | ||
894 | .then(result => { | ||
895 | if (result.response === 0) { | ||
896 | clipboard.write({ | ||
897 | text: aboutAppDetails, | ||
898 | }); | ||
899 | } | ||
900 | }); | ||
868 | }, | 901 | }, |
869 | }; | 902 | }; |
870 | 903 | ||
@@ -889,7 +922,7 @@ class FranzMenu { | |||
889 | }, | 922 | }, |
890 | ); | 923 | ); |
891 | 924 | ||
892 | tpl[5].submenu.unshift(about, { | 925 | tpl[0].submenu.unshift(about, { |
893 | type: 'separator', | 926 | type: 'separator', |
894 | }); | 927 | }); |
895 | } else { | 928 | } else { |