diff options
Diffstat (limited to 'src/containers/settings/EditSettingsScreen.js')
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index 018ce663f..ea1d319d9 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js | |||
@@ -7,9 +7,10 @@ import AppStore from '../../stores/AppStore'; | |||
7 | import SettingsStore from '../../stores/SettingsStore'; | 7 | import SettingsStore from '../../stores/SettingsStore'; |
8 | import UserStore from '../../stores/UserStore'; | 8 | import UserStore from '../../stores/UserStore'; |
9 | import Form from '../../lib/Form'; | 9 | import Form from '../../lib/Form'; |
10 | import { APP_LOCALES } from '../../i18n/languages'; | 10 | import { APP_LOCALES, SPELLCHECKER_LOCALES } from '../../i18n/languages'; |
11 | import { gaPage } from '../../lib/analytics'; | 11 | import { gaPage } from '../../lib/analytics'; |
12 | import { DEFAULT_APP_SETTINGS } from '../../config'; | 12 | import { DEFAULT_APP_SETTINGS } from '../../config'; |
13 | import { config as spellcheckerConfig } from '../../features/spellchecker'; | ||
13 | 14 | ||
14 | 15 | ||
15 | import EditSettingsForm from '../../components/settings/settings/EditSettingsForm'; | 16 | import EditSettingsForm from '../../components/settings/settings/EditSettingsForm'; |
@@ -39,6 +40,10 @@ const messages = defineMessages({ | |||
39 | id: 'settings.app.form.language', | 40 | id: 'settings.app.form.language', |
40 | defaultMessage: '!!!Language', | 41 | defaultMessage: '!!!Language', |
41 | }, | 42 | }, |
43 | darkMode: { | ||
44 | id: 'settings.app.form.darkMode', | ||
45 | defaultMessage: '!!!Dark Mode', | ||
46 | }, | ||
42 | showDisabledServices: { | 47 | showDisabledServices: { |
43 | id: 'settings.app.form.showDisabledServices', | 48 | id: 'settings.app.form.showDisabledServices', |
44 | defaultMessage: '!!!Display disabled services tabs', | 49 | defaultMessage: '!!!Display disabled services tabs', |
@@ -55,8 +60,8 @@ const messages = defineMessages({ | |||
55 | id: 'settings.app.form.enableGPUAcceleration', | 60 | id: 'settings.app.form.enableGPUAcceleration', |
56 | defaultMessage: '!!!Enable GPU Acceleration', | 61 | defaultMessage: '!!!Enable GPU Acceleration', |
57 | }, | 62 | }, |
58 | spellcheckingLanguage: { | 63 | spellcheckerLanguage: { |
59 | id: 'settings.app.form.spellcheckingLanguage', | 64 | id: 'settings.app.form.spellcheckerLanguage', |
60 | defaultMessage: '!!!Language for spell checking', | 65 | defaultMessage: '!!!Language for spell checking', |
61 | }, | 66 | }, |
62 | beta: { | 67 | beta: { |
@@ -65,8 +70,7 @@ const messages = defineMessages({ | |||
65 | }, | 70 | }, |
66 | }); | 71 | }); |
67 | 72 | ||
68 | @inject('stores', 'actions') @observer | 73 | export default @inject('stores', 'actions') @observer class EditSettingsScreen extends Component { |
69 | export default class EditSettingsScreen extends Component { | ||
70 | static contextTypes = { | 74 | static contextTypes = { |
71 | intl: intlShape, | 75 | intl: intlShape, |
72 | }; | 76 | }; |
@@ -91,8 +95,10 @@ export default class EditSettingsScreen extends Component { | |||
91 | minimizeToSystemTray: settingsData.minimizeToSystemTray, | 95 | minimizeToSystemTray: settingsData.minimizeToSystemTray, |
92 | enableGPUAcceleration: settingsData.enableGPUAcceleration, | 96 | enableGPUAcceleration: settingsData.enableGPUAcceleration, |
93 | showDisabledServices: settingsData.showDisabledServices, | 97 | showDisabledServices: settingsData.showDisabledServices, |
98 | darkMode: settingsData.darkMode, | ||
94 | showMessageBadgeWhenMuted: settingsData.showMessageBadgeWhenMuted, | 99 | showMessageBadgeWhenMuted: settingsData.showMessageBadgeWhenMuted, |
95 | enableSpellchecking: settingsData.enableSpellchecking, | 100 | enableSpellchecking: settingsData.enableSpellchecking, |
101 | spellcheckerLanguage: settingsData.spellcheckerLanguage, | ||
96 | beta: settingsData.beta, // we need this info in the main process as well | 102 | beta: settingsData.beta, // we need this info in the main process as well |
97 | locale: settingsData.locale, // we need this info in the main process as well | 103 | locale: settingsData.locale, // we need this info in the main process as well |
98 | }, | 104 | }, |
@@ -118,6 +124,14 @@ export default class EditSettingsScreen extends Component { | |||
118 | }); | 124 | }); |
119 | }); | 125 | }); |
120 | 126 | ||
127 | const spellcheckingLanguages = []; | ||
128 | Object.keys(SPELLCHECKER_LOCALES).sort(Intl.Collator().compare).forEach((key) => { | ||
129 | spellcheckingLanguages.push({ | ||
130 | value: key, | ||
131 | label: SPELLCHECKER_LOCALES[key], | ||
132 | }); | ||
133 | }); | ||
134 | |||
121 | const config = { | 135 | const config = { |
122 | fields: { | 136 | fields: { |
123 | autoLaunchOnStart: { | 137 | autoLaunchOnStart: { |
@@ -157,8 +171,19 @@ export default class EditSettingsScreen extends Component { | |||
157 | }, | 171 | }, |
158 | enableSpellchecking: { | 172 | enableSpellchecking: { |
159 | label: intl.formatMessage(messages.enableSpellchecking), | 173 | label: intl.formatMessage(messages.enableSpellchecking), |
160 | value: settings.all.app.enableSpellchecking, | 174 | value: !this.props.stores.user.data.isPremium && spellcheckerConfig.isPremiumFeature ? false : settings.all.app.enableSpellchecking, |
161 | default: DEFAULT_APP_SETTINGS.enableSpellchecking, | 175 | default: !this.props.stores.user.data.isPremium && spellcheckerConfig.isPremiumFeature ? false : DEFAULT_APP_SETTINGS.enableSpellchecking, |
176 | }, | ||
177 | spellcheckerLanguage: { | ||
178 | label: intl.formatMessage(messages.spellcheckerLanguage), | ||
179 | value: settings.all.app.spellcheckerLanguage, | ||
180 | options: spellcheckingLanguages, | ||
181 | default: DEFAULT_APP_SETTINGS.spellcheckerLanguage, | ||
182 | }, | ||
183 | darkMode: { | ||
184 | label: intl.formatMessage(messages.darkMode), | ||
185 | value: settings.all.app.darkMode, | ||
186 | default: DEFAULT_APP_SETTINGS.darkMode, | ||
162 | }, | 187 | }, |
163 | enableGPUAcceleration: { | 188 | enableGPUAcceleration: { |
164 | label: intl.formatMessage(messages.enableGPUAcceleration), | 189 | label: intl.formatMessage(messages.enableGPUAcceleration), |
@@ -209,6 +234,7 @@ export default class EditSettingsScreen extends Component { | |||
209 | cacheSize={cacheSize} | 234 | cacheSize={cacheSize} |
210 | isClearingAllCache={isClearingAllCache} | 235 | isClearingAllCache={isClearingAllCache} |
211 | onClearAllCache={clearAllCache} | 236 | onClearAllCache={clearAllCache} |
237 | isSpellcheckerPremiumFeature={spellcheckerConfig.isPremiumFeature} | ||
212 | /> | 238 | /> |
213 | ); | 239 | ); |
214 | } | 240 | } |