aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/SettingsStore.js
diff options
context:
space:
mode:
authorLibravatar vantezzen <properly@protonmail.com>2019-09-17 12:14:48 +0200
committerLibravatar vantezzen <properly@protonmail.com>2019-09-17 12:14:48 +0200
commitd14071f3503f768c9c0e040dee549be6a6b40e5f (patch)
treeb6c945c8b4baf31344dbabd2ac555559285ebec6 /src/stores/SettingsStore.js
parentAdd "npm run prepare-code" command (diff)
downloadferdium-app-d14071f3503f768c9c0e040dee549be6a6b40e5f.tar.gz
ferdium-app-d14071f3503f768c9c0e040dee549be6a6b40e5f.tar.zst
ferdium-app-d14071f3503f768c9c0e040dee549be6a6b40e5f.zip
Implement #41
Diffstat (limited to 'src/stores/SettingsStore.js')
-rw-r--r--src/stores/SettingsStore.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js
index 2975499b3..f6a53f147 100644
--- a/src/stores/SettingsStore.js
+++ b/src/stores/SettingsStore.js
@@ -62,6 +62,34 @@ export default class SettingsStore extends Store {
62 this.all.app.autohideMenuBar, 62 this.all.app.autohideMenuBar,
63 ), 63 ),
64 ); 64 );
65
66 reaction(
67 () => this.all.app.locked,
68 () => {
69 const { router } = window.ferdi.stores;
70
71 if (this.all.app.locked && this.all.app.lockingFeatureEnabled) {
72 // App just got locked, redirect to unlock screen
73 router.push('/auth/locked');
74 } else if (router.location.pathname.includes('/auth/locked')) {
75 // App is unlocked but user is still on locked screen
76 // Redirect to homepage
77 router.push('/');
78 }
79 },
80 );
81
82 // Make sure to lock app on launch if locking feature is enabled
83 setTimeout(() => {
84 if (this.all.app.lockingFeatureEnabled) {
85 this.actions.settings.update({
86 type: 'app',
87 data: {
88 locked: true,
89 },
90 });
91 }
92 }, 1000);
65 } 93 }
66 94
67 @computed get app() { 95 @computed get app() {