From 079765bad8a577d140166098e8dd0b7fe0660e4e Mon Sep 17 00:00:00 2001 From: Vijay Raghavan Aravamudhan Date: Sat, 5 Jun 2021 16:28:52 +0530 Subject: Added ability to turn off notifications for clipboard events generated by context menu actions (#1494) --- .../settings/settings/EditSettingsForm.js | 1 + src/config.js | 1 + src/containers/settings/EditSettingsScreen.js | 10 ++ src/i18n/locales/defaultMessages.json | 149 +++++++++++---------- src/i18n/locales/en-US.json | 1 + .../containers/settings/EditSettingsScreen.json | 149 +++++++++++---------- src/stores/ServicesStore.js | 5 + src/webview/contextMenu.js | 4 +- src/webview/contextMenuBuilder.js | 17 ++- src/webview/recipe.js | 1 + 10 files changed, 193 insertions(+), 145 deletions(-) (limited to 'src') diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js index 08e5efa2a..8a362d3c9 100644 --- a/src/components/settings/settings/EditSettingsForm.js +++ b/src/components/settings/settings/EditSettingsForm.js @@ -504,6 +504,7 @@ export default @observer class EditSettingsForm extends Component { { this.state.activeSetttingsTab === 'privacy' && (
+ {(isWindows || isMac) && ( )} diff --git a/src/config.js b/src/config.js index d3749b438..da2eff0cc 100644 --- a/src/config.js +++ b/src/config.js @@ -106,6 +106,7 @@ export const DEFAULT_APP_SETTINGS = { minimizeToSystemTray: false, closeToSystemTray: false, privateNotifications: false, + clipboardNotifications: true, notifyTaskBarOnMessage: false, showDisabledServices: true, showMessageBadgeWhenMuted: true, diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index ff22bc45a..245fd8a63 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js @@ -68,6 +68,10 @@ const messages = defineMessages({ id: 'settings.app.form.privateNotifications', defaultMessage: '!!!Don\'t show message content in notifications', }, + clipboardNotifications: { + id: 'settings.app.form.clipboardNotifications', + defaultMessage: '!!!Don\'t show notifications for clipboard events', + }, notifyTaskBarOnMessage: { id: 'settings.app.form.notifyTaskBarOnMessage', defaultMessage: '!!!Notify TaskBar/Dock on new message', @@ -248,6 +252,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e minimizeToSystemTray: settingsData.minimizeToSystemTray, closeToSystemTray: settingsData.closeToSystemTray, privateNotifications: settingsData.privateNotifications, + clipboardNotifications: settingsData.clipboardNotifications, notifyTaskBarOnMessage: settingsData.notifyTaskBarOnMessage, navigationBarBehaviour: settingsData.navigationBarBehaviour, searchEngine: settingsData.searchEngine, @@ -400,6 +405,11 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e value: settings.all.app.privateNotifications, default: DEFAULT_APP_SETTINGS.privateNotifications, }, + clipboardNotifications: { + label: intl.formatMessage(messages.clipboardNotifications), + value: settings.all.app.clipboardNotifications, + default: DEFAULT_APP_SETTINGS.clipboardNotifications, + }, notifyTaskBarOnMessage: { label: intl.formatMessage(messages.notifyTaskBarOnMessage), value: settings.all.app.notifyTaskBarOnMessage, diff --git a/src/i18n/locales/defaultMessages.json b/src/i18n/locales/defaultMessages.json index a72d5c89e..2f998a2c2 100644 --- a/src/i18n/locales/defaultMessages.json +++ b/src/i18n/locales/defaultMessages.json @@ -5029,445 +5029,458 @@ } }, { - "defaultMessage": "!!!Notify TaskBar/Dock on new message", + "defaultMessage": "!!!Don't show notifications for clipboard events", "end": { "column": 3, "line": 74 }, "file": "src/containers/settings/EditSettingsScreen.js", - "id": "settings.app.form.notifyTaskBarOnMessage", + "id": "settings.app.form.clipboardNotifications", "start": { "column": 26, "line": 71 } }, { - "defaultMessage": "!!!Navigation bar behaviour", + "defaultMessage": "!!!Notify TaskBar/Dock on new message", "end": { "column": 3, "line": 78 }, "file": "src/containers/settings/EditSettingsScreen.js", - "id": "settings.app.form.navigationBarBehaviour", + "id": "settings.app.form.notifyTaskBarOnMessage", "start": { "column": 26, "line": 75 } }, { - "defaultMessage": "!!!Search engine", + "defaultMessage": "!!!Navigation bar behaviour", "end": { "column": 3, "line": 82 }, "file": "src/containers/settings/EditSettingsScreen.js", + "id": "settings.app.form.navigationBarBehaviour", + "start": { + "column": 26, + "line": 79 + } + }, + { + "defaultMessage": "!!!Search engine", + "end": { + "column": 3, + "line": 86 + }, + "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.searchEngine", "start": { "column": 16, - "line": 79 + "line": 83 } }, { "defaultMessage": "!!!Send telemetry data", "end": { "column": 3, - "line": 86 + "line": 90 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.sentry", "start": { "column": 10, - "line": 83 + "line": 87 } }, { "defaultMessage": "!!!Enable service hibernation", "end": { "column": 3, - "line": 90 + "line": 94 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.hibernate", "start": { "column": 13, - "line": 87 + "line": 91 } }, { "defaultMessage": "!!!Keep services in hibernation on startup", "end": { "column": 3, - "line": 94 + "line": 98 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.hibernateOnStartup", "start": { "column": 22, - "line": 91 + "line": 95 } }, { "defaultMessage": "!!!Hibernation strategy", "end": { "column": 3, - "line": 98 + "line": 102 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.hibernationStrategy", "start": { "column": 23, - "line": 95 + "line": 99 } }, { "defaultMessage": "!!!Todo Server", "end": { "column": 3, - "line": 102 + "line": 106 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.predefinedTodoServer", "start": { "column": 24, - "line": 99 + "line": 103 } }, { "defaultMessage": "!!!Custom TodoServer", "end": { "column": 3, - "line": 106 + "line": 110 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.customTodoServer", "start": { "column": 20, - "line": 103 + "line": 107 } }, { "defaultMessage": "!!!Enable Password Lock", "end": { "column": 3, - "line": 110 + "line": 114 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.enableLock", "start": { "column": 14, - "line": 107 + "line": 111 } }, { "defaultMessage": "!!!Password", "end": { "column": 3, - "line": 114 + "line": 118 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.lockPassword", "start": { "column": 16, - "line": 111 + "line": 115 } }, { "defaultMessage": "!!!Allow using Touch ID to unlock", "end": { "column": 3, - "line": 118 + "line": 122 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.useTouchIdToUnlock", "start": { "column": 22, - "line": 115 + "line": 119 } }, { "defaultMessage": "!!!Lock after inactivity", "end": { "column": 3, - "line": 122 + "line": 126 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.inactivityLock", "start": { "column": 18, - "line": 119 + "line": 123 } }, { "defaultMessage": "!!!Enable scheduled Do-not-Disturb", "end": { "column": 3, - "line": 126 + "line": 130 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.scheduledDNDEnabled", "start": { "column": 23, - "line": 123 + "line": 127 } }, { "defaultMessage": "!!!From", "end": { "column": 3, - "line": 130 + "line": 134 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.scheduledDNDStart", "start": { "column": 21, - "line": 127 + "line": 131 } }, { "defaultMessage": "!!!To", "end": { "column": 3, - "line": 134 + "line": 138 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.scheduledDNDEnd", "start": { "column": 19, - "line": 131 + "line": 135 } }, { "defaultMessage": "!!!Language", "end": { "column": 3, - "line": 138 + "line": 142 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.language", "start": { "column": 12, - "line": 135 + "line": 139 } }, { "defaultMessage": "!!!Dark Mode", "end": { "column": 3, - "line": 142 + "line": 146 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.darkMode", "start": { "column": 12, - "line": 139 + "line": 143 } }, { "defaultMessage": "!!!Synchronize dark mode with my OS's dark mode setting", "end": { "column": 3, - "line": 146 + "line": 150 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.adaptableDarkMode", "start": { "column": 21, - "line": 143 + "line": 147 } }, { "defaultMessage": "!!!Enable universal Dark Mode", "end": { "column": 3, - "line": 150 + "line": 154 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.universalDarkMode", "start": { "column": 21, - "line": 147 + "line": 151 } }, { "defaultMessage": "!!!Sidebar width", "end": { "column": 3, - "line": 154 + "line": 158 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.serviceRibbonWidth", "start": { "column": 22, - "line": 151 + "line": 155 } }, { "defaultMessage": "!!!Service icon size", "end": { "column": 3, - "line": 158 + "line": 162 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.iconSize", "start": { "column": 12, - "line": 155 + "line": 159 } }, { "defaultMessage": "!!!Use vertical style", "end": { "column": 3, - "line": 162 + "line": 166 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.useVerticalStyle", "start": { "column": 20, - "line": 159 + "line": 163 } }, { "defaultMessage": "!!!Always show workspace drawer", "end": { "column": 3, - "line": 166 + "line": 170 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.alwaysShowWorkspaces", "start": { "column": 24, - "line": 163 + "line": 167 } }, { "defaultMessage": "!!!Accent color", "end": { "column": 3, - "line": 170 + "line": 174 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.accentColor", "start": { "column": 15, - "line": 167 + "line": 171 } }, { "defaultMessage": "!!!Display disabled services tabs", "end": { "column": 3, - "line": 174 + "line": 178 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.showDisabledServices", "start": { "column": 24, - "line": 171 + "line": 175 } }, { "defaultMessage": "!!!Show unread message badge when notifications are disabled", "end": { "column": 3, - "line": 178 + "line": 182 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.showMessagesBadgesWhenMuted", "start": { "column": 29, - "line": 175 + "line": 179 } }, { "defaultMessage": "!!!Show draggable area on window", "end": { "column": 3, - "line": 182 + "line": 186 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.showDragArea", "start": { "column": 16, - "line": 179 + "line": 183 } }, { "defaultMessage": "!!!Enable spell checking", "end": { "column": 3, - "line": 186 + "line": 190 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.enableSpellchecking", "start": { "column": 23, - "line": 183 + "line": 187 } }, { "defaultMessage": "!!!Enable GPU Acceleration", "end": { "column": 3, - "line": 190 + "line": 194 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.enableGPUAcceleration", "start": { "column": 25, - "line": 187 + "line": 191 } }, { "defaultMessage": "!!!Include beta versions", "end": { "column": 3, - "line": 194 + "line": 198 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.beta", "start": { "column": 8, - "line": 191 + "line": 195 } }, { "defaultMessage": "!!!Enable updates", "end": { "column": 3, - "line": 198 + "line": 202 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.automaticUpdates", "start": { "column": 20, - "line": 195 + "line": 199 } }, { "defaultMessage": "!!!Enable Franz Todos", "end": { "column": 3, - "line": 202 + "line": 206 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.enableTodos", "start": { "column": 15, - "line": 199 + "line": 203 } }, { "defaultMessage": "!!!Keep all workspaces loaded", "end": { "column": 3, - "line": 206 + "line": 210 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.keepAllWorkspacesLoaded", "start": { "column": 27, - "line": 203 + "line": 207 } } ], diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index ef1da3d08..415af9a7c 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json @@ -293,6 +293,7 @@ "settings.app.form.autoLaunchOnStart": "Launch Ferdi on start", "settings.app.form.automaticUpdates": "Enable updates", "settings.app.form.beta": "Include beta versions", + "settings.app.form.clipboardNotifications": "Don't show notifications for clipboard events", "settings.app.form.closeToSystemTray": "Close Ferdi to system tray", "settings.app.form.customTodoServer": "Custom Todo Server", "settings.app.form.darkMode": "Enable dark mode", diff --git a/src/i18n/messages/src/containers/settings/EditSettingsScreen.json b/src/i18n/messages/src/containers/settings/EditSettingsScreen.json index 55cb3ba12..cd5462b59 100644 --- a/src/i18n/messages/src/containers/settings/EditSettingsScreen.json +++ b/src/i18n/messages/src/containers/settings/EditSettingsScreen.json @@ -130,8 +130,8 @@ } }, { - "id": "settings.app.form.notifyTaskBarOnMessage", - "defaultMessage": "!!!Notify TaskBar/Dock on new message", + "id": "settings.app.form.clipboardNotifications", + "defaultMessage": "!!!Don't show notifications for clipboard events", "file": "src/containers/settings/EditSettingsScreen.js", "start": { "line": 71, @@ -143,8 +143,8 @@ } }, { - "id": "settings.app.form.navigationBarBehaviour", - "defaultMessage": "!!!Navigation bar behaviour", + "id": "settings.app.form.notifyTaskBarOnMessage", + "defaultMessage": "!!!Notify TaskBar/Dock on new message", "file": "src/containers/settings/EditSettingsScreen.js", "start": { "line": 75, @@ -155,16 +155,29 @@ "column": 3 } }, + { + "id": "settings.app.form.navigationBarBehaviour", + "defaultMessage": "!!!Navigation bar behaviour", + "file": "src/containers/settings/EditSettingsScreen.js", + "start": { + "line": 79, + "column": 26 + }, + "end": { + "line": 82, + "column": 3 + } + }, { "id": "settings.app.form.searchEngine", "defaultMessage": "!!!Search engine", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 79, + "line": 83, "column": 16 }, "end": { - "line": 82, + "line": 86, "column": 3 } }, @@ -173,11 +186,11 @@ "defaultMessage": "!!!Send telemetry data", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 83, + "line": 87, "column": 10 }, "end": { - "line": 86, + "line": 90, "column": 3 } }, @@ -186,11 +199,11 @@ "defaultMessage": "!!!Enable service hibernation", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 87, + "line": 91, "column": 13 }, "end": { - "line": 90, + "line": 94, "column": 3 } }, @@ -199,11 +212,11 @@ "defaultMessage": "!!!Keep services in hibernation on startup", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 91, + "line": 95, "column": 22 }, "end": { - "line": 94, + "line": 98, "column": 3 } }, @@ -212,11 +225,11 @@ "defaultMessage": "!!!Hibernation strategy", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 95, + "line": 99, "column": 23 }, "end": { - "line": 98, + "line": 102, "column": 3 } }, @@ -225,11 +238,11 @@ "defaultMessage": "!!!Todo Server", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 99, + "line": 103, "column": 24 }, "end": { - "line": 102, + "line": 106, "column": 3 } }, @@ -238,11 +251,11 @@ "defaultMessage": "!!!Custom TodoServer", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 103, + "line": 107, "column": 20 }, "end": { - "line": 106, + "line": 110, "column": 3 } }, @@ -251,11 +264,11 @@ "defaultMessage": "!!!Enable Password Lock", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 107, + "line": 111, "column": 14 }, "end": { - "line": 110, + "line": 114, "column": 3 } }, @@ -264,11 +277,11 @@ "defaultMessage": "!!!Password", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 111, + "line": 115, "column": 16 }, "end": { - "line": 114, + "line": 118, "column": 3 } }, @@ -277,11 +290,11 @@ "defaultMessage": "!!!Allow using Touch ID to unlock", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 115, + "line": 119, "column": 22 }, "end": { - "line": 118, + "line": 122, "column": 3 } }, @@ -290,11 +303,11 @@ "defaultMessage": "!!!Lock after inactivity", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 119, + "line": 123, "column": 18 }, "end": { - "line": 122, + "line": 126, "column": 3 } }, @@ -303,11 +316,11 @@ "defaultMessage": "!!!Enable scheduled Do-not-Disturb", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 123, + "line": 127, "column": 23 }, "end": { - "line": 126, + "line": 130, "column": 3 } }, @@ -316,11 +329,11 @@ "defaultMessage": "!!!From", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 127, + "line": 131, "column": 21 }, "end": { - "line": 130, + "line": 134, "column": 3 } }, @@ -329,11 +342,11 @@ "defaultMessage": "!!!To", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 131, + "line": 135, "column": 19 }, "end": { - "line": 134, + "line": 138, "column": 3 } }, @@ -342,11 +355,11 @@ "defaultMessage": "!!!Language", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 135, + "line": 139, "column": 12 }, "end": { - "line": 138, + "line": 142, "column": 3 } }, @@ -355,11 +368,11 @@ "defaultMessage": "!!!Dark Mode", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 139, + "line": 143, "column": 12 }, "end": { - "line": 142, + "line": 146, "column": 3 } }, @@ -368,11 +381,11 @@ "defaultMessage": "!!!Synchronize dark mode with my OS's dark mode setting", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 143, + "line": 147, "column": 21 }, "end": { - "line": 146, + "line": 150, "column": 3 } }, @@ -381,11 +394,11 @@ "defaultMessage": "!!!Enable universal Dark Mode", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 147, + "line": 151, "column": 21 }, "end": { - "line": 150, + "line": 154, "column": 3 } }, @@ -394,11 +407,11 @@ "defaultMessage": "!!!Sidebar width", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 151, + "line": 155, "column": 22 }, "end": { - "line": 154, + "line": 158, "column": 3 } }, @@ -407,11 +420,11 @@ "defaultMessage": "!!!Service icon size", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 155, + "line": 159, "column": 12 }, "end": { - "line": 158, + "line": 162, "column": 3 } }, @@ -420,11 +433,11 @@ "defaultMessage": "!!!Use vertical style", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 159, + "line": 163, "column": 20 }, "end": { - "line": 162, + "line": 166, "column": 3 } }, @@ -433,11 +446,11 @@ "defaultMessage": "!!!Always show workspace drawer", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 163, + "line": 167, "column": 24 }, "end": { - "line": 166, + "line": 170, "column": 3 } }, @@ -446,11 +459,11 @@ "defaultMessage": "!!!Accent color", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 167, + "line": 171, "column": 15 }, "end": { - "line": 170, + "line": 174, "column": 3 } }, @@ -459,11 +472,11 @@ "defaultMessage": "!!!Display disabled services tabs", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 171, + "line": 175, "column": 24 }, "end": { - "line": 174, + "line": 178, "column": 3 } }, @@ -472,11 +485,11 @@ "defaultMessage": "!!!Show unread message badge when notifications are disabled", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 175, + "line": 179, "column": 29 }, "end": { - "line": 178, + "line": 182, "column": 3 } }, @@ -485,11 +498,11 @@ "defaultMessage": "!!!Show draggable area on window", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 179, + "line": 183, "column": 16 }, "end": { - "line": 182, + "line": 186, "column": 3 } }, @@ -498,11 +511,11 @@ "defaultMessage": "!!!Enable spell checking", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 183, + "line": 187, "column": 23 }, "end": { - "line": 186, + "line": 190, "column": 3 } }, @@ -511,11 +524,11 @@ "defaultMessage": "!!!Enable GPU Acceleration", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 187, + "line": 191, "column": 25 }, "end": { - "line": 190, + "line": 194, "column": 3 } }, @@ -524,11 +537,11 @@ "defaultMessage": "!!!Include beta versions", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 191, + "line": 195, "column": 8 }, "end": { - "line": 194, + "line": 198, "column": 3 } }, @@ -537,11 +550,11 @@ "defaultMessage": "!!!Enable updates", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 195, + "line": 199, "column": 20 }, "end": { - "line": 198, + "line": 202, "column": 3 } }, @@ -550,11 +563,11 @@ "defaultMessage": "!!!Enable Franz Todos", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 199, + "line": 203, "column": 15 }, "end": { - "line": 202, + "line": 206, "column": 3 } }, @@ -563,11 +576,11 @@ "defaultMessage": "!!!Keep all workspaces loaded", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 203, + "line": 207, "column": 27 }, "end": { - "line": 206, + "line": 210, "column": 3 } } diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 11915bc44..48b128966 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js @@ -134,6 +134,11 @@ export default class ServicesStore extends Store { () => this.stores.settings.app.searchEngine, () => this._shareSettingsWithServiceProcess(), ); + + reaction( + () => this.stores.settings.app.clipboardNotifications, + () => this._shareSettingsWithServiceProcess(), + ); } initialize() { diff --git a/src/webview/contextMenu.js b/src/webview/contextMenu.js index f19d863ee..567a2d470 100644 --- a/src/webview/contextMenu.js +++ b/src/webview/contextMenu.js @@ -3,7 +3,7 @@ import ContextMenuBuilder from './contextMenuBuilder'; const webContents = getCurrentWebContents(); -export default async function setupContextMenu(isSpellcheckEnabled, getDefaultSpellcheckerLanguage, getSpellcheckerLanguage, getSearchEngine) { +export default async function setupContextMenu(isSpellcheckEnabled, getDefaultSpellcheckerLanguage, getSpellcheckerLanguage, getSearchEngine, getClipboardNotifications) { const contextMenuBuilder = new ContextMenuBuilder( webContents, ); @@ -11,7 +11,7 @@ export default async function setupContextMenu(isSpellcheckEnabled, getDefaultSp webContents.on('context-menu', (e, props) => { // TODO?: e.preventDefault(); contextMenuBuilder.showPopupMenu( - { ...props, searchEngine: getSearchEngine() }, + { ...props, searchEngine: getSearchEngine(), clipboardNotifications: getClipboardNotifications() }, isSpellcheckEnabled(), getDefaultSpellcheckerLanguage(), getSpellcheckerLanguage(), diff --git a/src/webview/contextMenuBuilder.js b/src/webview/contextMenuBuilder.js index 7c178145d..c26f192fe 100644 --- a/src/webview/contextMenuBuilder.js +++ b/src/webview/contextMenuBuilder.js @@ -161,7 +161,7 @@ module.exports = class ContextMenuBuilder { // Omit the mailto: portion of the link; we just want the address const url = isEmailAddress ? menuInfo.linkText : menuInfo.linkURL; clipboard.writeText(url); - this.sendNotificationOnClipboardEvent(`Link URL copied: ${url}`); + this._sendNotificationOnClipboardEvent(menuInfo.clipboardNotifications, () => `Link URL copied: ${url}`); }, }); @@ -321,7 +321,7 @@ module.exports = class ContextMenuBuilder { const result = this.convertImageToBase64(menuInfo.srcURL, dataURL => clipboard.writeImage(nativeImage.createFromDataURL(dataURL))); - this.sendNotificationOnClipboardEvent(`Image copied from URL: ${menuInfo.srcURL}`); + this._sendNotificationOnClipboardEvent(menuInfo.clipboardNotifications, () => `Image copied from URL: ${menuInfo.srcURL}`); return result; }, }); @@ -332,7 +332,7 @@ module.exports = class ContextMenuBuilder { label: this.stringTable.copyImageUrl(), click: () => { const result = clipboard.writeText(menuInfo.srcURL); - this.sendNotificationOnClipboardEvent(`Image URL copied: ${menuInfo.srcURL}`); + this._sendNotificationOnClipboardEvent(menuInfo.clipboardNotifications, () => `Image URL copied: ${menuInfo.srcURL}`); return result; }, }); @@ -357,7 +357,7 @@ module.exports = class ContextMenuBuilder { }, }); }); - this.sendNotificationOnClipboardEvent(`Image downloaded: ${urlWithoutBlob}`); + this._sendNotificationOnClipboardEvent(menuInfo.clipboardNotifications, () => `Image downloaded: ${urlWithoutBlob}`); }, }); @@ -520,7 +520,7 @@ module.exports = class ContextMenuBuilder { enabled: true, click: () => { clipboard.writeText(window.location.href); - this.sendNotificationOnClipboardEvent(`Page URL copied: ${window.location.href}`); + this._sendNotificationOnClipboardEvent(menu.clipboardNotifications, () => `Page URL copied: ${window.location.href}`); }, })); @@ -560,11 +560,14 @@ module.exports = class ContextMenuBuilder { return menu; } - sendNotificationOnClipboardEvent(notificationText) { + _sendNotificationOnClipboardEvent(isDisabled, notificationText) { + if (isDisabled) { + return; + } // eslint-disable-next-line no-new new window.Notification('Data copied into Clipboard', { - body: notificationText, + body: notificationText(), }); } }; diff --git a/src/webview/recipe.js b/src/webview/recipe.js index 5a24effa2..6c382d388 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js @@ -92,6 +92,7 @@ class RecipeController { () => this.settings.app.spellcheckerLanguage, () => this.spellcheckerLanguage, () => this.settings.app.searchEngine, + () => this.settings.app.clipboardNotifications, ); autorun(() => this.update()); -- cgit v1.2.3-70-g09d2