summaryrefslogtreecommitdiffstats
path: root/src/features/todos/store.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-09-07 00:53:10 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-09-07 00:53:10 +0200
commit5d03b91dd789ffd6d3d5753c223b4b6412887220 (patch)
treeb48a93aadcd5e77cd4f42d635edc598255286d4f /src/features/todos/store.js
parentUpdate CHANGELOG.md (diff)
downloadferdium-app-5d03b91dd789ffd6d3d5753c223b4b6412887220.tar.gz
ferdium-app-5d03b91dd789ffd6d3d5753c223b4b6412887220.tar.zst
ferdium-app-5d03b91dd789ffd6d3d5753c223b4b6412887220.zip
feat(Todos): Add option to disable todos
Diffstat (limited to 'src/features/todos/store.js')
-rw-r--r--src/features/todos/store.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/features/todos/store.js b/src/features/todos/store.js
index 003c69a5b..05eef4ec1 100644
--- a/src/features/todos/store.js
+++ b/src/features/todos/store.js
@@ -11,7 +11,7 @@ import { FeatureStore } from '../utils/FeatureStore';
11import { createReactions } from '../../stores/lib/Reaction'; 11import { createReactions } from '../../stores/lib/Reaction';
12import { createActionBindings } from '../utils/ActionBinding'; 12import { createActionBindings } from '../utils/ActionBinding';
13import { 13import {
14 DEFAULT_TODOS_WIDTH, TODOS_MIN_WIDTH, DEFAULT_TODOS_VISIBLE, TODOS_ROUTES, 14 DEFAULT_TODOS_WIDTH, TODOS_MIN_WIDTH, DEFAULT_TODOS_VISIBLE, TODOS_ROUTES, DEFAULT_IS_FEATURE_ENABLED_BY_USER,
15} from '.'; 15} from '.';
16import { IPC } from './constants'; 16import { IPC } from './constants';
17import { state as delayAppState } from '../delayApp'; 17import { state as delayAppState } from '../delayApp';
@@ -33,7 +33,7 @@ export default class TodoStore extends FeatureStore {
33 33
34 @computed get isTodosPanelForceHidden() { 34 @computed get isTodosPanelForceHidden() {
35 const { isAnnouncementShown } = this.stores.announcements; 35 const { isAnnouncementShown } = this.stores.announcements;
36 return delayAppState.isDelayAppScreenVisible || isAnnouncementShown; 36 return delayAppState.isDelayAppScreenVisible || !this.settings.isFeatureEnabledByUser || isAnnouncementShown;
37 } 37 }
38 38
39 @computed get isTodosPanelVisible() { 39 @computed get isTodosPanelVisible() {
@@ -60,6 +60,7 @@ export default class TodoStore extends FeatureStore {
60 [todoActions.setTodosWebview, this._setTodosWebview], 60 [todoActions.setTodosWebview, this._setTodosWebview],
61 [todoActions.handleHostMessage, this._handleHostMessage], 61 [todoActions.handleHostMessage, this._handleHostMessage],
62 [todoActions.handleClientMessage, this._handleClientMessage], 62 [todoActions.handleClientMessage, this._handleClientMessage],
63 [todoActions.toggleTodosFeatureVisibility, this._toggleTodosFeatureVisibility],
63 ])); 64 ]));
64 65
65 // REACTIONS 66 // REACTIONS
@@ -74,6 +75,12 @@ export default class TodoStore extends FeatureStore {
74 this._registerReactions(this._allReactions); 75 this._registerReactions(this._allReactions);
75 76
76 this.isFeatureActive = true; 77 this.isFeatureActive = true;
78
79 if (this.settings.isFeatureEnabledByUser === undefined) {
80 this._updateSettings({
81 isFeatureEnabledByUser: DEFAULT_IS_FEATURE_ENABLED_BY_USER,
82 });
83 }
77 } 84 }
78 85
79 @action stop() { 86 @action stop() {
@@ -128,6 +135,14 @@ export default class TodoStore extends FeatureStore {
128 } 135 }
129 }; 136 };
130 137
138 @action _toggleTodosFeatureVisibility = () => {
139 debug('_toggleTodosFeatureVisibility');
140
141 this._updateSettings({
142 isFeatureEnabledByUser: !this.settings.isFeatureEnabledByUser,
143 });
144 };
145
131 // Todos client message handlers 146 // Todos client message handlers
132 147
133 _onTodosClientInitialized = () => { 148 _onTodosClientInitialized = () => {