diff options
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/todos/actions.js | 1 | ||||
-rw-r--r-- | src/features/todos/index.js | 1 | ||||
-rw-r--r-- | src/features/todos/store.js | 19 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/features/todos/actions.js b/src/features/todos/actions.js index dc63d5fcd..1ccc9a592 100644 --- a/src/features/todos/actions.js +++ b/src/features/todos/actions.js | |||
@@ -6,6 +6,7 @@ export const todoActions = createActionsFromDefinitions({ | |||
6 | width: PropTypes.number.isRequired, | 6 | width: PropTypes.number.isRequired, |
7 | }, | 7 | }, |
8 | toggleTodosPanel: {}, | 8 | toggleTodosPanel: {}, |
9 | toggleTodosFeatureVisibility: {}, | ||
9 | setTodosWebview: { | 10 | setTodosWebview: { |
10 | webview: PropTypes.instanceOf(Element).isRequired, | 11 | webview: PropTypes.instanceOf(Element).isRequired, |
11 | }, | 12 | }, |
diff --git a/src/features/todos/index.js b/src/features/todos/index.js index 9b6ab00a0..7388aebaf 100644 --- a/src/features/todos/index.js +++ b/src/features/todos/index.js | |||
@@ -8,6 +8,7 @@ export const GA_CATEGORY_TODOS = 'Todos'; | |||
8 | export const DEFAULT_TODOS_WIDTH = 300; | 8 | export const DEFAULT_TODOS_WIDTH = 300; |
9 | export const TODOS_MIN_WIDTH = 200; | 9 | export const TODOS_MIN_WIDTH = 200; |
10 | export const DEFAULT_TODOS_VISIBLE = true; | 10 | export const DEFAULT_TODOS_VISIBLE = true; |
11 | export const DEFAULT_IS_FEATURE_ENABLED_BY_USER = true; | ||
11 | 12 | ||
12 | export const TODOS_ROUTES = { | 13 | export const TODOS_ROUTES = { |
13 | TARGET: '/todos', | 14 | TARGET: '/todos', |
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'; | |||
11 | import { createReactions } from '../../stores/lib/Reaction'; | 11 | import { createReactions } from '../../stores/lib/Reaction'; |
12 | import { createActionBindings } from '../utils/ActionBinding'; | 12 | import { createActionBindings } from '../utils/ActionBinding'; |
13 | import { | 13 | import { |
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 '.'; |
16 | import { IPC } from './constants'; | 16 | import { IPC } from './constants'; |
17 | import { state as delayAppState } from '../delayApp'; | 17 | import { 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 = () => { |