From 44c413bca461863cf04442642bac9f68db1b6200 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Tue, 30 Jul 2019 12:08:46 +0200 Subject: fix(Notifications): Fix issue that blocked notifications from e.g. Slack --- src/stores/AppStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/stores') diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index 72c4b4d0b..bca20a581 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js @@ -189,7 +189,7 @@ export default class AppStore extends Store { if (this.stores.settings.all.app.isAppMuted) return; // TODO: is there a simple way to use blobs for notifications without storing them on disk? - if (options.icon.startsWith('blob:')) { + if (options.icon && options.icon.startsWith('blob:')) { delete options.icon; } -- cgit v1.2.3-54-g00ecf From 4666e85de5c40e4cd7fa952a1d1c873a43dc60fb Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Tue, 30 Jul 2019 15:33:29 +0200 Subject: feat(App): Add option to copy debug information via the help menu --- src/i18n/locales/defaultMessages.json | 139 ++++++++++++++++++++++------------ src/i18n/locales/en-US.json | 5 +- src/i18n/messages/src/lib/Menu.json | 139 ++++++++++++++++++++++------------ src/lib/Menu.js | 40 +++++++++- src/stores/AppStore.js | 25 +++++- 5 files changed, 245 insertions(+), 103 deletions(-) (limited to 'src/stores') diff --git a/src/i18n/locales/defaultMessages.json b/src/i18n/locales/defaultMessages.json index d517b456b..eca3062c2 100644 --- a/src/i18n/locales/defaultMessages.json +++ b/src/i18n/locales/defaultMessages.json @@ -4291,328 +4291,367 @@ } }, { - "defaultMessage": "!!!Terms of Service", + "defaultMessage": "!!!Copy Debug Information", "end": { "column": 3, "line": 134 }, "file": "src/lib/Menu.js", + "id": "menu.help.debugInfo", + "start": { + "column": 13, + "line": 131 + } + }, + { + "defaultMessage": "!!!Franz Debug Information", + "end": { + "column": 3, + "line": 138 + }, + "file": "src/lib/Menu.js", + "id": "menu.help.debugInfoCopiedHeadline", + "start": { + "column": 27, + "line": 135 + } + }, + { + "defaultMessage": "!!!Your Debug Information has been copied to your clipboard.", + "end": { + "column": 3, + "line": 142 + }, + "file": "src/lib/Menu.js", + "id": "menu.help.debugInfoCopiedBody", + "start": { + "column": 23, + "line": 139 + } + }, + { + "defaultMessage": "!!!Terms of Service", + "end": { + "column": 3, + "line": 146 + }, + "file": "src/lib/Menu.js", "id": "menu.help.tos", "start": { "column": 7, - "line": 131 + "line": 143 } }, { "defaultMessage": "!!!Privacy Statement", "end": { "column": 3, - "line": 138 + "line": 150 }, "file": "src/lib/Menu.js", "id": "menu.help.privacy", "start": { "column": 11, - "line": 135 + "line": 147 } }, { "defaultMessage": "!!!File", "end": { "column": 3, - "line": 142 + "line": 154 }, "file": "src/lib/Menu.js", "id": "menu.file", "start": { "column": 8, - "line": 139 + "line": 151 } }, { "defaultMessage": "!!!View", "end": { "column": 3, - "line": 146 + "line": 158 }, "file": "src/lib/Menu.js", "id": "menu.view", "start": { "column": 8, - "line": 143 + "line": 155 } }, { "defaultMessage": "!!!Services", "end": { "column": 3, - "line": 150 + "line": 162 }, "file": "src/lib/Menu.js", "id": "menu.services", "start": { "column": 12, - "line": 147 + "line": 159 } }, { "defaultMessage": "!!!Window", "end": { "column": 3, - "line": 154 + "line": 166 }, "file": "src/lib/Menu.js", "id": "menu.window", "start": { "column": 10, - "line": 151 + "line": 163 } }, { "defaultMessage": "!!!Help", "end": { "column": 3, - "line": 158 + "line": 170 }, "file": "src/lib/Menu.js", "id": "menu.help", "start": { "column": 8, - "line": 155 + "line": 167 } }, { "defaultMessage": "!!!About Franz", "end": { "column": 3, - "line": 162 + "line": 174 }, "file": "src/lib/Menu.js", "id": "menu.app.about", "start": { "column": 9, - "line": 159 + "line": 171 } }, { "defaultMessage": "!!!What's new?", "end": { "column": 3, - "line": 166 + "line": 178 }, "file": "src/lib/Menu.js", "id": "menu.app.announcement", "start": { "column": 16, - "line": 163 + "line": 175 } }, { "defaultMessage": "!!!Settings", "end": { "column": 3, - "line": 170 + "line": 182 }, "file": "src/lib/Menu.js", "id": "menu.app.settings", "start": { "column": 12, - "line": 167 + "line": 179 } }, { "defaultMessage": "!!!Check for updates", "end": { "column": 3, - "line": 174 + "line": 186 }, "file": "src/lib/Menu.js", "id": "menu.app.checkForUpdates", "start": { "column": 19, - "line": 171 + "line": 183 } }, { "defaultMessage": "!!!Hide", "end": { "column": 3, - "line": 178 + "line": 190 }, "file": "src/lib/Menu.js", "id": "menu.app.hide", "start": { "column": 8, - "line": 175 + "line": 187 } }, { "defaultMessage": "!!!Hide Others", "end": { "column": 3, - "line": 182 + "line": 194 }, "file": "src/lib/Menu.js", "id": "menu.app.hideOthers", "start": { "column": 14, - "line": 179 + "line": 191 } }, { "defaultMessage": "!!!Unhide", "end": { "column": 3, - "line": 186 + "line": 198 }, "file": "src/lib/Menu.js", "id": "menu.app.unhide", "start": { "column": 10, - "line": 183 + "line": 195 } }, { "defaultMessage": "!!!Quit", "end": { "column": 3, - "line": 190 + "line": 202 }, "file": "src/lib/Menu.js", "id": "menu.app.quit", "start": { "column": 8, - "line": 187 + "line": 199 } }, { "defaultMessage": "!!!Add New Service...", "end": { "column": 3, - "line": 194 + "line": 206 }, "file": "src/lib/Menu.js", "id": "menu.services.addNewService", "start": { "column": 17, - "line": 191 + "line": 203 } }, { "defaultMessage": "!!!Add New Workspace...", "end": { "column": 3, - "line": 198 + "line": 210 }, "file": "src/lib/Menu.js", "id": "menu.workspaces.addNewWorkspace", "start": { "column": 19, - "line": 195 + "line": 207 } }, { "defaultMessage": "!!!Open workspace drawer", "end": { "column": 3, - "line": 202 + "line": 214 }, "file": "src/lib/Menu.js", "id": "menu.workspaces.openWorkspaceDrawer", "start": { "column": 23, - "line": 199 + "line": 211 } }, { "defaultMessage": "!!!Close workspace drawer", "end": { "column": 3, - "line": 206 + "line": 218 }, "file": "src/lib/Menu.js", "id": "menu.workspaces.closeWorkspaceDrawer", "start": { "column": 24, - "line": 203 + "line": 215 } }, { "defaultMessage": "!!!Activate next service...", "end": { "column": 3, - "line": 210 + "line": 222 }, "file": "src/lib/Menu.js", "id": "menu.services.setNextServiceActive", "start": { "column": 23, - "line": 207 + "line": 219 } }, { "defaultMessage": "!!!Activate previous service...", "end": { "column": 3, - "line": 214 + "line": 226 }, "file": "src/lib/Menu.js", "id": "menu.services.activatePreviousService", "start": { "column": 27, - "line": 211 + "line": 223 } }, { "defaultMessage": "!!!Disable notifications & audio", "end": { "column": 3, - "line": 218 + "line": 230 }, "file": "src/lib/Menu.js", "id": "sidebar.muteApp", "start": { "column": 11, - "line": 215 + "line": 227 } }, { "defaultMessage": "!!!Enable notifications & audio", "end": { "column": 3, - "line": 222 + "line": 234 }, "file": "src/lib/Menu.js", "id": "sidebar.unmuteApp", "start": { "column": 13, - "line": 219 + "line": 231 } }, { "defaultMessage": "!!!Workspaces", "end": { "column": 3, - "line": 226 + "line": 238 }, "file": "src/lib/Menu.js", "id": "menu.workspaces", "start": { "column": 14, - "line": 223 + "line": 235 } }, { "defaultMessage": "!!!Default", "end": { "column": 3, - "line": 230 + "line": 242 }, "file": "src/lib/Menu.js", "id": "menu.workspaces.defaultWorkspace", "start": { "column": 20, - "line": 227 + "line": 239 } } ], diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index e2edbd596..27987e5b7 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json @@ -68,6 +68,9 @@ "menu.file": "File", "menu.help": "Help", "menu.help.changelog": "Changelog", + "menu.help.debugInfo": "Copy Debug Information", + "menu.help.debugInfoCopiedBody": "Your Debug Information has been copied to your clipboard.", + "menu.help.debugInfoCopiedHeadline": "Franz Debug Information", "menu.help.learnMore": "Learn More", "menu.help.privacy": "Privacy Statement", "menu.help.support": "Support", @@ -329,4 +332,4 @@ "workspaceDrawer.workspaceFeatureInfo": "

