diff options
Diffstat (limited to 'src/stores/SettingsStore.js')
-rw-r--r-- | src/stores/SettingsStore.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index 051e86be2..8a5ee7204 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -79,6 +79,26 @@ export default class SettingsStore extends Store { | |||
79 | }, | 79 | }, |
80 | ); | 80 | ); |
81 | 81 | ||
82 | // Inactivity lock timer | ||
83 | let inactivityTimer; | ||
84 | remote.getCurrentWindow().on('blur', () => { | ||
85 | if (this.all.app.inactivityLock !== 0) { | ||
86 | inactivityTimer = setTimeout(() => { | ||
87 | this.actions.settings.update({ | ||
88 | type: 'app', | ||
89 | data: { | ||
90 | locked: true, | ||
91 | }, | ||
92 | }); | ||
93 | }, this.all.app.inactivityLock * 1000 * 60); | ||
94 | } | ||
95 | }); | ||
96 | remote.getCurrentWindow().on('focus', () => { | ||
97 | if (inactivityTimer) { | ||
98 | clearTimeout(inactivityTimer); | ||
99 | } | ||
100 | }); | ||
101 | |||
82 | // Make sure to lock app on launch if locking feature is enabled | 102 | // Make sure to lock app on launch if locking feature is enabled |
83 | setTimeout(() => { | 103 | setTimeout(() => { |
84 | const isLoggedIn = Boolean(localStorage.getItem('authToken')); | 104 | const isLoggedIn = Boolean(localStorage.getItem('authToken')); |