From ddab3a88b297fe244971b0d4fb9ff3fca3a8a1fe Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Wed, 11 Sep 2019 14:17:13 +0200 Subject: feat(Workspaces): Setting to keep all workspaces loaded --- .../settings/settings/EditSettingsForm.js | 5 ++ src/containers/settings/EditSettingsScreen.js | 37 +++++++++++- src/features/workspaces/actions.js | 1 + src/features/workspaces/index.js | 1 + src/features/workspaces/store.js | 5 ++ .../containers/settings/EditSettingsScreen.json | 65 +++++++++++++--------- src/stores/ServicesStore.js | 4 +- 7 files changed, 87 insertions(+), 31 deletions(-) (limited to 'src') 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 { cacheSize: PropTypes.string.isRequired, isSpellcheckerIncludedInCurrentPlan: PropTypes.bool.isRequired, isTodosEnabled: PropTypes.bool.isRequired, + isWorkspaceEnabled: PropTypes.bool.isRequired, }; static contextTypes = { @@ -133,6 +134,7 @@ export default @observer class EditSettingsForm extends Component { cacheSize, isSpellcheckerIncludedInCurrentPlan, isTodosEnabled, + isWorkspaceEnabled, } = this.props; const { intl } = this.context; @@ -164,6 +166,9 @@ export default @observer class EditSettingsForm extends Component { {process.platform === 'win32' && ( )} + {isWorkspaceEnabled && ( + + )} {isTodosEnabled && ( )} 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'; import globalMessages from '../../i18n/globalMessages'; import { DEFAULT_IS_FEATURE_ENABLED_BY_USER } from '../../features/todos'; +import WorkspacesStore from '../../features/workspaces/store'; +import { DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED } from '../../features/workspaces'; const messages = defineMessages({ autoLaunchOnStart: { @@ -73,6 +75,10 @@ const messages = defineMessages({ id: 'settings.app.form.enableTodos', defaultMessage: '!!!Enable Franz Todos', }, + keepAllWorkspacesLoaded: { + id: 'settings.app.form.keepAllWorkspacesLoaded', + defaultMessage: '!!!Keep all workspaces loaded', + }, }); export default @inject('stores', 'actions') @observer class EditSettingsScreen extends Component { @@ -81,12 +87,13 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e }; onSubmit(settingsData) { - const { todos } = this.props.stores; + const { todos, workspaces } = this.props.stores; const { app, settings, user, todos: todosActions, + workspaces: workspaceActions, } = this.props.actions; app.launchOnStartup({ @@ -118,14 +125,24 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e }, }); + if (workspaces.isFeatureActive) { + const { keepAllWorkspacesLoaded } = workspaces.settings; + if (keepAllWorkspacesLoaded !== settingsData.keepAllWorkspacesLoaded) { + workspaceActions.toggleKeepAllWorkspacesLoadedSetting(); + } + } + if (todos.isFeatureActive) { - todosActions.toggleTodosFeatureVisibility(); + const { isFeatureEnabledByUser } = todos.settings; + if (isFeatureEnabledByUser !== settingsData.enableTodos) { + todosActions.toggleTodosFeatureVisibility(); + } } } prepareForm() { const { - app, settings, user, todos, + app, settings, user, todos, workspaces, } = this.props.stores; const { intl } = this.context; @@ -210,6 +227,14 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e }, }; + if (workspaces.isFeatureActive) { + config.fields.keepAllWorkspacesLoaded = { + label: intl.formatMessage(messages.keepAllWorkspacesLoaded), + value: workspaces.settings.keepAllWorkspacesLoaded, + default: DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED, + }; + } + if (todos.isFeatureActive) { config.fields.enableTodos = { label: intl.formatMessage(messages.enableTodos), @@ -225,6 +250,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e const { app, todos, + workspaces, } = this.props.stores; const { updateStatus, @@ -255,6 +281,7 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e onClearAllCache={clearAllCache} isSpellcheckerIncludedInCurrentPlan={spellcheckerConfig.isIncludedInCurrentPlan} isTodosEnabled={todos.isFeatureActive} + isWorkspaceEnabled={workspaces.isFeatureActive} /> ); @@ -267,6 +294,7 @@ EditSettingsScreen.wrappedComponent.propTypes = { user: PropTypes.instanceOf(UserStore).isRequired, settings: PropTypes.instanceOf(SettingsStore).isRequired, todos: PropTypes.instanceOf(TodosStore).isRequired, + workspaces: PropTypes.instanceOf(WorkspacesStore).isRequired, }).isRequired, actions: PropTypes.shape({ app: PropTypes.shape({ @@ -284,5 +312,8 @@ EditSettingsScreen.wrappedComponent.propTypes = { todos: PropTypes.shape({ toggleTodosFeatureVisibility: PropTypes.func.isRequired, }).isRequired, + workspaces: PropTypes.shape({ + toggleAllWorkspacesLoadedSetting: PropTypes.func.isRequired, + }).isRequired, }).isRequired, }; 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({ deactivate: {}, toggleWorkspaceDrawer: {}, openWorkspaceSettings: {}, + toggleKeepAllWorkspacesLoadedSetting: {}, }, PropTypes.checkPropTypes); export 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'; const debug = require('debug')('Franz:feature:workspaces'); export const GA_CATEGORY_WORKSPACES = 'Workspaces'; +export const DEFAULT_SETTING_KEEP_ALL_WORKSPACES_LOADED = false; export const workspaceStore = new WorkspacesStore(); 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 { [workspaceActions.update, this._update], [workspaceActions.activate, this._setActiveWorkspace], [workspaceActions.deactivate, this._deactivateActiveWorkspace], + [workspaceActions.toggleKeepAllWorkspacesLoadedSetting, this._toggleKeepAllWorkspacesLoadedSetting], ]); this._allActions = this._freeUserActions.concat(this._premiumUserActions); this._registerActions(this._allActions); @@ -245,6 +246,10 @@ export default class WorkspacesStore extends FeatureStore { await updateWorkspaceRequest.execute(activeWorkspace); }; + _toggleKeepAllWorkspacesLoadedSetting = async () => { + this._updateSettings({ keepAllWorkspacesLoaded: !this.settings.keepAllWorkspacesLoaded }); + }; + // Reactions _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 @@ "defaultMessage": "!!!Launch Franz on start", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 24, + "line": 26, "column": 21 }, "end": { - "line": 27, + "line": 29, "column": 3 } }, @@ -17,11 +17,11 @@ "defaultMessage": "!!!Open in background", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 28, + "line": 30, "column": 26 }, "end": { - "line": 31, + "line": 33, "column": 3 } }, @@ -30,11 +30,11 @@ "defaultMessage": "!!!Keep Franz in background when closing the window", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 32, + "line": 34, "column": 19 }, "end": { - "line": 35, + "line": 37, "column": 3 } }, @@ -43,11 +43,11 @@ "defaultMessage": "!!!Show Franz in system tray", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 36, + "line": 38, "column": 20 }, "end": { - "line": 39, + "line": 41, "column": 3 } }, @@ -56,11 +56,11 @@ "defaultMessage": "!!!Minimize Franz to system tray", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 40, + "line": 42, "column": 24 }, "end": { - "line": 43, + "line": 45, "column": 3 } }, @@ -69,11 +69,11 @@ "defaultMessage": "!!!Language", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 44, + "line": 46, "column": 12 }, "end": { - "line": 47, + "line": 49, "column": 3 } }, @@ -82,11 +82,11 @@ "defaultMessage": "!!!Dark Mode", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 48, + "line": 50, "column": 12 }, "end": { - "line": 51, + "line": 53, "column": 3 } }, @@ -95,11 +95,11 @@ "defaultMessage": "!!!Display disabled services tabs", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 52, + "line": 54, "column": 24 }, "end": { - "line": 55, + "line": 57, "column": 3 } }, @@ -108,11 +108,11 @@ "defaultMessage": "!!!Show unread message badge when notifications are disabled", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 56, + "line": 58, "column": 29 }, "end": { - "line": 59, + "line": 61, "column": 3 } }, @@ -121,11 +121,11 @@ "defaultMessage": "!!!Enable spell checking", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 60, + "line": 62, "column": 23 }, "end": { - "line": 63, + "line": 65, "column": 3 } }, @@ -134,11 +134,11 @@ "defaultMessage": "!!!Enable GPU Acceleration", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 64, + "line": 66, "column": 25 }, "end": { - "line": 67, + "line": 69, "column": 3 } }, @@ -147,11 +147,11 @@ "defaultMessage": "!!!Include beta versions", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 68, + "line": 70, "column": 8 }, "end": { - "line": 71, + "line": 73, "column": 3 } }, @@ -160,11 +160,24 @@ "defaultMessage": "!!!Enable Franz Todos", "file": "src/containers/settings/EditSettingsScreen.js", "start": { - "line": 72, + "line": 74, "column": 15 }, "end": { - "line": 75, + "line": 77, + "column": 3 + } + }, + { + "id": "settings.app.form.keepAllWorkspacesLoaded", + "defaultMessage": "!!!Keep all workspaces loaded", + "file": "src/containers/settings/EditSettingsScreen.js", + "start": { + "line": 78, + "column": 27 + }, + "end": { + "line": 81, "column": 3 } } 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 { // This is just used to avoid unnecessary rerendering of resource-heavy webviews @computed get allDisplayedUnordered() { - const { showDisabledServices } = this.stores.settings.all.app; + const { showDisabledServices, keepAllWorkspacesLoaded } = this.stores.settings.all.app; const services = this.allServicesRequest.execute().result || []; const filteredServices = showDisabledServices ? services : services.filter(service => service.isEnabled); - return workspaceStore.filterServicesByActiveWorkspace(filteredServices); + return keepAllWorkspacesLoaded ? filteredServices : workspaceStore.filterServicesByActiveWorkspace(filteredServices); } @computed get filtered() { -- cgit v1.2.3-70-g09d2 From f01e7f2f66732a5af40c14ebde0d1331159dfc4b Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Wed, 11 Sep 2019 14:18:07 +0200 Subject: Update generated i18n changes --- src/i18n/locales/defaultMessages.json | 65 +++++++++++++++++++++-------------- src/i18n/locales/en-US.json | 3 +- 2 files changed, 41 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/i18n/locales/defaultMessages.json b/src/i18n/locales/defaultMessages.json index 44a49317e..3f815dda7 100644 --- a/src/i18n/locales/defaultMessages.json +++ b/src/i18n/locales/defaultMessages.json @@ -3414,169 +3414,182 @@ "defaultMessage": "!!!Launch Franz on start", "end": { "column": 3, - "line": 27 + "line": 29 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.autoLaunchOnStart", "start": { "column": 21, - "line": 24 + "line": 26 } }, { "defaultMessage": "!!!Open in background", "end": { "column": 3, - "line": 31 + "line": 33 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.autoLaunchInBackground", "start": { "column": 26, - "line": 28 + "line": 30 } }, { "defaultMessage": "!!!Keep Franz in background when closing the window", "end": { "column": 3, - "line": 35 + "line": 37 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.runInBackground", "start": { "column": 19, - "line": 32 + "line": 34 } }, { "defaultMessage": "!!!Show Franz in system tray", "end": { "column": 3, - "line": 39 + "line": 41 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.enableSystemTray", "start": { "column": 20, - "line": 36 + "line": 38 } }, { "defaultMessage": "!!!Minimize Franz to system tray", "end": { "column": 3, - "line": 43 + "line": 45 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.minimizeToSystemTray", "start": { "column": 24, - "line": 40 + "line": 42 } }, { "defaultMessage": "!!!Language", "end": { "column": 3, - "line": 47 + "line": 49 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.language", "start": { "column": 12, - "line": 44 + "line": 46 } }, { "defaultMessage": "!!!Dark Mode", "end": { "column": 3, - "line": 51 + "line": 53 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.darkMode", "start": { "column": 12, - "line": 48 + "line": 50 } }, { "defaultMessage": "!!!Display disabled services tabs", "end": { "column": 3, - "line": 55 + "line": 57 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.showDisabledServices", "start": { "column": 24, - "line": 52 + "line": 54 } }, { "defaultMessage": "!!!Show unread message badge when notifications are disabled", "end": { "column": 3, - "line": 59 + "line": 61 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.showMessagesBadgesWhenMuted", "start": { "column": 29, - "line": 56 + "line": 58 } }, { "defaultMessage": "!!!Enable spell checking", "end": { "column": 3, - "line": 63 + "line": 65 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.enableSpellchecking", "start": { "column": 23, - "line": 60 + "line": 62 } }, { "defaultMessage": "!!!Enable GPU Acceleration", "end": { "column": 3, - "line": 67 + "line": 69 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.enableGPUAcceleration", "start": { "column": 25, - "line": 64 + "line": 66 } }, { "defaultMessage": "!!!Include beta versions", "end": { "column": 3, - "line": 71 + "line": 73 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.beta", "start": { "column": 8, - "line": 68 + "line": 70 } }, { "defaultMessage": "!!!Enable Franz Todos", "end": { "column": 3, - "line": 75 + "line": 77 }, "file": "src/containers/settings/EditSettingsScreen.js", "id": "settings.app.form.enableTodos", "start": { "column": 15, - "line": 72 + "line": 74 + } + }, + { + "defaultMessage": "!!!Keep all workspaces loaded", + "end": { + "column": 3, + "line": 81 + }, + "file": "src/containers/settings/EditSettingsScreen.js", + "id": "settings.app.form.keepAllWorkspacesLoaded", + "start": { + "column": 27, + "line": 78 } } ], diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 9e63fdbca..33a2bf739 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json @@ -207,6 +207,7 @@ "settings.app.form.enableSpellchecking": "Enable spell checking", "settings.app.form.enableSystemTray": "Show Franz in system tray", "settings.app.form.enableTodos": "Enable Franz Todos", + "settings.app.form.keepAllWorkspacesLoaded": "!!!Keep all workspaces loaded", "settings.app.form.language": "Language", "settings.app.form.minimizeToSystemTray": "Minimize Franz to system tray", "settings.app.form.runInBackground": "Keep Franz in background when closing the window", @@ -379,4 +380,4 @@ "workspaceDrawer.workspaceFeatureInfo": "

Franz Workspaces let you focus on what’s important right now. Set up different sets of services and easily switch between them at any time.

You decide which services you need when and where, so we can help you stay on top of your game - or easily switch off from work whenever you want.

", "workspaceDrawer.workspacesSettingsTooltip": "Edit workspaces settings", "workspaces.switchingIndicator.switchingTo": "Switching to" -} +} \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 8933d731180daf391257d659a151bb8c1cbd075a Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Thu, 12 Sep 2019 09:14:50 +0200 Subject: Fix wrong reference to keepAllWorkspacesLoaded --- src/stores/ServicesStore.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index dcffb57ac..d1fd2be3d 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js @@ -121,7 +121,8 @@ export default class ServicesStore extends Store { // This is just used to avoid unnecessary rerendering of resource-heavy webviews @computed get allDisplayedUnordered() { - const { showDisabledServices, keepAllWorkspacesLoaded } = this.stores.settings.all.app; + const { showDisabledServices } = this.stores.settings.all.app; + const { keepAllWorkspacesLoaded } = this.stores.workspaces.settings; const services = this.allServicesRequest.execute().result || []; const filteredServices = showDisabledServices ? services : services.filter(service => service.isEnabled); return keepAllWorkspacesLoaded ? filteredServices : workspaceStore.filterServicesByActiveWorkspace(filteredServices); -- cgit v1.2.3-70-g09d2 From 08e268e03c41185a51ec4697c98c815c185654c3 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Thu, 12 Sep 2019 09:21:43 +0200 Subject: Fix language string --- src/i18n/locales/en-US.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 33a2bf739..57f2028dc 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json @@ -207,7 +207,7 @@ "settings.app.form.enableSpellchecking": "Enable spell checking", "settings.app.form.enableSystemTray": "Show Franz in system tray", "settings.app.form.enableTodos": "Enable Franz Todos", - "settings.app.form.keepAllWorkspacesLoaded": "!!!Keep all workspaces loaded", + "settings.app.form.keepAllWorkspacesLoaded": "Keep all workspaces loaded", "settings.app.form.language": "Language", "settings.app.form.minimizeToSystemTray": "Minimize Franz to system tray", "settings.app.form.runInBackground": "Keep Franz in background when closing the window", @@ -380,4 +380,4 @@ "workspaceDrawer.workspaceFeatureInfo": "

Franz Workspaces let you focus on what’s important right now. Set up different sets of services and easily switch between them at any time.

You decide which services you need when and where, so we can help you stay on top of your game - or easily switch off from work whenever you want.

", "workspaceDrawer.workspacesSettingsTooltip": "Edit workspaces settings", "workspaces.switchingIndicator.switchingTo": "Switching to" -} \ No newline at end of file +} -- cgit v1.2.3-70-g09d2 From 7209aa9c7a1d3ebf34218f5f414570df509b59ff Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Thu, 12 Sep 2019 09:22:11 +0200 Subject: Update en-US.json --- src/i18n/locales/en-US.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 57f2028dc..991af277b 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json @@ -380,4 +380,4 @@ "workspaceDrawer.workspaceFeatureInfo": "

Franz Workspaces let you focus on what’s important right now. Set up different sets of services and easily switch between them at any time.

You decide which services you need when and where, so we can help you stay on top of your game - or easily switch off from work whenever you want.

", "workspaceDrawer.workspacesSettingsTooltip": "Edit workspaces settings", "workspaces.switchingIndicator.switchingTo": "Switching to" -} +} \ No newline at end of file -- cgit v1.2.3-70-g09d2