diff options
author | 2021-09-04 08:01:01 +0530 | |
---|---|---|
committer | 2021-09-04 08:01:01 +0530 | |
commit | 7ad396d1eeaa299cabff799e9fa03848a0924bba (patch) | |
tree | ab10840277937fbccd5df44be51d8e3ed72ea66a /src/containers/settings/EditSettingsScreen.js | |
parent | 5.6.1-nightly.49 [skip ci] (diff) | |
download | ferdium-app-7ad396d1eeaa299cabff799e9fa03848a0924bba.tar.gz ferdium-app-7ad396d1eeaa299cabff799e9fa03848a0924bba.tar.zst ferdium-app-7ad396d1eeaa299cabff799e9fa03848a0924bba.zip |
chore: Ensure stored settings conform to type-safety
Diffstat (limited to 'src/containers/settings/EditSettingsScreen.js')
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index d65d8d5d5..efa34dd85 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js | |||
@@ -239,78 +239,79 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
239 | }); | 239 | }); |
240 | 240 | ||
241 | app.launchOnStartup({ | 241 | app.launchOnStartup({ |
242 | enable: settingsData.autoLaunchOnStart, | 242 | enable: Boolean(settingsData.autoLaunchOnStart), |
243 | openInBackground: settingsData.autoLaunchInBackground, | 243 | openInBackground: Boolean(settingsData.autoLaunchInBackground), |
244 | }); | 244 | }); |
245 | 245 | ||
246 | debug(`Updating settings store with data: ${settingsData}`); | 246 | debug(`Updating settings store with data: ${settingsData}`); |
247 | 247 | ||
248 | settings.update({ | 248 | settings.update({ |
249 | type: 'app', | 249 | type: 'app', |
250 | // TODO: The conversions might not be necessary once we convert to typescript | ||
250 | data: { | 251 | data: { |
251 | runInBackground: settingsData.runInBackground, | 252 | runInBackground: Boolean(settingsData.runInBackground), |
252 | enableSystemTray: settingsData.enableSystemTray, | 253 | enableSystemTray: Boolean(settingsData.enableSystemTray), |
253 | reloadAfterResume: settingsData.reloadAfterResume, | 254 | reloadAfterResume: Boolean(settingsData.reloadAfterResume), |
254 | startMinimized: settingsData.startMinimized, | 255 | startMinimized: Boolean(settingsData.startMinimized), |
255 | minimizeToSystemTray: settingsData.minimizeToSystemTray, | 256 | minimizeToSystemTray: Boolean(settingsData.minimizeToSystemTray), |
256 | closeToSystemTray: settingsData.closeToSystemTray, | 257 | closeToSystemTray: Boolean(settingsData.closeToSystemTray), |
257 | privateNotifications: settingsData.privateNotifications, | 258 | privateNotifications: Boolean(settingsData.privateNotifications), |
258 | clipboardNotifications: settingsData.clipboardNotifications, | 259 | clipboardNotifications: Boolean(settingsData.clipboardNotifications), |
259 | notifyTaskBarOnMessage: settingsData.notifyTaskBarOnMessage, | 260 | notifyTaskBarOnMessage: Boolean(settingsData.notifyTaskBarOnMessage), |
260 | navigationBarBehaviour: settingsData.navigationBarBehaviour, | 261 | navigationBarBehaviour: settingsData.navigationBarBehaviour, |
261 | searchEngine: settingsData.searchEngine, | 262 | searchEngine: settingsData.searchEngine, |
262 | sentry: settingsData.sentry, | 263 | sentry: Boolean(settingsData.sentry), |
263 | hibernateOnStartup: settingsData.hibernateOnStartup, | 264 | hibernateOnStartup: Boolean(settingsData.hibernateOnStartup), |
264 | hibernationStrategy: settingsData.hibernationStrategy, | 265 | hibernationStrategy: Number(settingsData.hibernationStrategy), |
265 | wakeUpStrategy: settingsData.wakeUpStrategy, | 266 | wakeUpStrategy: Number(settingsData.wakeUpStrategy), |
266 | predefinedTodoServer: settingsData.predefinedTodoServer, | 267 | predefinedTodoServer: settingsData.predefinedTodoServer, |
267 | customTodoServer: settingsData.customTodoServer, | 268 | customTodoServer: settingsData.customTodoServer, |
268 | lockingFeatureEnabled: settingsData.lockingFeatureEnabled, | 269 | lockingFeatureEnabled: Boolean(settingsData.lockingFeatureEnabled), |
269 | lockedPassword: hash(String(settingsData.lockedPassword)), | 270 | lockedPassword: hash(String(settingsData.lockedPassword)), |
270 | useTouchIdToUnlock: settingsData.useTouchIdToUnlock, | 271 | useTouchIdToUnlock: Boolean(settingsData.useTouchIdToUnlock), |
271 | inactivityLock: settingsData.inactivityLock, | 272 | inactivityLock: Number(settingsData.inactivityLock), |
272 | scheduledDNDEnabled: settingsData.scheduledDNDEnabled, | 273 | scheduledDNDEnabled: Boolean(settingsData.scheduledDNDEnabled), |
273 | scheduledDNDStart: settingsData.scheduledDNDStart, | 274 | scheduledDNDStart: settingsData.scheduledDNDStart, |
274 | scheduledDNDEnd: settingsData.scheduledDNDEnd, | 275 | scheduledDNDEnd: settingsData.scheduledDNDEnd, |
275 | enableGPUAcceleration: settingsData.enableGPUAcceleration, | 276 | enableGPUAcceleration: Boolean(settingsData.enableGPUAcceleration), |
276 | showDisabledServices: settingsData.showDisabledServices, | 277 | showDisabledServices: Boolean(settingsData.showDisabledServices), |
277 | darkMode: settingsData.darkMode, | 278 | darkMode: Boolean(settingsData.darkMode), |
278 | adaptableDarkMode: settingsData.adaptableDarkMode, | 279 | adaptableDarkMode: Boolean(settingsData.adaptableDarkMode), |
279 | universalDarkMode: settingsData.universalDarkMode, | 280 | universalDarkMode: Boolean(settingsData.universalDarkMode), |
280 | serviceRibbonWidth: settingsData.serviceRibbonWidth, | 281 | serviceRibbonWidth: Number(settingsData.serviceRibbonWidth), |
281 | iconSize: settingsData.iconSize, | 282 | iconSize: Number(settingsData.iconSize), |
282 | useVerticalStyle: settingsData.useVerticalStyle, | 283 | useVerticalStyle: Boolean(settingsData.useVerticalStyle), |
283 | alwaysShowWorkspaces: settingsData.alwaysShowWorkspaces, | 284 | alwaysShowWorkspaces: Boolean(settingsData.alwaysShowWorkspaces), |
284 | accentColor: settingsData.accentColor, | 285 | accentColor: settingsData.accentColor, |
285 | showMessageBadgeWhenMuted: settingsData.showMessageBadgeWhenMuted, | 286 | showMessageBadgeWhenMuted: Boolean(settingsData.showMessageBadgeWhenMuted), |
286 | showDragArea: settingsData.showDragArea, | 287 | showDragArea: Boolean(settingsData.showDragArea), |
287 | enableSpellchecking: settingsData.enableSpellchecking, | 288 | enableSpellchecking: Boolean(settingsData.enableSpellchecking), |
288 | spellcheckerLanguage: settingsData.spellcheckerLanguage, | 289 | spellcheckerLanguage: settingsData.spellcheckerLanguage, |
289 | userAgentPref: settingsData.userAgentPref, | 290 | userAgentPref: settingsData.userAgentPref, |
290 | beta: settingsData.beta, // we need this info in the main process as well | 291 | beta: Boolean(settingsData.beta), // we need this info in the main process as well |
291 | automaticUpdates: settingsData.automaticUpdates, // we need this info in the main process as well | 292 | automaticUpdates: Boolean(settingsData.automaticUpdates), // we need this info in the main process as well |
292 | locale: settingsData.locale, // we need this info in the main process as well | 293 | locale: settingsData.locale, // we need this info in the main process as well |
293 | }, | 294 | }, |
294 | }); | 295 | }); |
295 | 296 | ||
296 | user.update({ | 297 | user.update({ |
297 | userData: { | 298 | userData: { |
298 | automaticUpdates: settingsData.automaticUpdates, | 299 | automaticUpdates: Boolean(settingsData.automaticUpdates), |
299 | beta: settingsData.beta, | 300 | beta: Boolean(settingsData.beta), |
300 | locale: settingsData.locale, | 301 | locale: settingsData.locale, |
301 | }, | 302 | }, |
302 | }); | 303 | }); |
303 | 304 | ||
304 | if (workspaces.isFeatureActive) { | 305 | if (workspaces.isFeatureActive) { |
305 | const { keepAllWorkspacesLoaded } = workspaces.settings; | 306 | const { keepAllWorkspacesLoaded } = workspaces.settings; |
306 | if (keepAllWorkspacesLoaded !== settingsData.keepAllWorkspacesLoaded) { | 307 | if (Boolean(keepAllWorkspacesLoaded) !== Boolean(settingsData.keepAllWorkspacesLoaded)) { |
307 | workspaceActions.toggleKeepAllWorkspacesLoadedSetting(); | 308 | workspaceActions.toggleKeepAllWorkspacesLoadedSetting(); |
308 | } | 309 | } |
309 | } | 310 | } |
310 | 311 | ||
311 | if (todos.isFeatureActive) { | 312 | if (todos.isFeatureActive) { |
312 | const { isFeatureEnabledByUser } = todos.settings; | 313 | const { isFeatureEnabledByUser } = todos.settings; |
313 | if (isFeatureEnabledByUser !== settingsData.enableTodos) { | 314 | if (Boolean(isFeatureEnabledByUser) !== Boolean(settingsData.enableTodos)) { |
314 | todosActions.toggleTodosFeatureVisibility(); | 315 | todosActions.toggleTodosFeatureVisibility(); |
315 | } | 316 | } |
316 | } | 317 | } |