diff options
author | Amine Mouafik <amine@mouafik.fr> | 2020-02-26 11:49:05 +0100 |
---|---|---|
committer | Amine Mouafik <amine@mouafik.fr> | 2020-02-26 11:49:05 +0100 |
commit | 984d1f69348e99f2feefab9abcf1e24ba944c227 (patch) | |
tree | c4fc0c67c68b28166aca45cd2d52f0d31912d10b /src | |
parent | Merge branch 'develop' into refactor/lock (diff) | |
download | ferdium-app-984d1f69348e99f2feefab9abcf1e24ba944c227.tar.gz ferdium-app-984d1f69348e99f2feefab9abcf1e24ba944c227.tar.zst ferdium-app-984d1f69348e99f2feefab9abcf1e24ba944c227.zip |
Fix lock at startup when previously closed while locked
Diffstat (limited to 'src')
-rw-r--r-- | src/stores/SettingsStore.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js index 59a99a6e0..feee282e4 100644 --- a/src/stores/SettingsStore.js +++ b/src/stores/SettingsStore.js | |||
@@ -92,7 +92,18 @@ export default class SettingsStore extends Store { | |||
92 | // Lock on startup if enabled in settings | 92 | // Lock on startup if enabled in settings |
93 | if (this.startup && resp.type === 'app' && resp.data.lockingFeatureEnabled) { | 93 | if (this.startup && resp.type === 'app' && resp.data.lockingFeatureEnabled) { |
94 | this.startup = false; | 94 | this.startup = false; |
95 | process.nextTick(() => { this.all.app.locked = true }) | 95 | process.nextTick(() => { |
96 | // If the app was previously closed unlocked | ||
97 | // we can update the `locked` setting and rely on the reaction to lock at startup | ||
98 | if (!this.all.app.locked) { | ||
99 | this.all.app.locked = true; | ||
100 | } else { | ||
101 | // Otherwise the app previously closed in a locked state | ||
102 | // We can't rely on updating the locked setting for the reaction to be triggered | ||
103 | // So we lock manually | ||
104 | window.ferdi.stores.router.push('/auth/locked'); | ||
105 | } | ||
106 | }) | ||
96 | } | 107 | } |
97 | debug('Get appSettings resolves', resp.type, resp.data); | 108 | debug('Get appSettings resolves', resp.type, resp.data); |
98 | Object.assign(this._fileSystemSettingsCache[resp.type], resp.data); | 109 | Object.assign(this._fileSystemSettingsCache[resp.type], resp.data); |