diff options
author | 2019-07-30 15:33:29 +0200 | |
---|---|---|
committer | 2019-07-30 15:33:29 +0200 | |
commit | 4666e85de5c40e4cd7fa952a1d1c873a43dc60fb (patch) | |
tree | c53dad1ac7eea1641b79825d0d171bb027603b60 /src/lib | |
parent | fix(Notifications): Fix issue that blocked notifications from e.g. Slack (diff) | |
download | ferdium-app-4666e85de5c40e4cd7fa952a1d1c873a43dc60fb.tar.gz ferdium-app-4666e85de5c40e4cd7fa952a1d1c873a43dc60fb.tar.zst ferdium-app-4666e85de5c40e4cd7fa952a1d1c873a43dc60fb.zip |
feat(App): Add option to copy debug information via the help menu
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Menu.js | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index e0dfd736e..22d788918 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -1,4 +1,4 @@ | |||
1 | import { remote, shell } from 'electron'; | 1 | import { remote, shell, clipboard } from 'electron'; |
2 | import { observable, autorun } from 'mobx'; | 2 | import { observable, autorun } from 'mobx'; |
3 | import { defineMessages } from 'react-intl'; | 3 | import { defineMessages } from 'react-intl'; |
4 | 4 | ||
@@ -128,6 +128,18 @@ const menuItems = defineMessages({ | |||
128 | id: 'menu.help.support', | 128 | id: 'menu.help.support', |
129 | defaultMessage: '!!!Support', | 129 | defaultMessage: '!!!Support', |
130 | }, | 130 | }, |
131 | debugInfo: { | ||
132 | id: 'menu.help.debugInfo', | ||
133 | defaultMessage: '!!!Copy Debug Information', | ||
134 | }, | ||
135 | debugInfoCopiedHeadline: { | ||
136 | id: 'menu.help.debugInfoCopiedHeadline', | ||
137 | defaultMessage: '!!!Franz Debug Information', | ||
138 | }, | ||
139 | debugInfoCopiedBody: { | ||
140 | id: 'menu.help.debugInfoCopiedBody', | ||
141 | defaultMessage: '!!!Your Debug Information has been copied to your clipboard.', | ||
142 | }, | ||
131 | tos: { | 143 | tos: { |
132 | id: 'menu.help.tos', | 144 | id: 'menu.help.tos', |
133 | defaultMessage: '!!!Terms of Service', | 145 | defaultMessage: '!!!Terms of Service', |
@@ -760,6 +772,10 @@ export default class FranzMenu { | |||
760 | tpl[4].submenu = this.workspacesMenu(); | 772 | tpl[4].submenu = this.workspacesMenu(); |
761 | } | 773 | } |
762 | 774 | ||
775 | tpl[tpl.length - 1].submenu.push({ | ||
776 | type: 'separator', | ||
777 | }, this.debugMenu()); | ||
778 | |||
763 | this.currentTemplate = tpl; | 779 | this.currentTemplate = tpl; |
764 | const menu = Menu.buildFromTemplate(tpl); | 780 | const menu = Menu.buildFromTemplate(tpl); |
765 | Menu.setApplicationMenu(menu); | 781 | Menu.setApplicationMenu(menu); |
@@ -870,6 +886,28 @@ export default class FranzMenu { | |||
870 | return menu; | 886 | return menu; |
871 | } | 887 | } |
872 | 888 | ||
889 | debugMenu() { | ||
890 | const { intl } = window.franz; | ||
891 | |||
892 | return { | ||
893 | label: intl.formatMessage(menuItems.debugInfo), | ||
894 | click: () => { | ||
895 | const { debugInfo } = this.stores.app; | ||
896 | |||
897 | clipboard.write({ | ||
898 | text: JSON.stringify(debugInfo), | ||
899 | }); | ||
900 | |||
901 | this.actions.app.notify({ | ||
902 | title: intl.formatMessage(menuItems.debugInfoCopiedHeadline), | ||
903 | options: { | ||
904 | body: intl.formatMessage(menuItems.debugInfoCopiedBody), | ||
905 | }, | ||
906 | }); | ||
907 | }, | ||
908 | }; | ||
909 | } | ||
910 | |||
873 | _getServiceName(service) { | 911 | _getServiceName(service) { |
874 | if (service.name) { | 912 | if (service.name) { |
875 | return service.name; | 913 | return service.name; |