aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/SettingsStore.js
diff options
context:
space:
mode:
authorLibravatar Bennett <hello@vantezzen.io>2020-05-01 12:49:22 +0200
committerLibravatar GitHub <noreply@github.com>2020-05-01 12:49:22 +0200
commitb479acc0a7d2aa06d8adc7a030691447a36e9cfb (patch)
tree9bdc5a9420fc38920b402bb7c8a78d5db0bca6dc /src/stores/SettingsStore.js
parentRestore delete service in sidebar (#692) (diff)
downloadferdium-app-b479acc0a7d2aa06d8adc7a030691447a36e9cfb.tar.gz
ferdium-app-b479acc0a7d2aa06d8adc7a030691447a36e9cfb.tar.zst
ferdium-app-b479acc0a7d2aa06d8adc7a030691447a36e9cfb.zip
Refactor locking feature (#693)
Diffstat (limited to 'src/stores/SettingsStore.js')
-rw-r--r--src/stores/SettingsStore.js22
1 files changed, 0 insertions, 22 deletions
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js
index 227eb2145..dcf3c3b9d 100644
--- a/src/stores/SettingsStore.js
+++ b/src/stores/SettingsStore.js
@@ -56,21 +56,6 @@ export default class SettingsStore extends Store {
56 }, 56 },
57 ); 57 );
58 58
59 reaction(
60 () => this.all.app.locked,
61 () => {
62 const { router } = window.ferdi.stores;
63 if (this.all.app.locked && this.all.app.lockingFeatureEnabled) {
64 // App just got locked, redirect to unlock screen
65 router.push('/auth/locked');
66 } else if (router.location.pathname.includes('/auth/locked')) {
67 // App is unlocked but user is still on locked screen
68 // Redirect to homepage
69 router.push('/');
70 }
71 },
72 );
73
74 // Inactivity lock timer 59 // Inactivity lock timer
75 let inactivityTimer; 60 let inactivityTimer;
76 remote.getCurrentWindow().on('blur', () => { 61 remote.getCurrentWindow().on('blur', () => {
@@ -96,15 +81,8 @@ export default class SettingsStore extends Store {
96 if (this.startup && resp.type === 'app' && resp.data.lockingFeatureEnabled) { 81 if (this.startup && resp.type === 'app' && resp.data.lockingFeatureEnabled) {
97 this.startup = false; 82 this.startup = false;
98 process.nextTick(() => { 83 process.nextTick(() => {
99 // If the app was previously closed unlocked
100 // we can update the `locked` setting and rely on the reaction to lock at startup
101 if (!this.all.app.locked) { 84 if (!this.all.app.locked) {
102 this.all.app.locked = true; 85 this.all.app.locked = true;
103 } else {
104 // Otherwise the app previously closed in a locked state
105 // We can't rely on updating the locked setting for the reaction to be triggered
106 // So we lock manually
107 window.ferdi.stores.router.push('/auth/locked');
108 } 86 }
109 }); 87 });
110 } 88 }