From 18494f66a7e0f4020cbc77374d4679421fcf469a Mon Sep 17 00:00:00 2001 From: kytwb Date: Sat, 18 Dec 2021 04:24:10 +0100 Subject: Refactor autoUpdater usage --- src/components/layout/AppLayout.js | 2 - .../settings/settings/EditSettingsForm.js | 14 -- src/components/ui/ToggleRaw.js | 76 ----------- src/config.ts | 1 - src/containers/settings/EditSettingsScreen.js | 3 +- src/electron/ipc-api/autoUpdate.ts | 8 -- src/features/nightlyBuilds/Component.js | 142 --------------------- src/features/nightlyBuilds/index.ts | 41 ------ src/features/nightlyBuilds/store.ts | 7 - src/i18n/locales/en-US.json | 7 +- src/stores/FeaturesStore.js | 2 - src/styles/features.scss | 2 +- 12 files changed, 4 insertions(+), 301 deletions(-) delete mode 100644 src/components/ui/ToggleRaw.js delete mode 100644 src/features/nightlyBuilds/Component.js delete mode 100644 src/features/nightlyBuilds/index.ts delete mode 100644 src/features/nightlyBuilds/store.ts (limited to 'src') diff --git a/src/components/layout/AppLayout.js b/src/components/layout/AppLayout.js index 084d93ecd..b47a6040d 100644 --- a/src/components/layout/AppLayout.js +++ b/src/components/layout/AppLayout.js @@ -10,7 +10,6 @@ import { mdiFlash, mdiPowerPlug } from '@mdi/js'; import InfoBar from '../ui/InfoBar'; import { Component as BasicAuth } from '../../features/basicAuth'; import { Component as QuickSwitch } from '../../features/quickSwitch'; -import { Component as NightlyBuilds } from '../../features/nightlyBuilds'; import { Component as PublishDebugInfo } from '../../features/publishDebugInfo'; import ErrorBoundary from '../util/ErrorBoundary'; @@ -193,7 +192,6 @@ class AppLayout extends Component { )} - {services} {children} diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js index eab65f5e5..d17c804f0 100644 --- a/src/components/settings/settings/EditSettingsForm.js +++ b/src/components/settings/settings/EditSettingsForm.js @@ -9,7 +9,6 @@ import { mdiGithub, mdiOpenInNew } from '@mdi/js'; import Form from '../../../lib/Form'; import Button from '../../ui/Button'; import Toggle from '../../ui/Toggle'; -import ToggleRaw from '../../ui/ToggleRaw'; import Select from '../../ui/Select'; import Input from '../../ui/Input'; import Infobox from '../../ui/Infobox'; @@ -203,7 +202,6 @@ class EditSettingsForm extends Component { isDarkmodeEnabled: PropTypes.bool.isRequired, isAdaptableDarkModeEnabled: PropTypes.bool.isRequired, isSplitModeEnabled: PropTypes.bool.isRequired, - isNightlyEnabled: PropTypes.bool.isRequired, hasAddedTodosAsService: PropTypes.bool.isRequired, isOnline: PropTypes.bool.isRequired, }; @@ -252,7 +250,6 @@ class EditSettingsForm extends Component { isDarkmodeEnabled, isSplitModeEnabled, isTodosActivated, - isNightlyEnabled, hasAddedTodosAsService, isOnline, } = this.props; @@ -770,17 +767,6 @@ class EditSettingsForm extends Component { {automaticUpdates && (
- {updateIsReadyToInstall ? (
- - ); - } -} - -NightlyBuildsModal.propTypes = { - stores: PropTypes.shape({ - settings: PropTypes.instanceOf(SettingsStore).isRequired, - }).isRequired, - actions: PropTypes.shape({ - settings: PropTypes.instanceOf(SettingsStore).isRequired, - user: PropTypes.instanceOf(UserStore).isRequired, - ui: PropTypes.instanceOf(UIStore).isRequired, - }).isRequired, - classes: PropTypes.object.isRequired, -}; - -export default injectIntl( - injectSheet(styles)( - inject('stores', 'actions')(observer(NightlyBuildsModal)), - ), -); diff --git a/src/features/nightlyBuilds/index.ts b/src/features/nightlyBuilds/index.ts deleted file mode 100644 index 14afbaf1b..000000000 --- a/src/features/nightlyBuilds/index.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { state as ModalState } from './store'; - -export { default as Component } from './Component'; - -const debug = require('debug')('Ferdi:feature:nightlyBuilds'); - -const state = ModalState; - -export default function initialize() { - debug('Initialize nightlyBuilds feature'); - - function showModal() { - state.isModalVisible = true; - } - - function toggleFeature() { - if (window['ferdi'].stores.settings.app.nightly) { - window['ferdi'].actions.settings.update({ - type: 'app', - data: { - nightly: false, - }, - }); - window['ferdi'].actions.user.update({ - userData: { - nightly: false, - }, - }); - } else { - // We need to close the settings, otherwise the modal will be drawn under the settings window - window['ferdi'].actions.ui.closeSettings(); - showModal(); - } - } - - window['ferdi'].features.nightlyBuilds = { - state, - showModal, - toggleFeature, - }; -} diff --git a/src/features/nightlyBuilds/store.ts b/src/features/nightlyBuilds/store.ts deleted file mode 100644 index ed06e5a7d..000000000 --- a/src/features/nightlyBuilds/store.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { observable } from 'mobx'; - -const defaultState = { - isModalVisible: false, -}; - -export const state = observable(defaultState); diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index db528ac47..b6445b4bc 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json @@ -10,9 +10,6 @@ "connectionLostBanner.informationLink": "What happened?", "connectionLostBanner.message": "Oh no! Ferdi lost the connection to {name}.", "feature.basicAuth.signIn": "Sign In", - "feature.nightlyBuilds.activate": "Activate", - "feature.nightlyBuilds.info": "Nightly builds are highly experimental versions of Ferdi that may contain unpolished or uncompleted features. These nightly builds are mainly used by developers to test their newly developed features and how they will perform in the final build. If you don't know what you are doing, we suggest not activating nightly builds.", - "feature.nightlyBuilds.title": "Nightly Builds", "feature.publishDebugInfo.error": "There was an error while trying to publish the debug information. Please try again later or view the console for more information.", "feature.publishDebugInfo.info": "Publishing your debug information helps us find issues and errors in Ferdi. By publishing your debug information you accept Ferdi Debugger's privacy policy and terms of service", "feature.publishDebugInfo.privacy": "Privacy policy", @@ -201,7 +198,7 @@ "settings.app.form.autoLaunchInBackground": "Open in background", "settings.app.form.autoLaunchOnStart": "Launch Ferdi on start", "settings.app.form.automaticUpdates": "Enable updates", - "settings.app.form.beta": "Include beta versions", + "settings.app.form.beta": "Include pre-releases", "settings.app.form.clipboardNotifications": "Don't show notifications for clipboard events", "settings.app.form.closeToSystemTray": "Close Ferdi to system tray", "settings.app.form.confirmOnQuit": "Confirm when quitting Ferdi", @@ -452,4 +449,4 @@ "workspaceDrawer.workspaceFeatureInfo": "

Ferdi 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 diff --git a/src/stores/FeaturesStore.js b/src/stores/FeaturesStore.js index 26a045314..e2c0c08ef 100644 --- a/src/stores/FeaturesStore.js +++ b/src/stores/FeaturesStore.js @@ -7,7 +7,6 @@ import serviceProxy from '../features/serviceProxy'; import basicAuth from '../features/basicAuth'; import workspaces from '../features/workspaces'; import quickSwitch from '../features/quickSwitch'; -import nightlyBuilds from '../features/nightlyBuilds'; import publishDebugInfo from '../features/publishDebugInfo'; import communityRecipes from '../features/communityRecipes'; import todos from '../features/todos'; @@ -70,7 +69,6 @@ export default class FeaturesStore extends Store { basicAuth(); workspaces(this.stores, this.actions); quickSwitch(); - nightlyBuilds(); publishDebugInfo(); communityRecipes(this.stores, this.actions); todos(this.stores, this.actions); diff --git a/src/styles/features.scss b/src/styles/features.scss index 80362b648..c6d982b25 100644 --- a/src/styles/features.scss +++ b/src/styles/features.scss @@ -23,6 +23,6 @@ } } -.theme__dark .publish-debug, .theme__dark .nightly-builds { +.theme__dark .publish-debug { background: $dark-theme-gray-darkest; } -- cgit v1.2.3-54-g00ecf