Franz Workspaces let you focus on what’s important right now. Set up different sets of services and easily switch between them at any time.

You decide which services you need when and where, so we can help you stay on top of your game - or easily switch off from work whenever you want.

", "workspaceDrawer.workspacesSettingsTooltip": "Edit workspaces settings", "workspaces.switchingIndicator.switchingTo": "Switching to" -} \ No newline at end of file +} diff --git a/src/i18n/messages/src/lib/Menu.json b/src/i18n/messages/src/lib/Menu.json index daafb0900..6f878cbd1 100644 --- a/src/i18n/messages/src/lib/Menu.json +++ b/src/i18n/messages/src/lib/Menu.json @@ -376,16 +376,55 @@ "column": 3 } }, + { + "id": "menu.help.debugInfo", + "defaultMessage": "!!!Copy Debug Information", + "file": "src/lib/Menu.js", + "start": { + "line": 131, + "column": 13 + }, + "end": { + "line": 134, + "column": 3 + } + }, + { + "id": "menu.help.debugInfoCopiedHeadline", + "defaultMessage": "!!!Franz Debug Information", + "file": "src/lib/Menu.js", + "start": { + "line": 135, + "column": 27 + }, + "end": { + "line": 138, + "column": 3 + } + }, + { + "id": "menu.help.debugInfoCopiedBody", + "defaultMessage": "!!!Your Debug Information has been copied to your clipboard.", + "file": "src/lib/Menu.js", + "start": { + "line": 139, + "column": 23 + }, + "end": { + "line": 142, + "column": 3 + } + }, { "id": "menu.help.tos", "defaultMessage": "!!!Terms of Service", "file": "src/lib/Menu.js", "start": { - "line": 131, + "line": 143, "column": 7 }, "end": { - "line": 134, + "line": 146, "column": 3 } }, @@ -394,11 +433,11 @@ "defaultMessage": "!!!Privacy Statement", "file": "src/lib/Menu.js", "start": { - "line": 135, + "line": 147, "column": 11 }, "end": { - "line": 138, + "line": 150, "column": 3 } }, @@ -407,11 +446,11 @@ "defaultMessage": "!!!File", "file": "src/lib/Menu.js", "start": { - "line": 139, + "line": 151, "column": 8 }, "end": { - "line": 142, + "line": 154, "column": 3 } }, @@ -420,11 +459,11 @@ "defaultMessage": "!!!View", "file": "src/lib/Menu.js", "start": { - "line": 143, + "line": 155, "column": 8 }, "end": { - "line": 146, + "line": 158, "column": 3 } }, @@ -433,11 +472,11 @@ "defaultMessage": "!!!Services", "file": "src/lib/Menu.js", "start": { - "line": 147, + "line": 159, "column": 12 }, "end": { - "line": 150, + "line": 162, "column": 3 } }, @@ -446,11 +485,11 @@ "defaultMessage": "!!!Window", "file": "src/lib/Menu.js", "start": { - "line": 151, + "line": 163, "column": 10 }, "end": { - "line": 154, + "line": 166, "column": 3 } }, @@ -459,11 +498,11 @@ "defaultMessage": "!!!Help", "file": "src/lib/Menu.js", "start": { - "line": 155, + "line": 167, "column": 8 }, "end": { - "line": 158, + "line": 170, "column": 3 } }, @@ -472,11 +511,11 @@ "defaultMessage": "!!!About Franz", "file": "src/lib/Menu.js", "start": { - "line": 159, + "line": 171, "column": 9 }, "end": { - "line": 162, + "line": 174, "column": 3 } }, @@ -485,11 +524,11 @@ "defaultMessage": "!!!What's new?", "file": "src/lib/Menu.js", "start": { - "line": 163, + "line": 175, "column": 16 }, "end": { - "line": 166, + "line": 178, "column": 3 } }, @@ -498,11 +537,11 @@ "defaultMessage": "!!!Settings", "file": "src/lib/Menu.js", "start": { - "line": 167, + "line": 179, "column": 12 }, "end": { - "line": 170, + "line": 182, "column": 3 } }, @@ -511,11 +550,11 @@ "defaultMessage": "!!!Check for updates", "file": "src/lib/Menu.js", "start": { - "line": 171, + "line": 183, "column": 19 }, "end": { - "line": 174, + "line": 186, "column": 3 } }, @@ -524,11 +563,11 @@ "defaultMessage": "!!!Hide", "file": "src/lib/Menu.js", "start": { - "line": 175, + "line": 187, "column": 8 }, "end": { - "line": 178, + "line": 190, "column": 3 } }, @@ -537,11 +576,11 @@ "defaultMessage": "!!!Hide Others", "file": "src/lib/Menu.js", "start": { - "line": 179, + "line": 191, "column": 14 }, "end": { - "line": 182, + "line": 194, "column": 3 } }, @@ -550,11 +589,11 @@ "defaultMessage": "!!!Unhide", "file": "src/lib/Menu.js", "start": { - "line": 183, + "line": 195, "column": 10 }, "end": { - "line": 186, + "line": 198, "column": 3 } }, @@ -563,11 +602,11 @@ "defaultMessage": "!!!Quit", "file": "src/lib/Menu.js", "start": { - "line": 187, + "line": 199, "column": 8 }, "end": { - "line": 190, + "line": 202, "column": 3 } }, @@ -576,11 +615,11 @@ "defaultMessage": "!!!Add New Service...", "file": "src/lib/Menu.js", "start": { - "line": 191, + "line": 203, "column": 17 }, "end": { - "line": 194, + "line": 206, "column": 3 } }, @@ -589,11 +628,11 @@ "defaultMessage": "!!!Add New Workspace...", "file": "src/lib/Menu.js", "start": { - "line": 195, + "line": 207, "column": 19 }, "end": { - "line": 198, + "line": 210, "column": 3 } }, @@ -602,11 +641,11 @@ "defaultMessage": "!!!Open workspace drawer", "file": "src/lib/Menu.js", "start": { - "line": 199, + "line": 211, "column": 23 }, "end": { - "line": 202, + "line": 214, "column": 3 } }, @@ -615,11 +654,11 @@ "defaultMessage": "!!!Close workspace drawer", "file": "src/lib/Menu.js", "start": { - "line": 203, + "line": 215, "column": 24 }, "end": { - "line": 206, + "line": 218, "column": 3 } }, @@ -628,11 +667,11 @@ "defaultMessage": "!!!Activate next service...", "file": "src/lib/Menu.js", "start": { - "line": 207, + "line": 219, "column": 23 }, "end": { - "line": 210, + "line": 222, "column": 3 } }, @@ -641,11 +680,11 @@ "defaultMessage": "!!!Activate previous service...", "file": "src/lib/Menu.js", "start": { - "line": 211, + "line": 223, "column": 27 }, "end": { - "line": 214, + "line": 226, "column": 3 } }, @@ -654,11 +693,11 @@ "defaultMessage": "!!!Disable notifications & audio", "file": "src/lib/Menu.js", "start": { - "line": 215, + "line": 227, "column": 11 }, "end": { - "line": 218, + "line": 230, "column": 3 } }, @@ -667,11 +706,11 @@ "defaultMessage": "!!!Enable notifications & audio", "file": "src/lib/Menu.js", "start": { - "line": 219, + "line": 231, "column": 13 }, "end": { - "line": 222, + "line": 234, "column": 3 } }, @@ -680,11 +719,11 @@ "defaultMessage": "!!!Workspaces", "file": "src/lib/Menu.js", "start": { - "line": 223, + "line": 235, "column": 14 }, "end": { - "line": 226, + "line": 238, "column": 3 } }, @@ -693,11 +732,11 @@ "defaultMessage": "!!!Default", "file": "src/lib/Menu.js", "start": { - "line": 227, + "line": 239, "column": 20 }, "end": { - "line": 230, + "line": 242, "column": 3 } } 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 @@ -import { remote, shell } from 'electron'; +import { remote, shell, clipboard } from 'electron'; import { observable, autorun } from 'mobx'; import { defineMessages } from 'react-intl'; @@ -128,6 +128,18 @@ const menuItems = defineMessages({ id: 'menu.help.support', defaultMessage: '!!!Support', }, + debugInfo: { + id: 'menu.help.debugInfo', + defaultMessage: '!!!Copy Debug Information', + }, + debugInfoCopiedHeadline: { + id: 'menu.help.debugInfoCopiedHeadline', + defaultMessage: '!!!Franz Debug Information', + }, + debugInfoCopiedBody: { + id: 'menu.help.debugInfoCopiedBody', + defaultMessage: '!!!Your Debug Information has been copied to your clipboard.', + }, tos: { id: 'menu.help.tos', defaultMessage: '!!!Terms of Service', @@ -760,6 +772,10 @@ export default class FranzMenu { tpl[4].submenu = this.workspacesMenu(); } + tpl[tpl.length - 1].submenu.push({ + type: 'separator', + }, this.debugMenu()); + this.currentTemplate = tpl; const menu = Menu.buildFromTemplate(tpl); Menu.setApplicationMenu(menu); @@ -870,6 +886,28 @@ export default class FranzMenu { return menu; } + debugMenu() { + const { intl } = window.franz; + + return { + label: intl.formatMessage(menuItems.debugInfo), + click: () => { + const { debugInfo } = this.stores.app; + + clipboard.write({ + text: JSON.stringify(debugInfo), + }); + + this.actions.app.notify({ + title: intl.formatMessage(menuItems.debugInfoCopiedHeadline), + options: { + body: intl.formatMessage(menuItems.debugInfoCopiedBody), + }, + }); + }, + }; + } + _getServiceName(service) { if (service.name) { return service.name; diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index bca20a581..2ac306a2a 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js @@ -8,6 +8,9 @@ import AutoLaunch from 'auto-launch'; import prettyBytes from 'pretty-bytes'; import ms from 'ms'; import { URL } from 'url'; +import os from 'os'; +import path from 'path'; +import { readJsonSync } from 'fs-extra'; import Store from './lib/Store'; import Request from './lib/Request'; @@ -23,7 +26,7 @@ import { isValidExternalURL } from '../helpers/url-helpers'; const debug = require('debug')('Franz:AppStore'); -const { app, systemPreferences } = remote; +const { app, systemPreferences, screen } = remote; const mainWindow = remote.getCurrentWindow(); @@ -182,6 +185,26 @@ export default class AppStore extends Store { return prettyBytes(this.getAppCacheSizeRequest.execute().result || 0); } + @computed get debugInfo() { + return { + host: { + platform: process.platform, + release: os.release(), + screens: screen.getAllDisplays(), + }, + franz: { + version: app.getVersion(), + electron: process.versions.electron, + installedRecipes: this.stores.recipes.all.map(recipe => ({ id: recipe.id, version: recipe.version })), + devRecipes: this.stores.recipePreviews.dev.map(recipe => ({ id: recipe.id, version: recipe.version })), + services: this.stores.services.all.map(service => ({ id: service.id, recipe: service.recipe.id })), + workspaces: this.stores.workspaces.workspaces.map(workspace => ({ id: workspace.id, services: workspace.services })), + windowSettings: readJsonSync(path.join(app.getPath('userData'), 'window-state.json')), + user: this.stores.user.data.id, + }, + }; + } + // Actions @action _notify({ title, options, notificationId, serviceId = null, -- cgit v1.2.3-54-g00ecf