diff options
author | 2019-09-08 10:44:12 +0200 | |
---|---|---|
committer | 2019-09-08 10:44:12 +0200 | |
commit | c381775c9783b2af8c8ecc2c55e76aaab42ed3ef (patch) | |
tree | 4927aa4b86c03712cd7bf456a56fe9e0367b0715 | |
parent | Fix errors in 5.3.0 version merge (diff) | |
download | ferdium-app-c381775c9783b2af8c8ecc2c55e76aaab42ed3ef.tar.gz ferdium-app-c381775c9783b2af8c8ecc2c55e76aaab42ed3ef.tar.zst ferdium-app-c381775c9783b2af8c8ecc2c55e76aaab42ed3ef.zip |
Implement meetfranz/franz#879
-rw-r--r-- | src/components/settings/settings/EditSettingsForm.js | 1 | ||||
-rw-r--r-- | src/config.js | 1 | ||||
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 10 | ||||
-rw-r--r-- | src/i18n/locales/en-US.json | 1 | ||||
-rw-r--r-- | src/i18n/messages/src/containers/settings/EditSettingsScreen.json | 53 | ||||
-rw-r--r-- | src/stores/ServicesStore.js | 13 |
6 files changed, 57 insertions, 22 deletions
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js index b59e3a74a..d3a1ede82 100644 --- a/src/components/settings/settings/EditSettingsForm.js +++ b/src/components/settings/settings/EditSettingsForm.js | |||
@@ -172,6 +172,7 @@ export default @observer class EditSettingsForm extends Component { | |||
172 | <Toggle field={form.$('autoLaunchOnStart')} /> | 172 | <Toggle field={form.$('autoLaunchOnStart')} /> |
173 | <Toggle field={form.$('runInBackground')} /> | 173 | <Toggle field={form.$('runInBackground')} /> |
174 | <Toggle field={form.$('enableSystemTray')} /> | 174 | <Toggle field={form.$('enableSystemTray')} /> |
175 | <Toggle field={form.$('privateNotifications')} /> | ||
175 | {process.platform === 'win32' && ( | 176 | {process.platform === 'win32' && ( |
176 | <Toggle field={form.$('minimizeToSystemTray')} /> | 177 | <Toggle field={form.$('minimizeToSystemTray')} /> |
177 | )} | 178 | )} |
diff --git a/src/config.js b/src/config.js index 06b4b79a9..3e0000a57 100644 --- a/src/config.js +++ b/src/config.js | |||
@@ -36,6 +36,7 @@ export const DEFAULT_APP_SETTINGS = { | |||
36 | runInBackground: true, | 36 | runInBackground: true, |
37 | enableSystemTray: true, | 37 | enableSystemTray: true, |
38 | minimizeToSystemTray: false, | 38 | minimizeToSystemTray: false, |
39 | privateNotifications: false, | ||
39 | server: LIVE_API, | 40 | server: LIVE_API, |
40 | todoServer: PRODUCTION_TODOS_FRONTEND_URL, | 41 | todoServer: PRODUCTION_TODOS_FRONTEND_URL, |
41 | showDisabledServices: true, | 42 | showDisabledServices: true, |
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index d03b01539..73385d7b8 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js | |||
@@ -43,6 +43,10 @@ const messages = defineMessages({ | |||
43 | id: 'settings.app.form.minimizeToSystemTray', | 43 | id: 'settings.app.form.minimizeToSystemTray', |
44 | defaultMessage: '!!!Minimize Ferdi to system tray', | 44 | defaultMessage: '!!!Minimize Ferdi to system tray', |
45 | }, | 45 | }, |
46 | privateNotifications: { | ||
47 | id: 'settings.app.form.privateNotifications', | ||
48 | defaultMessage: '!!!Don\'t show message content in notifications', | ||
49 | }, | ||
46 | server: { | 50 | server: { |
47 | id: 'settings.app.form.server', | 51 | id: 'settings.app.form.server', |
48 | defaultMessage: '!!!Server', | 52 | defaultMessage: '!!!Server', |
@@ -110,6 +114,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
110 | runInBackground: settingsData.runInBackground, | 114 | runInBackground: settingsData.runInBackground, |
111 | enableSystemTray: settingsData.enableSystemTray, | 115 | enableSystemTray: settingsData.enableSystemTray, |
112 | minimizeToSystemTray: settingsData.minimizeToSystemTray, | 116 | minimizeToSystemTray: settingsData.minimizeToSystemTray, |
117 | privateNotifications: settingsData.privateNotifications, | ||
113 | server: settingsData.server, | 118 | server: settingsData.server, |
114 | todoServer: settingsData.todoServer, | 119 | todoServer: settingsData.todoServer, |
115 | enableGPUAcceleration: settingsData.enableGPUAcceleration, | 120 | enableGPUAcceleration: settingsData.enableGPUAcceleration, |
@@ -177,6 +182,11 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
177 | value: settings.all.app.minimizeToSystemTray, | 182 | value: settings.all.app.minimizeToSystemTray, |
178 | default: DEFAULT_APP_SETTINGS.minimizeToSystemTray, | 183 | default: DEFAULT_APP_SETTINGS.minimizeToSystemTray, |
179 | }, | 184 | }, |
185 | privateNotifications: { | ||
186 | label: intl.formatMessage(messages.privateNotifications), | ||
187 | value: settings.all.app.privateNotifications, | ||
188 | default: DEFAULT_APP_SETTINGS.privateNotifications, | ||
189 | }, | ||
180 | server: { | 190 | server: { |
181 | label: intl.formatMessage(messages.server), | 191 | label: intl.formatMessage(messages.server), |
182 | value: settings.all.app.server || API, | 192 | value: settings.all.app.server || API, |
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 67f80bf18..7d397b4d3 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json | |||
@@ -214,6 +214,7 @@ | |||
214 | "settings.app.form.enableTodos": "Enable Ferdi Todos", | 214 | "settings.app.form.enableTodos": "Enable Ferdi Todos", |
215 | "settings.app.form.language": "Language", | 215 | "settings.app.form.language": "Language", |
216 | "settings.app.form.minimizeToSystemTray": "Minimize Ferdi to system tray", | 216 | "settings.app.form.minimizeToSystemTray": "Minimize Ferdi to system tray", |
217 | "settings.app.form.privateNotifications": "Don't show message content in notifications", | ||
217 | "settings.app.form.runInBackground": "Keep Ferdi in background when closing the window", | 218 | "settings.app.form.runInBackground": "Keep Ferdi in background when closing the window", |
218 | "settings.app.form.server": "Server", | 219 | "settings.app.form.server": "Server", |
219 | "settings.app.form.showDisabledServices": "Display disabled services tabs", | 220 | "settings.app.form.showDisabledServices": "Display disabled services tabs", |
diff --git a/src/i18n/messages/src/containers/settings/EditSettingsScreen.json b/src/i18n/messages/src/containers/settings/EditSettingsScreen.json index 70ec74ada..d50389066 100644 --- a/src/i18n/messages/src/containers/settings/EditSettingsScreen.json +++ b/src/i18n/messages/src/containers/settings/EditSettingsScreen.json | |||
@@ -65,15 +65,28 @@ | |||
65 | } | 65 | } |
66 | }, | 66 | }, |
67 | { | 67 | { |
68 | "id": "settings.app.form.privateNotifications", | ||
69 | "defaultMessage": "!!!Don't show message content in notifications", | ||
70 | "file": "src/containers/settings/EditSettingsScreen.js", | ||
71 | "start": { | ||
72 | "line": 46, | ||
73 | "column": 24 | ||
74 | }, | ||
75 | "end": { | ||
76 | "line": 49, | ||
77 | "column": 3 | ||
78 | } | ||
79 | }, | ||
80 | { | ||
68 | "id": "settings.app.form.server", | 81 | "id": "settings.app.form.server", |
69 | "defaultMessage": "!!!Server", | 82 | "defaultMessage": "!!!Server", |
70 | "file": "src/containers/settings/EditSettingsScreen.js", | 83 | "file": "src/containers/settings/EditSettingsScreen.js", |
71 | "start": { | 84 | "start": { |
72 | "line": 46, | 85 | "line": 50, |
73 | "column": 10 | 86 | "column": 10 |
74 | }, | 87 | }, |
75 | "end": { | 88 | "end": { |
76 | "line": 49, | 89 | "line": 53, |
77 | "column": 3 | 90 | "column": 3 |
78 | } | 91 | } |
79 | }, | 92 | }, |
@@ -82,11 +95,11 @@ | |||
82 | "defaultMessage": "!!!Todo Server", | 95 | "defaultMessage": "!!!Todo Server", |
83 | "file": "src/containers/settings/EditSettingsScreen.js", | 96 | "file": "src/containers/settings/EditSettingsScreen.js", |
84 | "start": { | 97 | "start": { |
85 | "line": 50, | 98 | "line": 54, |
86 | "column": 14 | 99 | "column": 14 |
87 | }, | 100 | }, |
88 | "end": { | 101 | "end": { |
89 | "line": 53, | 102 | "line": 57, |
90 | "column": 3 | 103 | "column": 3 |
91 | } | 104 | } |
92 | }, | 105 | }, |
@@ -95,11 +108,11 @@ | |||
95 | "defaultMessage": "!!!Language", | 108 | "defaultMessage": "!!!Language", |
96 | "file": "src/containers/settings/EditSettingsScreen.js", | 109 | "file": "src/containers/settings/EditSettingsScreen.js", |
97 | "start": { | 110 | "start": { |
98 | "line": 54, | 111 | "line": 58, |
99 | "column": 12 | 112 | "column": 12 |
100 | }, | 113 | }, |
101 | "end": { | 114 | "end": { |
102 | "line": 57, | 115 | "line": 61, |
103 | "column": 3 | 116 | "column": 3 |
104 | } | 117 | } |
105 | }, | 118 | }, |
@@ -108,11 +121,11 @@ | |||
108 | "defaultMessage": "!!!Dark Mode", | 121 | "defaultMessage": "!!!Dark Mode", |
109 | "file": "src/containers/settings/EditSettingsScreen.js", | 122 | "file": "src/containers/settings/EditSettingsScreen.js", |
110 | "start": { | 123 | "start": { |
111 | "line": 58, | 124 | "line": 62, |
112 | "column": 12 | 125 | "column": 12 |
113 | }, | 126 | }, |
114 | "end": { | 127 | "end": { |
115 | "line": 61, | 128 | "line": 65, |
116 | "column": 3 | 129 | "column": 3 |
117 | } | 130 | } |
118 | }, | 131 | }, |
@@ -121,11 +134,11 @@ | |||
121 | "defaultMessage": "!!!Display disabled services tabs", | 134 | "defaultMessage": "!!!Display disabled services tabs", |
122 | "file": "src/containers/settings/EditSettingsScreen.js", | 135 | "file": "src/containers/settings/EditSettingsScreen.js", |
123 | "start": { | 136 | "start": { |
124 | "line": 62, | 137 | "line": 66, |
125 | "column": 24 | 138 | "column": 24 |
126 | }, | 139 | }, |
127 | "end": { | 140 | "end": { |
128 | "line": 65, | 141 | "line": 69, |
129 | "column": 3 | 142 | "column": 3 |
130 | } | 143 | } |
131 | }, | 144 | }, |
@@ -134,11 +147,11 @@ | |||
134 | "defaultMessage": "!!!Show unread message badge when notifications are disabled", | 147 | "defaultMessage": "!!!Show unread message badge when notifications are disabled", |
135 | "file": "src/containers/settings/EditSettingsScreen.js", | 148 | "file": "src/containers/settings/EditSettingsScreen.js", |
136 | "start": { | 149 | "start": { |
137 | "line": 66, | 150 | "line": 70, |
138 | "column": 29 | 151 | "column": 29 |
139 | }, | 152 | }, |
140 | "end": { | 153 | "end": { |
141 | "line": 69, | 154 | "line": 73, |
142 | "column": 3 | 155 | "column": 3 |
143 | } | 156 | } |
144 | }, | 157 | }, |
@@ -147,11 +160,11 @@ | |||
147 | "defaultMessage": "!!!Enable spell checking", | 160 | "defaultMessage": "!!!Enable spell checking", |
148 | "file": "src/containers/settings/EditSettingsScreen.js", | 161 | "file": "src/containers/settings/EditSettingsScreen.js", |
149 | "start": { | 162 | "start": { |
150 | "line": 70, | 163 | "line": 74, |
151 | "column": 23 | 164 | "column": 23 |
152 | }, | 165 | }, |
153 | "end": { | 166 | "end": { |
154 | "line": 73, | 167 | "line": 77, |
155 | "column": 3 | 168 | "column": 3 |
156 | } | 169 | } |
157 | }, | 170 | }, |
@@ -160,11 +173,11 @@ | |||
160 | "defaultMessage": "!!!Enable GPU Acceleration", | 173 | "defaultMessage": "!!!Enable GPU Acceleration", |
161 | "file": "src/containers/settings/EditSettingsScreen.js", | 174 | "file": "src/containers/settings/EditSettingsScreen.js", |
162 | "start": { | 175 | "start": { |
163 | "line": 74, | 176 | "line": 78, |
164 | "column": 25 | 177 | "column": 25 |
165 | }, | 178 | }, |
166 | "end": { | 179 | "end": { |
167 | "line": 77, | 180 | "line": 81, |
168 | "column": 3 | 181 | "column": 3 |
169 | } | 182 | } |
170 | }, | 183 | }, |
@@ -173,11 +186,11 @@ | |||
173 | "defaultMessage": "!!!Include beta versions", | 186 | "defaultMessage": "!!!Include beta versions", |
174 | "file": "src/containers/settings/EditSettingsScreen.js", | 187 | "file": "src/containers/settings/EditSettingsScreen.js", |
175 | "start": { | 188 | "start": { |
176 | "line": 78, | 189 | "line": 82, |
177 | "column": 8 | 190 | "column": 8 |
178 | }, | 191 | }, |
179 | "end": { | 192 | "end": { |
180 | "line": 81, | 193 | "line": 85, |
181 | "column": 3 | 194 | "column": 3 |
182 | } | 195 | } |
183 | }, | 196 | }, |
@@ -186,11 +199,11 @@ | |||
186 | "defaultMessage": "!!!Enable Franz Todos", | 199 | "defaultMessage": "!!!Enable Franz Todos", |
187 | "file": "src/containers/settings/EditSettingsScreen.js", | 200 | "file": "src/containers/settings/EditSettingsScreen.js", |
188 | "start": { | 201 | "start": { |
189 | "line": 82, | 202 | "line": 86, |
190 | "column": 15 | 203 | "column": 15 |
191 | }, | 204 | }, |
192 | "end": { | 205 | "end": { |
193 | "line": 85, | 206 | "line": 89, |
194 | "column": 3 | 207 | "column": 3 |
195 | } | 208 | } |
196 | } | 209 | } |
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 876851a66..3ee799b69 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -399,8 +399,17 @@ export default class ServicesStore extends Store { | |||
399 | } | 399 | } |
400 | 400 | ||
401 | if (service.isNotificationEnabled) { | 401 | if (service.isNotificationEnabled) { |
402 | const title = typeof args[0].title === 'string' ? args[0].title : service.name; | 402 | let title = 'Notification from ' + service.name; |
403 | options.body = typeof options.body === 'string' ? options.body : ''; | 403 | if (!this.stores.settings.all.app.privateNotifications) { |
404 | options.body = typeof options.body === 'string' ? options.body : ''; | ||
405 | title = typeof args[0].title === 'string' ? args[0].title : service.name; | ||
406 | } else { | ||
407 | // Remove message data from notification in private mode | ||
408 | options.body = ''; | ||
409 | options.icon = '/assets/img/notification-badge.gif'; | ||
410 | } | ||
411 | |||
412 | console.log(title, options) | ||
404 | 413 | ||
405 | this.actions.app.notify({ | 414 | this.actions.app.notify({ |
406 | notificationId: args[0].notificationId, | 415 | notificationId: args[0].notificationId, |