diff options
author | 2021-08-13 00:45:01 +0530 | |
---|---|---|
committer | 2021-08-13 00:45:01 +0530 | |
commit | 2d27d5e66649d4f5baf127a53ee5ae524eae3a59 (patch) | |
tree | c592ea219ac8cd987fc367f57b54034c450ab2ab /src/containers/settings/EditSettingsScreen.js | |
parent | Ferdi v5.6.0 (diff) | |
parent | 5.6.1-nightly.24 [skip ci] (diff) | |
download | ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.gz ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.tar.zst ferdium-app-2d27d5e66649d4f5baf127a53ee5ae524eae3a59.zip |
chore: merge from nightly branch into release branch in prep for next beta
Diffstat (limited to 'src/containers/settings/EditSettingsScreen.js')
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 41 |
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'; | |||
11 | import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages'; | 11 | import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages'; |
12 | import { | 12 | import { |
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'; |
16 | import { DEFAULT_APP_SETTINGS, isMac } from '../../environment'; | 16 | import { DEFAULT_APP_SETTINGS, isMac } from '../../environment'; |
17 | import { config as spellcheckerConfig } from '../../features/spellchecker'; | ||
18 | 17 | ||
19 | import { getSelectOptions } from '../../helpers/i18n-helpers'; | 18 | import { getSelectOptions } from '../../helpers/i18n-helpers'; |
20 | import { hash } from '../../helpers/password-helpers'; | 19 | import { hash } from '../../helpers/password-helpers'; |
@@ -27,6 +26,8 @@ import globalMessages from '../../i18n/globalMessages'; | |||
27 | import WorkspacesStore from '../../features/workspaces/store'; | 26 | import WorkspacesStore from '../../features/workspaces/store'; |
28 | import ServicesStore from '../../stores/ServicesStore'; | 27 | import ServicesStore from '../../stores/ServicesStore'; |
29 | 28 | ||
29 | const debug = require('debug')('Ferdi:EditSettingsScreen'); | ||
30 | |||
30 | const messages = defineMessages({ | 31 | const 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} |