aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-09-11 14:17:13 +0200
committerLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-09-11 14:17:13 +0200
commitddab3a88b297fe244971b0d4fb9ff3fca3a8a1fe (patch)
tree4d1df67bd12c0a4f82c483f1c2d4f6c9e20c4281 /src
parentUpdate CHANGELOG.md (diff)
downloadferdium-app-ddab3a88b297fe244971b0d4fb9ff3fca3a8a1fe.tar.gz
ferdium-app-ddab3a88b297fe244971b0d4fb9ff3fca3a8a1fe.tar.zst
ferdium-app-ddab3a88b297fe244971b0d4fb9ff3fca3a8a1fe.zip
feat(Workspaces): Setting to keep all workspaces loaded
Diffstat (limited to 'src')
-rw-r--r--src/components/settings/settings/EditSettingsForm.js5
-rw-r--r--src/containers/settings/EditSettingsScreen.js37
-rw-r--r--src/features/workspaces/actions.js1
-rw-r--r--src/features/workspaces/index.js1
-rw-r--r--src/features/workspaces/store.js5
-rw-r--r--src/i18n/messages/src/containers/settings/EditSettingsScreen.json65
-rw-r--r--src/stores/ServicesStore.js4
7 files changed, 87 insertions, 31 deletions
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js
index ff30daed2..0b69f7514 100644
--- a/src/components/settings/settings/EditSettingsForm.js
+++ b/src/components/settings/settings/EditSettingsForm.js
@@ -102,6 +102,7 @@ export default @observer class EditSettingsForm extends Component {
102 cacheSize: PropTypes.string.isRequired, 102 cacheSize: PropTypes.string.isRequired,
103 isSpellcheckerIncludedInCurrentPlan: PropTypes.bool.isRequired, 103 isSpellcheckerIncludedInCurrentPlan: PropTypes.bool.isRequired,
104 isTodosEnabled: PropTypes.bool.isRequired, 104 isTodosEnabled: PropTypes.bool.isRequired,
105 isWorkspaceEnabled: PropTypes.bool.isRequired,
105 }; 106 };
106 107
107 static contextTypes = { 108 static contextTypes = {
@@ -133,6 +134,7 @@ export default @observer class EditSettingsForm extends Component {
133 cacheSize, 134 cacheSize,
134 isSpellcheckerIncludedInCurrentPlan, 135 isSpellcheckerIncludedInCurrentPlan,
135 isTodosEnabled, 136 isTodosEnabled,
137 isWorkspaceEnabled,
136 } = this.props; 138 } = this.props;
137 const { intl } = this.context; 139 const { intl } = this.context;
138 140
@@ -164,6 +166,9 @@ export default @observer class EditSettingsForm extends Component {
164 {process.platform === 'win32' && ( 166 {process.platform === 'win32' && (
165 <Toggle field={form.$('minimizeToSystemTray')} /> 167 <Toggle field={form.$('minimizeToSystemTray')} />
166 )} 168 )}
169 {isWorkspaceEnabled && (
170 <Toggle field={form.$('keepAllWorkspacesLoaded')} />
171 )}
167 {isTodosEnabled && ( 172 {isTodosEnabled && (
168 <Toggle field={form.$('enableTodos')} /> 173 <Toggle field={form.$('enableTodos')} />
169 )} 174 )}
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js
index 65b5a45df..9aba212be 100644
--- a/src/containers/settings/EditSettingsScreen.js
+++ b/src/containers/settings/EditSettingsScreen.js
@@ -19,6 +19,8 @@ import ErrorBoundary from '../../components/util/ErrorBoundary';
19 19
20import globalMessages from '../../i18n/globalMessages'; 20import globalMessages from '../../i18n/globalMessages';
21import { DEFAULT_IS_FEATURE_ENABLED_BY_USER } from '../../features/todos'; 21import { DEFAULT_IS_FEATURE_ENABLED_BY_USER } from '../../features/todos';
22import WorkspacesStore from '../../features/workspaces/store';
23import { DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED } from '../../features/workspaces';
22 24
23const messages = defineMessages({ 25const messages = defineMessages({
24 autoLaunchOnStart: { 26 autoLaunchOnStart: {
@@ -73,6 +75,10 @@ const messages = defineMessages({
73 id: 'settings.app.form.enableTodos', 75 id: 'settings.app.form.enableTodos',
74 defaultMessage: '!!!Enable Franz Todos', 76 defaultMessage: '!!!Enable Franz Todos',
75 }, 77 },
78 keepAllWorkspacesLoaded: {
79 id: 'settings.app.form.keepAllWorkspacesLoaded',
80 defaultMessage: '!!!Keep all workspaces loaded',
81 },
76}); 82});
77 83
78export default @inject('stores', 'actions') @observer class EditSettingsScreen extends Component { 84export default @inject('stores', 'actions') @observer class EditSettingsScreen extends Component {
@@ -81,12 +87,13 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
81 }; 87 };
82 88
83 onSubmit(settingsData) { 89 onSubmit(settingsData) {
84 const { todos } = this.props.stores; 90 const { todos, workspaces } = this.props.stores;
85 const { 91 const {
86 app, 92 app,
87 settings, 93 settings,
88 user, 94 user,
89 todos: todosActions, 95 todos: todosActions,
96 workspaces: workspaceActions,
90 } = this.props.actions; 97 } = this.props.actions;
91 98
92 app.launchOnStartup({ 99 app.launchOnStartup({
@@ -118,14 +125,24 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
118 }, 125 },
119 }); 126 });
120 127
128 if (workspaces.isFeatureActive) {
129 const { keepAllWorkspacesLoaded } = workspaces.settings;
130 if (keepAllWorkspacesLoaded !== settingsData.keepAllWorkspacesLoaded) {
131 workspaceActions.toggleKeepAllWorkspacesLoadedSetting();
132 }
133 }
134
121 if (todos.isFeatureActive) { 135 if (todos.isFeatureActive) {
122 todosActions.toggleTodosFeatureVisibility(); 136 const { isFeatureEnabledByUser } = todos.settings;
137 if (isFeatureEnabledByUser !== settingsData.enableTodos) {
138 todosActions.toggleTodosFeatureVisibility();
139 }
123 } 140 }
124 } 141 }
125 142
126 prepareForm() { 143 prepareForm() {
127 const { 144 const {
128 app, settings, user, todos, 145 app, settings, user, todos, workspaces,
129 } = this.props.stores; 146 } = this.props.stores;
130 const { intl } = this.context; 147 const { intl } = this.context;
131 148
@@ -210,6 +227,14 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
210 }, 227 },
211 }; 228 };
212 229
230 if (workspaces.isFeatureActive) {
231 config.fields.keepAllWorkspacesLoaded = {
232 label: intl.formatMessage(messages.keepAllWorkspacesLoaded),
233 value: workspaces.settings.keepAllWorkspacesLoaded,
234 default: DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED,
235 };
236 }
237
213 if (todos.isFeatureActive) { 238 if (todos.isFeatureActive) {
214 config.fields.enableTodos = { 239 config.fields.enableTodos = {
215 label: intl.formatMessage(messages.enableTodos), 240 label: intl.formatMessage(messages.enableTodos),
@@ -225,6 +250,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
225 const { 250 const {
226 app, 251 app,
227 todos, 252 todos,
253 workspaces,
228 } = this.props.stores; 254 } = this.props.stores;
229 const { 255 const {
230 updateStatus, 256 updateStatus,
@@ -255,6 +281,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e
255 onClearAllCache={clearAllCache} 281 onClearAllCache={clearAllCache}
256 isSpellcheckerIncludedInCurrentPlan={spellcheckerConfig.isIncludedInCurrentPlan} 282 isSpellcheckerIncludedInCurrentPlan={spellcheckerConfig.isIncludedInCurrentPlan}
257 isTodosEnabled={todos.isFeatureActive} 283 isTodosEnabled={todos.isFeatureActive}
284 isWorkspaceEnabled={workspaces.isFeatureActive}
258 /> 285 />
259 </ErrorBoundary> 286 </ErrorBoundary>
260 ); 287 );
@@ -267,6 +294,7 @@ EditSettingsScreen.wrappedComponent.propTypes = {
267 user: PropTypes.instanceOf(UserStore).isRequired, 294 user: PropTypes.instanceOf(UserStore).isRequired,
268 settings: PropTypes.instanceOf(SettingsStore).isRequired, 295 settings: PropTypes.instanceOf(SettingsStore).isRequired,
269 todos: PropTypes.instanceOf(TodosStore).isRequired, 296 todos: PropTypes.instanceOf(TodosStore).isRequired,
297 workspaces: PropTypes.instanceOf(WorkspacesStore).isRequired,
270 }).isRequired, 298 }).isRequired,
271 actions: PropTypes.shape({ 299 actions: PropTypes.shape({
272 app: PropTypes.shape({ 300 app: PropTypes.shape({
@@ -284,5 +312,8 @@ EditSettingsScreen.wrappedComponent.propTypes = {
284 todos: PropTypes.shape({ 312 todos: PropTypes.shape({
285 toggleTodosFeatureVisibility: PropTypes.func.isRequired, 313 toggleTodosFeatureVisibility: PropTypes.func.isRequired,
286 }).isRequired, 314 }).isRequired,
315 workspaces: PropTypes.shape({
316 toggleAllWorkspacesLoadedSetting: PropTypes.func.isRequired,
317 }).isRequired,
287 }).isRequired, 318 }).isRequired,
288}; 319};
diff --git a/src/features/workspaces/actions.js b/src/features/workspaces/actions.js
index a85f8f57f..5b5db422e 100644
--- a/src/features/workspaces/actions.js
+++ b/src/features/workspaces/actions.js
@@ -21,6 +21,7 @@ export const workspaceActions = createActionsFromDefinitions({
21 deactivate: {}, 21 deactivate: {},
22 toggleWorkspaceDrawer: {}, 22 toggleWorkspaceDrawer: {},
23 openWorkspaceSettings: {}, 23 openWorkspaceSettings: {},
24 toggleKeepAllWorkspacesLoadedSetting: {},
24}, PropTypes.checkPropTypes); 25}, PropTypes.checkPropTypes);
25 26
26export default workspaceActions; 27export default workspaceActions;
diff --git a/src/features/workspaces/index.js b/src/features/workspaces/index.js
index ad9023b8b..ed3e52096 100644
--- a/src/features/workspaces/index.js
+++ b/src/features/workspaces/index.js
@@ -5,6 +5,7 @@ import { resetApiRequests } from './api';
5const debug = require('debug')('Franz:feature:workspaces'); 5const debug = require('debug')('Franz:feature:workspaces');
6 6
7export const GA_CATEGORY_WORKSPACES = 'Workspaces'; 7export const GA_CATEGORY_WORKSPACES = 'Workspaces';
8export const DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED = false;
8 9
9export const workspaceStore = new WorkspacesStore(); 10export const workspaceStore = new WorkspacesStore();
10 11
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js
index 4a1f80b4e..7f41cfc88 100644
--- a/src/features/workspaces/store.js
+++ b/src/features/workspaces/store.js
@@ -97,6 +97,7 @@ export default class WorkspacesStore extends FeatureStore {
97 [workspaceActions.update, this._update], 97 [workspaceActions.update, this._update],
98 [workspaceActions.activate, this._setActiveWorkspace], 98 [workspaceActions.activate, this._setActiveWorkspace],
99 [workspaceActions.deactivate, this._deactivateActiveWorkspace], 99 [workspaceActions.deactivate, this._deactivateActiveWorkspace],
100 [workspaceActions.toggleKeepAllWorkspacesLoadedSetting, this._toggleKeepAllWorkspacesLoadedSetting],
100 ]); 101 ]);
101 this._allActions = this._freeUserActions.concat(this._premiumUserActions); 102 this._allActions = this._freeUserActions.concat(this._premiumUserActions);
102 this._registerActions(this._allActions); 103 this._registerActions(this._allActions);
@@ -245,6 +246,10 @@ export default class WorkspacesStore extends FeatureStore {
245 await updateWorkspaceRequest.execute(activeWorkspace); 246 await updateWorkspaceRequest.execute(activeWorkspace);
246 }; 247 };
247 248
249 _toggleKeepAllWorkspacesLoadedSetting = async () => {
250 this._updateSettings({ keepAllWorkspacesLoaded: !this.settings.keepAllWorkspacesLoaded });
251 };
252
248 // Reactions 253 // Reactions
249 254
250 _setFeatureEnabledReaction = () => { 255 _setFeatureEnabledReaction = () => {
diff --git a/src/i18n/messages/src/containers/settings/EditSettingsScreen.json b/src/i18n/messages/src/containers/settings/EditSettingsScreen.json
index 2b666e7e9..d0a243ec0 100644
--- a/src/i18n/messages/src/containers/settings/EditSettingsScreen.json
+++ b/src/i18n/messages/src/containers/settings/EditSettingsScreen.json
@@ -4,11 +4,11 @@
4 "defaultMessage": "!!!Launch Franz on start", 4 "defaultMessage": "!!!Launch Franz on start",
5 "file": "src/containers/settings/EditSettingsScreen.js", 5 "file": "src/containers/settings/EditSettingsScreen.js",
6 "start": { 6 "start": {
7 "line": 24, 7 "line": 26,
8 "column": 21 8 "column": 21
9 }, 9 },
10 "end": { 10 "end": {
11 "line": 27, 11 "line": 29,
12 "column": 3 12 "column": 3
13 } 13 }
14 }, 14 },
@@ -17,11 +17,11 @@
17 "defaultMessage": "!!!Open in background", 17 "defaultMessage": "!!!Open in background",
18 "file": "src/containers/settings/EditSettingsScreen.js", 18 "file": "src/containers/settings/EditSettingsScreen.js",
19 "start": { 19 "start": {
20 "line": 28, 20 "line": 30,
21 "column": 26 21 "column": 26
22 }, 22 },
23 "end": { 23 "end": {
24 "line": 31, 24 "line": 33,
25 "column": 3 25 "column": 3
26 } 26 }
27 }, 27 },
@@ -30,11 +30,11 @@
30 "defaultMessage": "!!!Keep Franz in background when closing the window", 30 "defaultMessage": "!!!Keep Franz in background when closing the window",
31 "file": "src/containers/settings/EditSettingsScreen.js", 31 "file": "src/containers/settings/EditSettingsScreen.js",
32 "start": { 32 "start": {
33 "line": 32, 33 "line": 34,
34 "column": 19 34 "column": 19
35 }, 35 },
36 "end": { 36 "end": {
37 "line": 35, 37 "line": 37,
38 "column": 3 38 "column": 3
39 } 39 }
40 }, 40 },
@@ -43,11 +43,11 @@
43 "defaultMessage": "!!!Show Franz in system tray", 43 "defaultMessage": "!!!Show Franz in system tray",
44 "file": "src/containers/settings/EditSettingsScreen.js", 44 "file": "src/containers/settings/EditSettingsScreen.js",
45 "start": { 45 "start": {
46 "line": 36, 46 "line": 38,
47 "column": 20 47 "column": 20
48 }, 48 },
49 "end": { 49 "end": {
50 "line": 39, 50 "line": 41,
51 "column": 3 51 "column": 3
52 } 52 }
53 }, 53 },
@@ -56,11 +56,11 @@
56 "defaultMessage": "!!!Minimize Franz to system tray", 56 "defaultMessage": "!!!Minimize Franz to system tray",
57 "file": "src/containers/settings/EditSettingsScreen.js", 57 "file": "src/containers/settings/EditSettingsScreen.js",
58 "start": { 58 "start": {
59 "line": 40, 59 "line": 42,
60 "column": 24 60 "column": 24
61 }, 61 },
62 "end": { 62 "end": {
63 "line": 43, 63 "line": 45,
64 "column": 3 64 "column": 3
65 } 65 }
66 }, 66 },
@@ -69,11 +69,11 @@
69 "defaultMessage": "!!!Language", 69 "defaultMessage": "!!!Language",
70 "file": "src/containers/settings/EditSettingsScreen.js", 70 "file": "src/containers/settings/EditSettingsScreen.js",
71 "start": { 71 "start": {
72 "line": 44, 72 "line": 46,
73 "column": 12 73 "column": 12
74 }, 74 },
75 "end": { 75 "end": {
76 "line": 47, 76 "line": 49,
77 "column": 3 77 "column": 3
78 } 78 }
79 }, 79 },
@@ -82,11 +82,11 @@
82 "defaultMessage": "!!!Dark Mode", 82 "defaultMessage": "!!!Dark Mode",
83 "file": "src/containers/settings/EditSettingsScreen.js", 83 "file": "src/containers/settings/EditSettingsScreen.js",
84 "start": { 84 "start": {
85 "line": 48, 85 "line": 50,
86 "column": 12 86 "column": 12
87 }, 87 },
88 "end": { 88 "end": {
89 "line": 51, 89 "line": 53,
90 "column": 3 90 "column": 3
91 } 91 }
92 }, 92 },
@@ -95,11 +95,11 @@
95 "defaultMessage": "!!!Display disabled services tabs", 95 "defaultMessage": "!!!Display disabled services tabs",
96 "file": "src/containers/settings/EditSettingsScreen.js", 96 "file": "src/containers/settings/EditSettingsScreen.js",
97 "start": { 97 "start": {
98 "line": 52, 98 "line": 54,
99 "column": 24 99 "column": 24
100 }, 100 },
101 "end": { 101 "end": {
102 "line": 55, 102 "line": 57,
103 "column": 3 103 "column": 3
104 } 104 }
105 }, 105 },
@@ -108,11 +108,11 @@
108 "defaultMessage": "!!!Show unread message badge when notifications are disabled", 108 "defaultMessage": "!!!Show unread message badge when notifications are disabled",
109 "file": "src/containers/settings/EditSettingsScreen.js", 109 "file": "src/containers/settings/EditSettingsScreen.js",
110 "start": { 110 "start": {
111 "line": 56, 111 "line": 58,
112 "column": 29 112 "column": 29
113 }, 113 },
114 "end": { 114 "end": {
115 "line": 59, 115 "line": 61,
116 "column": 3 116 "column": 3
117 } 117 }
118 }, 118 },
@@ -121,11 +121,11 @@
121 "defaultMessage": "!!!Enable spell checking", 121 "defaultMessage": "!!!Enable spell checking",
122 "file": "src/containers/settings/EditSettingsScreen.js", 122 "file": "src/containers/settings/EditSettingsScreen.js",
123 "start": { 123 "start": {
124 "line": 60, 124 "line": 62,
125 "column": 23 125 "column": 23
126 }, 126 },
127 "end": { 127 "end": {
128 "line": 63, 128 "line": 65,
129 "column": 3 129 "column": 3
130 } 130 }
131 }, 131 },
@@ -134,11 +134,11 @@
134 "defaultMessage": "!!!Enable GPU Acceleration", 134 "defaultMessage": "!!!Enable GPU Acceleration",
135 "file": "src/containers/settings/EditSettingsScreen.js", 135 "file": "src/containers/settings/EditSettingsScreen.js",
136 "start": { 136 "start": {
137 "line": 64, 137 "line": 66,
138 "column": 25 138 "column": 25
139 }, 139 },
140 "end": { 140 "end": {
141 "line": 67, 141 "line": 69,
142 "column": 3 142 "column": 3
143 } 143 }
144 }, 144 },
@@ -147,11 +147,11 @@
147 "defaultMessage": "!!!Include beta versions", 147 "defaultMessage": "!!!Include beta versions",
148 "file": "src/containers/settings/EditSettingsScreen.js", 148 "file": "src/containers/settings/EditSettingsScreen.js",
149 "start": { 149 "start": {
150 "line": 68, 150 "line": 70,
151 "column": 8 151 "column": 8
152 }, 152 },
153 "end": { 153 "end": {
154 "line": 71, 154 "line": 73,
155 "column": 3 155 "column": 3
156 } 156 }
157 }, 157 },
@@ -160,11 +160,24 @@
160 "defaultMessage": "!!!Enable Franz Todos", 160 "defaultMessage": "!!!Enable Franz Todos",
161 "file": "src/containers/settings/EditSettingsScreen.js", 161 "file": "src/containers/settings/EditSettingsScreen.js",
162 "start": { 162 "start": {
163 "line": 72, 163 "line": 74,
164 "column": 15 164 "column": 15
165 }, 165 },
166 "end": { 166 "end": {
167 "line": 75, 167 "line": 77,
168 "column": 3
169 }
170 },
171 {
172 "id": "settings.app.form.keepAllWorkspacesLoaded",
173 "defaultMessage": "!!!Keep all workspaces loaded",
174 "file": "src/containers/settings/EditSettingsScreen.js",
175 "start": {
176 "line": 78,
177 "column": 27
178 },
179 "end": {
180 "line": 81,
168 "column": 3 181 "column": 3
169 } 182 }
170 } 183 }
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index 2fc543192..dcffb57ac 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -121,10 +121,10 @@ export default class ServicesStore extends Store {
121 121
122 // This is just used to avoid unnecessary rerendering of resource-heavy webviews 122 // This is just used to avoid unnecessary rerendering of resource-heavy webviews
123 @computed get allDisplayedUnordered() { 123 @computed get allDisplayedUnordered() {
124 const { showDisabledServices } = this.stores.settings.all.app; 124 const { showDisabledServices, keepAllWorkspacesLoaded } = this.stores.settings.all.app;
125 const services = this.allServicesRequest.execute().result || []; 125 const services = this.allServicesRequest.execute().result || [];
126 const filteredServices = showDisabledServices ? services : services.filter(service => service.isEnabled); 126 const filteredServices = showDisabledServices ? services : services.filter(service => service.isEnabled);
127 return workspaceStore.filterServicesByActiveWorkspace(filteredServices); 127 return keepAllWorkspacesLoaded ? filteredServices : workspaceStore.filterServicesByActiveWorkspace(filteredServices);
128 } 128 }
129 129
130 @computed get filtered() { 130 @computed get filtered() {