aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/SettingsStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores/SettingsStore.js')
-rw-r--r--src/stores/SettingsStore.js24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js
index df0fc77e9..8a5ee7204 100644
--- a/src/stores/SettingsStore.js
+++ b/src/stores/SettingsStore.js
@@ -68,7 +68,6 @@ export default class SettingsStore extends Store {
68 () => this.all.app.locked, 68 () => this.all.app.locked,
69 () => { 69 () => {
70 const { router } = window.ferdi.stores; 70 const { router } = window.ferdi.stores;
71
72 if (this.all.app.locked && this.all.app.lockingFeatureEnabled) { 71 if (this.all.app.locked && this.all.app.lockingFeatureEnabled) {
73 // App just got locked, redirect to unlock screen 72 // App just got locked, redirect to unlock screen
74 router.push('/auth/locked'); 73 router.push('/auth/locked');
@@ -80,9 +79,30 @@ export default class SettingsStore extends Store {
80 }, 79 },
81 ); 80 );
82 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
83 // 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
84 setTimeout(() => { 103 setTimeout(() => {
85 if (this.all.app.lockingFeatureEnabled) { 104 const isLoggedIn = Boolean(localStorage.getItem('authToken'));
105 if (isLoggedIn && this.all.app.lockingFeatureEnabled) {
86 // Disable lock first - otherwise the lock might not get activated corrently 106 // Disable lock first - otherwise the lock might not get activated corrently
87 this.actions.settings.update({ 107 this.actions.settings.update({
88 type: 'app', 108 type: 'app',