aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers/settings/EditSettingsScreen.js
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2020-04-17 18:07:20 +0200
committerLibravatar vantezzen <hello@vantezzen.io>2020-04-17 18:07:20 +0200
commitd3bea9800073f864cf407bf0c42ef7c299a91852 (patch)
treec0781876d677f51293333c18cbb637dafab203c2 /src/containers/settings/EditSettingsScreen.js
parentMerge branch 'develop' (diff)
parentPrepare code (diff)
downloadferdium-app-d3bea9800073f864cf407bf0c42ef7c299a91852.tar.gz
ferdium-app-d3bea9800073f864cf407bf0c42ef7c299a91852.tar.zst
ferdium-app-d3bea9800073f864cf407bf0c42ef7c299a91852.zip
Merge branch 'develop'v5.5.0-gm
Diffstat (limited to 'src/containers/settings/EditSettingsScreen.js')
-rw-r--r--src/containers/settings/EditSettingsScreen.js80
1 files changed, 47 insertions, 33 deletions
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js
index 5221b0694..74ec1909e 100644
--- a/src/containers/settings/EditSettingsScreen.js
+++ b/src/containers/settings/EditSettingsScreen.js
@@ -11,7 +11,7 @@ import TodosStore from '../../features/todos/store';
11import Form from '../../lib/Form'; 11import Form from '../../lib/Form';
12import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages'; 12import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages';
13import { 13import {
14 DEFAULT_APP_SETTINGS, HIBERNATION_STRATEGIES, SIDEBAR_WIDTH, ICON_SIZES, NAVIGATION_BAR_BEHAVIOURS, 14 DEFAULT_APP_SETTINGS, HIBERNATION_STRATEGIES, SIDEBAR_WIDTH, ICON_SIZES, NAVIGATION_BAR_BEHAVIOURS, TODO_APPS,
15} from '../../config'; 15} from '../../config';
16import { config as spellcheckerConfig } from '../../features/spellchecker'; 16import { config as spellcheckerConfig } from '../../features/spellchecker';
17 17
@@ -20,8 +20,6 @@ import { getSelectOptions } from '../../helpers/i18n-helpers';
20import EditSettingsForm from '../../components/settings/settings/EditSettingsForm'; 20import EditSettingsForm from '../../components/settings/settings/EditSettingsForm';
21import ErrorBoundary from '../../components/util/ErrorBoundary'; 21import ErrorBoundary from '../../components/util/ErrorBoundary';
22 22
23import { API, TODOS_FRONTEND } from '../../environment';
24
25import globalMessages from '../../i18n/globalMessages'; 23import globalMessages from '../../i18n/globalMessages';
26import { DEFAULT_IS_FEATURE_ENABLED_BY_USER } from '../../features/todos'; 24import { DEFAULT_IS_FEATURE_ENABLED_BY_USER } from '../../features/todos';
27import WorkspacesStore from '../../features/workspaces/store'; 25import WorkspacesStore from '../../features/workspaces/store';
@@ -42,7 +40,7 @@ const messages = defineMessages({
42 }, 40 },
43 startMinimized: { 41 startMinimized: {
44 id: 'settings.app.form.startMinimized', 42 id: 'settings.app.form.startMinimized',
45 defaultMessage: '!!!Start minimized in tray', 43 defaultMessage: '!!!Start minimized',
46 }, 44 },
47 enableSystemTray: { 45 enableSystemTray: {
48 id: 'settings.app.form.enableSystemTray', 46 id: 'settings.app.form.enableSystemTray',
@@ -76,14 +74,14 @@ const messages = defineMessages({
76 id: 'settings.app.form.hibernationStrategy', 74 id: 'settings.app.form.hibernationStrategy',
77 defaultMessage: '!!!Hibernation strategy', 75 defaultMessage: '!!!Hibernation strategy',
78 }, 76 },
79 server: { 77 predefinedTodoServer: {
80 id: 'settings.app.form.server', 78 id: 'settings.app.form.predefinedTodoServer',
81 defaultMessage: '!!!Server',
82 },
83 todoServer: {
84 id: 'settings.app.form.todoServer',
85 defaultMessage: '!!!Todo Server', 79 defaultMessage: '!!!Todo Server',
86 }, 80 },
81 customTodoServer: {
82 id: 'settings.app.form.customTodoServer',
83 defaultMessage: '!!!Custom TodoServer',
84 },
87 enableLock: { 85 enableLock: {
88 id: 'settings.app.form.enableLock', 86 id: 'settings.app.form.enableLock',
89 defaultMessage: '!!!Enable Password Lock', 87 defaultMessage: '!!!Enable Password Lock',
@@ -122,7 +120,7 @@ const messages = defineMessages({
122 }, 120 },
123 adaptableDarkMode: { 121 adaptableDarkMode: {
124 id: 'settings.app.form.adaptableDarkMode', 122 id: 'settings.app.form.adaptableDarkMode',
125 defaultMessage: '!!!Synchronize dark mode with my Mac\'s dark mode setting', 123 defaultMessage: '!!!Synchronize dark mode with my OS\'s dark mode setting',
126 }, 124 },
127 universalDarkMode: { 125 universalDarkMode: {
128 id: 'settings.app.form.universalDarkMode', 126 id: 'settings.app.form.universalDarkMode',
@@ -148,6 +146,10 @@ const messages = defineMessages({
148 id: 'settings.app.form.showMessagesBadgesWhenMuted', 146 id: 'settings.app.form.showMessagesBadgesWhenMuted',
149 defaultMessage: '!!!Show unread message badge when notifications are disabled', 147 defaultMessage: '!!!Show unread message badge when notifications are disabled',
150 }, 148 },
149 showDragArea: {
150 id: 'settings.app.form.showDragArea',
151 defaultMessage: '!!!Show draggable area on window',
152 },
151 enableSpellchecking: { 153 enableSpellchecking: {
152 id: 'settings.app.form.enableSpellchecking', 154 id: 'settings.app.form.enableSpellchecking',
153 defaultMessage: '!!!Enable spell checking', 155 defaultMessage: '!!!Enable spell checking',
@@ -160,9 +162,9 @@ const messages = defineMessages({
160 id: 'settings.app.form.beta', 162 id: 'settings.app.form.beta',
161 defaultMessage: '!!!Include beta versions', 163 defaultMessage: '!!!Include beta versions',
162 }, 164 },
163 noUpdates: { 165 automaticUpdates: {
164 id: 'settings.app.form.noUpdates', 166 id: 'settings.app.form.automaticUpdates',
165 defaultMessage: '!!!Disable updates', 167 defaultMessage: '!!!Enable updates',
166 }, 168 },
167 enableTodos: { 169 enableTodos: {
168 id: 'settings.app.form.enableTodos', 170 id: 'settings.app.form.enableTodos',
@@ -207,8 +209,8 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
207 sentry: settingsData.sentry, 209 sentry: settingsData.sentry,
208 hibernate: settingsData.hibernate, 210 hibernate: settingsData.hibernate,
209 hibernationStrategy: settingsData.hibernationStrategy, 211 hibernationStrategy: settingsData.hibernationStrategy,
210 server: settingsData.server, 212 predefinedTodoServer: settingsData.predefinedTodoServer,
211 todoServer: settingsData.todoServer, 213 customTodoServer: settingsData.customTodoServer,
212 lockingFeatureEnabled: settingsData.lockingFeatureEnabled, 214 lockingFeatureEnabled: settingsData.lockingFeatureEnabled,
213 lockedPassword: settingsData.lockedPassword, 215 lockedPassword: settingsData.lockedPassword,
214 useTouchIdToUnlock: settingsData.useTouchIdToUnlock, 216 useTouchIdToUnlock: settingsData.useTouchIdToUnlock,
@@ -225,17 +227,18 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
225 iconSize: settingsData.iconSize, 227 iconSize: settingsData.iconSize,
226 accentColor: settingsData.accentColor, 228 accentColor: settingsData.accentColor,
227 showMessageBadgeWhenMuted: settingsData.showMessageBadgeWhenMuted, 229 showMessageBadgeWhenMuted: settingsData.showMessageBadgeWhenMuted,
230 showDragArea: settingsData.showDragArea,
228 enableSpellchecking: settingsData.enableSpellchecking, 231 enableSpellchecking: settingsData.enableSpellchecking,
229 spellcheckerLanguage: settingsData.spellcheckerLanguage, 232 spellcheckerLanguage: settingsData.spellcheckerLanguage,
230 beta: settingsData.beta, // we need this info in the main process as well 233 beta: settingsData.beta, // we need this info in the main process as well
231 noUpdates: settingsData.noUpdates, // we need this info in the main process as well 234 automaticUpdates: settingsData.automaticUpdates, // we need this info in the main process as well
232 locale: settingsData.locale, // we need this info in the main process as well 235 locale: settingsData.locale, // we need this info in the main process as well
233 }, 236 },
234 }); 237 });
235 238
236 user.update({ 239 user.update({
237 userData: { 240 userData: {
238 noUpdates: settingsData.noUpdates, 241 automaticUpdates: settingsData.automaticUpdates,
239 beta: settingsData.beta, 242 beta: settingsData.beta,
240 locale: settingsData.locale, 243 locale: settingsData.locale,
241 }, 244 },
@@ -280,6 +283,11 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
280 sort: false, 283 sort: false,
281 }); 284 });
282 285
286 const todoApp = getSelectOptions({
287 locales: TODO_APPS,
288 sort: false,
289 });
290
283 const sidebarWidth = getSelectOptions({ 291 const sidebarWidth = getSelectOptions({
284 locales: SIDEBAR_WIDTH, 292 locales: SIDEBAR_WIDTH,
285 sort: false, 293 sort: false,
@@ -359,15 +367,16 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
359 options: hibernationStrategies, 367 options: hibernationStrategies,
360 default: DEFAULT_APP_SETTINGS.hibernationStrategy, 368 default: DEFAULT_APP_SETTINGS.hibernationStrategy,
361 }, 369 },
362 server: { 370 predefinedTodoServer: {
363 label: intl.formatMessage(messages.server), 371 label: intl.formatMessage(messages.predefinedTodoServer),
364 value: settings.all.app.server || API, 372 value: settings.all.app.predefinedTodoServer,
365 default: API, 373 default: DEFAULT_APP_SETTINGS.predefinedTodoServer,
374 options: todoApp,
366 }, 375 },
367 todoServer: { 376 customTodoServer: {
368 label: intl.formatMessage(messages.todoServer), 377 label: intl.formatMessage(messages.customTodoServer),
369 value: settings.all.app.todoServer, 378 value: settings.all.app.customTodoServer,
370 default: TODOS_FRONTEND, 379 default: DEFAULT_APP_SETTINGS.customTodoServer,
371 }, 380 },
372 lockingFeatureEnabled: { 381 lockingFeatureEnabled: {
373 label: intl.formatMessage(messages.enableLock), 382 label: intl.formatMessage(messages.enableLock),
@@ -418,6 +427,11 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
418 value: settings.all.app.showMessageBadgeWhenMuted, 427 value: settings.all.app.showMessageBadgeWhenMuted,
419 default: DEFAULT_APP_SETTINGS.showMessageBadgeWhenMuted, 428 default: DEFAULT_APP_SETTINGS.showMessageBadgeWhenMuted,
420 }, 429 },
430 showDragArea: {
431 label: intl.formatMessage(messages.showDragArea),
432 value: settings.all.app.showDragArea,
433 default: DEFAULT_APP_SETTINGS.showDragArea,
434 },
421 enableSpellchecking: { 435 enableSpellchecking: {
422 label: intl.formatMessage(messages.enableSpellchecking), 436 label: intl.formatMessage(messages.enableSpellchecking),
423 value: !this.props.stores.user.data.isPremium && !spellcheckerConfig.isIncludedInCurrentPlan ? false : settings.all.app.enableSpellchecking, 437 value: !this.props.stores.user.data.isPremium && !spellcheckerConfig.isIncludedInCurrentPlan ? false : settings.all.app.enableSpellchecking,
@@ -477,10 +491,10 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
477 value: user.data.beta, 491 value: user.data.beta,
478 default: DEFAULT_APP_SETTINGS.beta, 492 default: DEFAULT_APP_SETTINGS.beta,
479 }, 493 },
480 noUpdates: { 494 automaticUpdates: {
481 label: intl.formatMessage(messages.noUpdates), 495 label: intl.formatMessage(messages.automaticUpdates),
482 value: settings.app.noUpdates, 496 value: settings.app.automaticUpdates,
483 default: DEFAULT_APP_SETTINGS.noUpdates, 497 default: DEFAULT_APP_SETTINGS.automaticUpdates,
484 }, 498 },
485 }, 499 },
486 }; 500 };
@@ -541,13 +555,13 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
541 isSpellcheckerIncludedInCurrentPlan={spellcheckerConfig.isIncludedInCurrentPlan} 555 isSpellcheckerIncludedInCurrentPlan={spellcheckerConfig.isIncludedInCurrentPlan}
542 isTodosEnabled={todos.isFeatureActive} 556 isTodosEnabled={todos.isFeatureActive}
543 isWorkspaceEnabled={workspaces.isFeatureActive} 557 isWorkspaceEnabled={workspaces.isFeatureActive}
544 server={this.props.stores.settings.app.server}
545 lockingFeatureEnabled={lockingFeatureEnabled} 558 lockingFeatureEnabled={lockingFeatureEnabled}
546 noUpdates={this.props.stores.settings.app.noUpdates} 559 automaticUpdates={this.props.stores.settings.app.automaticUpdates}
547 hibernationEnabled={this.props.stores.settings.app.hibernate} 560 hibernationEnabled={this.props.stores.settings.app.hibernate}
548 isDarkmodeEnabled={this.props.stores.settings.app.darkMode} 561 isDarkmodeEnabled={this.props.stores.settings.app.darkMode}
549 isTrayEnabled={this.props.stores.settings.app.enableSystemTray}
550 isAdaptableDarkModeEnabled={this.props.stores.settings.app.adaptableDarkMode} 562 isAdaptableDarkModeEnabled={this.props.stores.settings.app.adaptableDarkMode}
563 isTodosActivated={this.props.stores.todos.isFeatureEnabledByUser}
564 isUsingCustomTodoService={this.props.stores.todos.isUsingCustomTodoService}
551 openProcessManager={() => this.openProcessManager()} 565 openProcessManager={() => this.openProcessManager()}
552 /> 566 />
553 </ErrorBoundary> 567 </ErrorBoundary>