aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers/settings/EditSettingsScreen.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/containers/settings/EditSettingsScreen.js')
-rw-r--r--src/containers/settings/EditSettingsScreen.js41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js
index d601e03d4..0d718489a 100644
--- a/src/containers/settings/EditSettingsScreen.js
+++ b/src/containers/settings/EditSettingsScreen.js
@@ -11,10 +11,9 @@ import Form from '../../lib/Form';
11import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages'; 11import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages';
12import { 12import {
13 HIBERNATION_STRATEGIES, SIDEBAR_WIDTH, ICON_SIZES, NAVIGATION_BAR_BEHAVIOURS, SEARCH_ENGINE_NAMES, TODO_APPS, 13 HIBERNATION_STRATEGIES, SIDEBAR_WIDTH, ICON_SIZES, NAVIGATION_BAR_BEHAVIOURS, SEARCH_ENGINE_NAMES, TODO_APPS,
14 DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED, DEFAULT_IS_FEATURE_ENABLED_BY_USER, 14 DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED, DEFAULT_IS_FEATURE_ENABLED_BY_USER, WAKE_UP_STRATEGIES,
15} from '../../config'; 15} from '../../config';
16import { DEFAULT_APP_SETTINGS, isMac } from '../../environment'; 16import { DEFAULT_APP_SETTINGS, isMac } from '../../environment';
17import { config as spellcheckerConfig } from '../../features/spellchecker';
18 17
19import { getSelectOptions } from '../../helpers/i18n-helpers'; 18import { getSelectOptions } from '../../helpers/i18n-helpers';
20import { hash } from '../../helpers/password-helpers'; 19import { hash } from '../../helpers/password-helpers';
@@ -27,6 +26,8 @@ import globalMessages from '../../i18n/globalMessages';
27import WorkspacesStore from '../../features/workspaces/store'; 26import WorkspacesStore from '../../features/workspaces/store';
28import ServicesStore from '../../stores/ServicesStore'; 27import ServicesStore from '../../stores/ServicesStore';
29 28
29const debug = require('debug')('Ferdi:EditSettingsScreen');
30
30const messages = defineMessages({ 31const messages = defineMessages({
31 autoLaunchOnStart: { 32 autoLaunchOnStart: {
32 id: 'settings.app.form.autoLaunchOnStart', 33 id: 'settings.app.form.autoLaunchOnStart',
@@ -88,10 +89,6 @@ const messages = defineMessages({
88 id: 'settings.app.form.sentry', 89 id: 'settings.app.form.sentry',
89 defaultMessage: '!!!Send telemetry data', 90 defaultMessage: '!!!Send telemetry data',
90 }, 91 },
91 hibernate: {
92 id: 'settings.app.form.hibernate',
93 defaultMessage: '!!!Enable service hibernation',
94 },
95 hibernateOnStartup: { 92 hibernateOnStartup: {
96 id: 'settings.app.form.hibernateOnStartup', 93 id: 'settings.app.form.hibernateOnStartup',
97 defaultMessage: '!!!Keep services in hibernation on startup', 94 defaultMessage: '!!!Keep services in hibernation on startup',
@@ -100,6 +97,10 @@ const messages = defineMessages({
100 id: 'settings.app.form.hibernationStrategy', 97 id: 'settings.app.form.hibernationStrategy',
101 defaultMessage: '!!!Hibernation strategy', 98 defaultMessage: '!!!Hibernation strategy',
102 }, 99 },
100 wakeUpStrategy: {
101 id: 'settings.app.form.wakeUpStrategy',
102 defaultMessage: '!!!Wake up strategy',
103 },
103 predefinedTodoServer: { 104 predefinedTodoServer: {
104 id: 'settings.app.form.predefinedTodoServer', 105 id: 'settings.app.form.predefinedTodoServer',
105 defaultMessage: '!!!Todo Server', 106 defaultMessage: '!!!Todo Server',
@@ -242,6 +243,8 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
242 openInBackground: settingsData.autoLaunchInBackground, 243 openInBackground: settingsData.autoLaunchInBackground,
243 }); 244 });
244 245
246 debug(`Updating settings store with data: ${settingsData}`);
247
245 settings.update({ 248 settings.update({
246 type: 'app', 249 type: 'app',
247 data: { 250 data: {
@@ -257,9 +260,9 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
257 navigationBarBehaviour: settingsData.navigationBarBehaviour, 260 navigationBarBehaviour: settingsData.navigationBarBehaviour,
258 searchEngine: settingsData.searchEngine, 261 searchEngine: settingsData.searchEngine,
259 sentry: settingsData.sentry, 262 sentry: settingsData.sentry,
260 hibernate: settingsData.hibernate,
261 hibernateOnStartup: settingsData.hibernateOnStartup, 263 hibernateOnStartup: settingsData.hibernateOnStartup,
262 hibernationStrategy: settingsData.hibernationStrategy, 264 hibernationStrategy: settingsData.hibernationStrategy,
265 wakeUpStrategy: settingsData.wakeUpStrategy,
263 predefinedTodoServer: settingsData.predefinedTodoServer, 266 predefinedTodoServer: settingsData.predefinedTodoServer,
264 customTodoServer: settingsData.customTodoServer, 267 customTodoServer: settingsData.customTodoServer,
265 lockingFeatureEnabled: settingsData.lockingFeatureEnabled, 268 lockingFeatureEnabled: settingsData.lockingFeatureEnabled,
@@ -339,6 +342,11 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
339 sort: false, 342 sort: false,
340 }); 343 });
341 344
345 const wakeUpStrategies = getSelectOptions({
346 locales: WAKE_UP_STRATEGIES,
347 sort: false,
348 });
349
342 const todoApp = getSelectOptions({ 350 const todoApp = getSelectOptions({
343 locales: TODO_APPS, 351 locales: TODO_APPS,
344 sort: false, 352 sort: false,
@@ -433,11 +441,6 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
433 value: settings.all.app.sentry, 441 value: settings.all.app.sentry,
434 default: DEFAULT_APP_SETTINGS.sentry, 442 default: DEFAULT_APP_SETTINGS.sentry,
435 }, 443 },
436 hibernate: {
437 label: intl.formatMessage(messages.hibernate),
438 value: settings.all.app.hibernate,
439 default: DEFAULT_APP_SETTINGS.hibernate,
440 },
441 hibernateOnStartup: { 444 hibernateOnStartup: {
442 label: intl.formatMessage(messages.hibernateOnStartup), 445 label: intl.formatMessage(messages.hibernateOnStartup),
443 value: settings.all.app.hibernateOnStartup, 446 value: settings.all.app.hibernateOnStartup,
@@ -449,6 +452,12 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
449 options: hibernationStrategies, 452 options: hibernationStrategies,
450 default: DEFAULT_APP_SETTINGS.hibernationStrategy, 453 default: DEFAULT_APP_SETTINGS.hibernationStrategy,
451 }, 454 },
455 wakeUpStrategy: {
456 label: intl.formatMessage(messages.wakeUpStrategy),
457 value: settings.all.app.wakeUpStrategy,
458 options: wakeUpStrategies,
459 default: DEFAULT_APP_SETTINGS.wakeUpStrategy,
460 },
452 predefinedTodoServer: { 461 predefinedTodoServer: {
453 label: intl.formatMessage(messages.predefinedTodoServer), 462 label: intl.formatMessage(messages.predefinedTodoServer),
454 value: settings.all.app.predefinedTodoServer, 463 value: settings.all.app.predefinedTodoServer,
@@ -516,8 +525,8 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
516 }, 525 },
517 enableSpellchecking: { 526 enableSpellchecking: {
518 label: intl.formatMessage(messages.enableSpellchecking), 527 label: intl.formatMessage(messages.enableSpellchecking),
519 value: !this.props.stores.user.data.isPremium && !spellcheckerConfig.isIncludedInCurrentPlan ? false : settings.all.app.enableSpellchecking, 528 value: settings.all.app.enableSpellchecking,
520 default: !this.props.stores.user.data.isPremium && !spellcheckerConfig.isIncludedInCurrentPlan ? false : DEFAULT_APP_SETTINGS.enableSpellchecking, 529 default: DEFAULT_APP_SETTINGS.enableSpellchecking,
521 }, 530 },
522 spellcheckerLanguage: { 531 spellcheckerLanguage: {
523 label: intl.formatMessage(globalMessages.spellcheckerLanguage), 532 label: intl.formatMessage(globalMessages.spellcheckerLanguage),
@@ -646,16 +655,14 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
646 isUpdateAvailable={updateStatus === updateStatusTypes.AVAILABLE} 655 isUpdateAvailable={updateStatus === updateStatusTypes.AVAILABLE}
647 noUpdateAvailable={updateStatus === updateStatusTypes.NOT_AVAILABLE} 656 noUpdateAvailable={updateStatus === updateStatusTypes.NOT_AVAILABLE}
648 updateIsReadyToInstall={updateStatus === updateStatusTypes.DOWNLOADED} 657 updateIsReadyToInstall={updateStatus === updateStatusTypes.DOWNLOADED}
649 onSubmit={d => this.onSubmit(d)} 658 onSubmit={(d) => this.onSubmit(d)}
650 getCacheSize={() => app.cacheSize} 659 getCacheSize={() => app.cacheSize}
651 isClearingAllCache={isClearingAllCache} 660 isClearingAllCache={isClearingAllCache}
652 onClearAllCache={clearAllCache} 661 onClearAllCache={clearAllCache}
653 isSpellcheckerIncludedInCurrentPlan={spellcheckerConfig.isIncludedInCurrentPlan}
654 isTodosEnabled={todos.isFeatureActive} 662 isTodosEnabled={todos.isFeatureActive}
655 isWorkspaceEnabled={workspaces.isFeatureActive} 663 isWorkspaceEnabled={workspaces.isFeatureActive}
656 lockingFeatureEnabled={lockingFeatureEnabled} 664 lockingFeatureEnabled={lockingFeatureEnabled}
657 automaticUpdates={this.props.stores.settings.app.automaticUpdates} 665 automaticUpdates={this.props.stores.settings.app.automaticUpdates}
658 hibernationEnabled={this.props.stores.settings.app.hibernate}
659 isDarkmodeEnabled={this.props.stores.settings.app.darkMode} 666 isDarkmodeEnabled={this.props.stores.settings.app.darkMode}
660 isAdaptableDarkModeEnabled={this.props.stores.settings.app.adaptableDarkMode} 667 isAdaptableDarkModeEnabled={this.props.stores.settings.app.adaptableDarkMode}
661 isTodosActivated={this.props.stores.todos.isFeatureEnabledByUser} 668 isTodosActivated={this.props.stores.todos.isFeatureEnabledByUser}