diff options
author | 2020-04-14 14:56:16 +0530 | |
---|---|---|
committer | 2020-04-14 10:26:16 +0100 | |
commit | 100016e38098ff389b2d6899dee76413da26f2ae (patch) | |
tree | bcb0f69ef87b4fb91905da2a58538d3e8cc828e5 /src/containers/settings | |
parent | New Crowdin translations (#495) (diff) | |
download | ferdium-app-100016e38098ff389b2d6899dee76413da26f2ae.tar.gz ferdium-app-100016e38098ff389b2d6899dee76413da26f2ae.tar.zst ferdium-app-100016e38098ff389b2d6899dee76413da26f2ae.zip |
Expose Dark Reader settings (#568)
* feat: Expose DarkReader settings to users
- In the service model, expose an object darkReaderSetting which contains brightness, contrast and sepia values.
- In EditServiceScreen, provide 3 form options for brightness, contrast and Sepia. Additionally onSubmit() form, capture the darkreader settings data onto formdata.darkReaderSettings to update in the service
- In EditServiceForm, if darkModeEnabled is checked, show 3 sliders for controlling darkreader settings
- Create a new Slider control and customize it according to the application's theme and dark theme.
- In Webview Recipe, load the darkReader settings from service settings and pass it to the darkReader library.
* feat: Darkreader settings
- Lint fixes
* feat: DarkReader settings
- refactor code in editservicescreen.js
Co-Authored-By: Sampath Kumar Krishnan <sampath3493@gmail.com>
* feat: Darkreader settings
- Fix a crash where service.darkReaderSettings is null while creating a new service
- Remove isDarkModeEnabled prop to EditServiceForm as it is no longer required.
* fix: Update EditServiceScreen
- Set the default value of darkReader Brightness, Contrast and Sepia to undefined as per @vantezzen 's suggestion.
- Updated the check provided by @mahadevans87
Co-authored-by: Sampath Kumar Krishnan <sampath3493@gmail.com>
Co-authored-by: Sampath Kumar Krishnan <sampathBlam@users.noreply.github.com>
Diffstat (limited to 'src/containers/settings')
-rw-r--r-- | src/containers/settings/EditServiceScreen.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js index a7d33a3ea..560068efc 100644 --- a/src/containers/settings/EditServiceScreen.js +++ b/src/containers/settings/EditServiceScreen.js | |||
@@ -65,6 +65,18 @@ const messages = defineMessages({ | |||
65 | id: 'settings.service.form.enableDarkMode', | 65 | id: 'settings.service.form.enableDarkMode', |
66 | defaultMessage: '!!!Enable Dark Mode', | 66 | defaultMessage: '!!!Enable Dark Mode', |
67 | }, | 67 | }, |
68 | darkReaderBrightness: { | ||
69 | id: 'settings.service.form.darkReaderBrightness', | ||
70 | defaultMessage: '!!!Darkreader Brightness', | ||
71 | }, | ||
72 | darkReaderContrast: { | ||
73 | id: 'settings.service.form.darkReaderContrast', | ||
74 | defaultMessage: '!!!Darkreader Contrast', | ||
75 | }, | ||
76 | darkReaderSepia: { | ||
77 | id: 'settings.service.form.darkReaderSepia', | ||
78 | defaultMessage: '!!!Darkreader Sepia', | ||
79 | }, | ||
68 | enableProxy: { | 80 | enableProxy: { |
69 | id: 'settings.service.form.proxy.isEnabled', | 81 | id: 'settings.service.form.proxy.isEnabled', |
70 | defaultMessage: '!!!Use Proxy', | 82 | defaultMessage: '!!!Use Proxy', |
@@ -96,6 +108,14 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex | |||
96 | const { action } = this.props.router.params; | 108 | const { action } = this.props.router.params; |
97 | const { recipes, services } = this.props.stores; | 109 | const { recipes, services } = this.props.stores; |
98 | const { createService, updateService } = this.props.actions.service; | 110 | const { createService, updateService } = this.props.actions.service; |
111 | data.darkReaderSettings = { | ||
112 | brightness: data.darkReaderBrightness, | ||
113 | contrast: data.darkReaderContrast, | ||
114 | sepia: data.darkReaderSepia, | ||
115 | }; | ||
116 | delete data.darkReaderContrast; | ||
117 | delete data.darkReaderBrightness; | ||
118 | delete data.darkReaderSepia; | ||
99 | 119 | ||
100 | const serviceData = data; | 120 | const serviceData = data; |
101 | serviceData.isMuted = !serviceData.isMuted; | 121 | serviceData.isMuted = !serviceData.isMuted; |
@@ -166,6 +186,21 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex | |||
166 | value: service.isDarkModeEnabled, | 186 | value: service.isDarkModeEnabled, |
167 | default: stores.settings.app.darkMode, | 187 | default: stores.settings.app.darkMode, |
168 | }, | 188 | }, |
189 | darkReaderBrightness: { | ||
190 | label: intl.formatMessage(messages.darkReaderBrightness), | ||
191 | value: service.darkReaderSettings ? service.darkReaderSettings.brightness : undefined, | ||
192 | default: 100, | ||
193 | }, | ||
194 | darkReaderContrast: { | ||
195 | label: intl.formatMessage(messages.darkReaderContrast), | ||
196 | value: service.darkReaderSettings ? service.darkReaderSettings.contrast : undefined, | ||
197 | default: 90, | ||
198 | }, | ||
199 | darkReaderSepia: { | ||
200 | label: intl.formatMessage(messages.darkReaderSepia), | ||
201 | value: service.darkReaderSettings ? service.darkReaderSettings.sepia : undefined, | ||
202 | default: 10, | ||
203 | }, | ||
169 | spellcheckerLanguage: { | 204 | spellcheckerLanguage: { |
170 | label: intl.formatMessage(globalMessages.spellcheckerLanguage), | 205 | label: intl.formatMessage(globalMessages.spellcheckerLanguage), |
171 | value: service.spellcheckerLanguage, | 206 | value: service.spellcheckerLanguage, |