diff options
author | 2022-06-21 15:45:07 +0100 | |
---|---|---|
committer | 2022-06-21 15:45:07 +0100 | |
commit | f81687b03a87a88988d4cce8110d015b046a7436 (patch) | |
tree | dcb4f5012979e0184b1c40e6095ca13a56a3eecc /src | |
parent | Turn off the progressbar by default (diff) | |
download | ferdium-app-f81687b03a87a88988d4cce8110d015b046a7436.tar.gz ferdium-app-f81687b03a87a88988d4cce8110d015b046a7436.tar.zst ferdium-app-f81687b03a87a88988d4cce8110d015b046a7436.zip |
Fix reload after resume and add idle time setting (#324)
* Fix reload after resume issue
* Add idle time option
Diffstat (limited to 'src')
-rw-r--r-- | src/components/settings/settings/EditSettingsForm.js | 7 | ||||
-rw-r--r-- | src/config.ts | 1 | ||||
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 10 | ||||
-rw-r--r-- | src/i18n/locales/en-US.json | 1 | ||||
-rw-r--r-- | src/stores/AppStore.js | 6 |
5 files changed, 22 insertions, 3 deletions
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js index 96ae5a5ed..309be1315 100644 --- a/src/components/settings/settings/EditSettingsForm.js +++ b/src/components/settings/settings/EditSettingsForm.js | |||
@@ -308,7 +308,7 @@ class EditSettingsForm extends Component { | |||
308 | updateButtonLabelMessage = messages.buttonSearchForUpdate; | 308 | updateButtonLabelMessage = messages.buttonSearchForUpdate; |
309 | } | 309 | } |
310 | 310 | ||
311 | const { lockingFeatureEnabled, scheduledDNDEnabled } = | 311 | const { lockingFeatureEnabled, scheduledDNDEnabled, reloadAfterResume } = |
312 | window['ferdium'].stores.settings.all.app; | 312 | window['ferdium'].stores.settings.all.app; |
313 | 313 | ||
314 | let cacheSize; | 314 | let cacheSize; |
@@ -439,6 +439,11 @@ class EditSettingsForm extends Component { | |||
439 | <Toggle field={form.$('confirmOnQuit')} /> | 439 | <Toggle field={form.$('confirmOnQuit')} /> |
440 | <Toggle field={form.$('enableSystemTray')} /> | 440 | <Toggle field={form.$('enableSystemTray')} /> |
441 | <Toggle field={form.$('reloadAfterResume')} /> | 441 | <Toggle field={form.$('reloadAfterResume')} /> |
442 | {reloadAfterResume && ( | ||
443 | <div> | ||
444 | <Input field={form.$('reloadAfterResumeTime')} /> | ||
445 | </div> | ||
446 | )} | ||
442 | <Toggle field={form.$('startMinimized')} /> | 447 | <Toggle field={form.$('startMinimized')} /> |
443 | {isWindows && <Toggle field={form.$('minimizeToSystemTray')} />} | 448 | {isWindows && <Toggle field={form.$('minimizeToSystemTray')} />} |
444 | {isWindows && <Toggle field={form.$('closeToSystemTray')} />} | 449 | {isWindows && <Toggle field={form.$('closeToSystemTray')} />} |
diff --git a/src/config.ts b/src/config.ts index a00b5c142..62b4f4e68 100644 --- a/src/config.ts +++ b/src/config.ts | |||
@@ -207,6 +207,7 @@ export const DEFAULT_APP_SETTINGS = { | |||
207 | autoLaunchInBackground: false, | 207 | autoLaunchInBackground: false, |
208 | runInBackground: true, | 208 | runInBackground: true, |
209 | reloadAfterResume: true, | 209 | reloadAfterResume: true, |
210 | reloadAfterResumeTime: 10, | ||
210 | enableSystemTray: true, | 211 | enableSystemTray: true, |
211 | startMinimized: false, | 212 | startMinimized: false, |
212 | confirmOnQuit: false, | 213 | confirmOnQuit: false, |
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index bae19d3b6..898a2f482 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js | |||
@@ -74,6 +74,10 @@ const messages = defineMessages({ | |||
74 | id: 'settings.app.form.reloadAfterResume', | 74 | id: 'settings.app.form.reloadAfterResume', |
75 | defaultMessage: 'Reload Ferdium after system resume', | 75 | defaultMessage: 'Reload Ferdium after system resume', |
76 | }, | 76 | }, |
77 | reloadAfterResumeTime: { | ||
78 | id: 'settings.app.form.reloadAfterResumeTime', | ||
79 | defaultMessage: 'Time to consider the system as idle/suspended (in minutes)', | ||
80 | }, | ||
77 | minimizeToSystemTray: { | 81 | minimizeToSystemTray: { |
78 | id: 'settings.app.form.minimizeToSystemTray', | 82 | id: 'settings.app.form.minimizeToSystemTray', |
79 | defaultMessage: 'Minimize Ferdium to system tray', | 83 | defaultMessage: 'Minimize Ferdium to system tray', |
@@ -323,6 +327,7 @@ class EditSettingsScreen extends Component { | |||
323 | runInBackground: Boolean(settingsData.runInBackground), | 327 | runInBackground: Boolean(settingsData.runInBackground), |
324 | enableSystemTray: Boolean(settingsData.enableSystemTray), | 328 | enableSystemTray: Boolean(settingsData.enableSystemTray), |
325 | reloadAfterResume: Boolean(settingsData.reloadAfterResume), | 329 | reloadAfterResume: Boolean(settingsData.reloadAfterResume), |
330 | reloadAfterResumeTime: Number(settingsData.reloadAfterResumeTime), | ||
326 | startMinimized: Boolean(settingsData.startMinimized), | 331 | startMinimized: Boolean(settingsData.startMinimized), |
327 | confirmOnQuit: Boolean(settingsData.confirmOnQuit), | 332 | confirmOnQuit: Boolean(settingsData.confirmOnQuit), |
328 | minimizeToSystemTray: Boolean(settingsData.minimizeToSystemTray), | 333 | minimizeToSystemTray: Boolean(settingsData.minimizeToSystemTray), |
@@ -516,6 +521,11 @@ class EditSettingsScreen extends Component { | |||
516 | value: settings.all.app.reloadAfterResume, | 521 | value: settings.all.app.reloadAfterResume, |
517 | default: DEFAULT_APP_SETTINGS.reloadAfterResume, | 522 | default: DEFAULT_APP_SETTINGS.reloadAfterResume, |
518 | }, | 523 | }, |
524 | reloadAfterResumeTime: { | ||
525 | label: intl.formatMessage(messages.reloadAfterResumeTime), | ||
526 | value: settings.all.app.reloadAfterResumeTime, | ||
527 | default: DEFAULT_APP_SETTINGS.reloadAfterResumeTime, | ||
528 | }, | ||
519 | minimizeToSystemTray: { | 529 | minimizeToSystemTray: { |
520 | label: intl.formatMessage(messages.minimizeToSystemTray), | 530 | label: intl.formatMessage(messages.minimizeToSystemTray), |
521 | value: settings.all.app.minimizeToSystemTray, | 531 | value: settings.all.app.minimizeToSystemTray, |
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 84dec5515..be6d68f3a 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json | |||
@@ -233,6 +233,7 @@ | |||
233 | "settings.app.form.privateNotifications": "Don't show message content in notifications", | 233 | "settings.app.form.privateNotifications": "Don't show message content in notifications", |
234 | "settings.app.form.progressbarAccentColor": "Progressbar Accent color", | 234 | "settings.app.form.progressbarAccentColor": "Progressbar Accent color", |
235 | "settings.app.form.reloadAfterResume": "Reload Ferdium after system resume", | 235 | "settings.app.form.reloadAfterResume": "Reload Ferdium after system resume", |
236 | "settings.app.form.reloadAfterResumeTime": "Time to consider the system as idle/suspended (in minutes)", | ||
236 | "settings.app.form.runInBackground": "Keep Ferdium in background when closing the window", | 237 | "settings.app.form.runInBackground": "Keep Ferdium in background when closing the window", |
237 | "settings.app.form.scheduledDNDEnabled": "Enable scheduled Do-not-Disturb", | 238 | "settings.app.form.scheduledDNDEnabled": "Enable scheduled Do-not-Disturb", |
238 | "settings.app.form.scheduledDNDEnd": "To", | 239 | "settings.app.form.scheduledDNDEnd": "To", |
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index 2d85b9ffe..a8e1ce247 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -232,9 +232,11 @@ export default class AppStore extends Store { | |||
232 | debug('System resumed, last suspended on', this.timeSuspensionStart); | 232 | debug('System resumed, last suspended on', this.timeSuspensionStart); |
233 | this.actions.service.resetLastPollTimer(); | 233 | this.actions.service.resetLastPollTimer(); |
234 | 234 | ||
235 | const idleTime = this.stores.settings.app.reloadAfterResumeTime; | ||
236 | |||
235 | if ( | 237 | if ( |
236 | this.timeSuspensionStart.add(10, 'm').isBefore(moment()) && | 238 | this.timeSuspensionStart.add(idleTime, 'm').isBefore(moment()) && |
237 | this.stores.settings.app.get('reloadAfterResume') | 239 | this.stores.settings.app.reloadAfterResume |
238 | ) { | 240 | ) { |
239 | debug('Reloading services, user info and features'); | 241 | debug('Reloading services, user info and features'); |
240 | 242 | ||