diff --git a/public/locales/en/settings.json b/public/locales/en/settings.json index 89ea43975..7f53d5167 100644 --- a/public/locales/en/settings.json +++ b/public/locales/en/settings.json @@ -25,14 +25,6 @@ "settingsWillBeUsedNextTime": "The new settings will be used next time you restart the IPFS daemon.", "ipfsConfigDescription": "The IPFS config file is a JSON document. It is read once when the IPFS daemon is started. Save your changes, then restart the IPFS daemon to apply them.", "ipfsConfigHelp": "Check the documentation for further information.", - "ipfsDesktop": "IPFS Desktop", - "takeScreenshot": "Take screenshot", - "takeScreenshotDescription": "Use <0>{key1} + <2>{key2} + <3>{key3} to take screenshots and add them to your repository.", - "downloadHash": "Download hash", - "downloadHashDescription": "Use <0>{key1} + <2>{key2} + <3>{key3} to download the last copied hash or path to your system.", - "launchOnStartup": "Launch on login", - "globalShortcuts": "Global Shortcuts", - "globalShortcutsAre": "IPFS Desktop provides some features that can be globally accessed through keyboard shortcuts. You can enable or disable them here.", "AnalyticsToggle": { "label": "Help improve this app by sending anonymous usage data", "summary": "Configure what is collected", @@ -96,13 +88,6 @@ "description": "Here you can get an early preview into new IPFS features by enabling options below. We are testing these ideas, and they may not be perfect yet so we'd love to hear your feedback.", "issueUrl": "Open an issue", "feedbackUrl": "💌Leave feedback", - "readMoreUrl": "Read More", - "npmOnIpfs": { - "title": "NPM on IPFS", - "label": "Enable ipfs-npm", - "description": "Install npm modules through IPFS with the 'ipfs-npm' command line tool!" - } - }, - "ipfsCmdTools": "IPFS command line tools", - "ipfsCmdToolsDescription": "Add <0>ipfs binary to your system <0>PATH so you can use it in the command line." + "readMoreUrl": "Read More" + } } diff --git a/src/bundles/config-save.js b/src/bundles/config-save.js index 39ca3be59..33cc76df7 100644 --- a/src/bundles/config-save.js +++ b/src/bundles/config-save.js @@ -33,10 +33,6 @@ const bundle = { } await store.doMarkConfigAsOutdated() dispatch({ type: 'CONFIG_SAVE_FINISHED' }) - - if (store.selectIsIpfsDesktop()) { - store.doDesktopIpfsConfigChanged() - } } } diff --git a/src/bundles/experiments.js b/src/bundles/experiments.js index 8a427a4ab..6112928cd 100644 --- a/src/bundles/experiments.js +++ b/src/bundles/experiments.js @@ -7,26 +7,7 @@ export const ACTIONS = { EXP_UPDATE_STATE: 'EXPERIMENTS_UPDATE_STATE' } -const EXPERIMENTS = [ - { - key: 'npmOnIpfs', - actionUrls: [ - { - url: 'https://github.com/ipfs-shipyard/npm-on-ipfs', - key: 'readMoreUrl' - }, - { - url: 'https://github.com/ipfs-shipyard/npm-on-ipfs/issues', - key: 'issueUrl' - }, - { - url: 'https://github.com/ipfs-shipyard/ipfs-desktop/issues/957', - key: 'feedbackUrl' - } - ], - desktopOnly: true - } -] +const EXPERIMENTS = [] const mergeState = (state, payload) => Object.keys(payload).reduce( @@ -114,10 +95,9 @@ export default { selectExperimentsState: state => state.experiments, selectExperiments: createSelector( - 'selectIsIpfsDesktop', 'selectExperimentsState', - (isDesktop, state) => - EXPERIMENTS.filter(e => !!e.desktopOnly === isDesktop).map(e => ({ + (state) => + EXPERIMENTS.map(e => ({ ...e, ...state[e.key] })) diff --git a/src/bundles/ipfs-desktop.js b/src/bundles/ipfs-desktop.js index 21efbd940..25f52619e 100644 --- a/src/bundles/ipfs-desktop.js +++ b/src/bundles/ipfs-desktop.js @@ -1,11 +1,3 @@ -import { ACTIONS as EXP_ACTIONS } from './experiments' - -export const ACTIONS = { - SETTING_TOGGLE_STARTED: 'DESKTOP_SETTING_TOGGLE_STARTED', - SETTING_TOGGLE_FINISHED: 'DESKTOP_SETTING_TOGGLE_FINISHED', - SETTING_TOGGLE_FAILED: 'DESKTOP_SETTING_TOGGLE_FAILED' -} - let bundle = { name: 'ipfsDesktop', reducer: (state = {}) => state, @@ -16,88 +8,12 @@ let bundle = { if (window.ipfsDesktop) { bundle = { ...bundle, - reducer: (state = {}, action) => { - if (action.type === EXP_ACTIONS.EXP_TOGGLE_STARTED) { - window.ipfsDesktop.toggleSetting(`experiments.${action.payload.key}`) - } - - if (!action.type.startsWith('DESKTOP_')) { - return state - } - - if (action.type === 'DESKTOP_SETTINGS_CHANGED') { - return action.payload - } - - return state - }, - - selectDesktopSettings: state => state.ipfsDesktop, - - selectDesktopPlatform: state => state.ipfsDesktop.platform, - selectDesktopVersion: () => window.ipfsDesktop.version, selectDesktopCountlyDeviceId: () => window.ipfsDesktop.countlyDeviceId, selectDesktopCountlyActions: () => window.ipfsDesktop.countlyActions, - doDesktopStartListening: () => async ({ dispatch, store }) => { - window.ipfsDesktop.onConfigChanged(({ platform, config, changed, success }) => { - const prevConfig = store.selectDesktopSettings() - - if (Object.keys(prevConfig).length === 0) { - dispatch({ - type: EXP_ACTIONS.EXP_UPDATE_STATE, - payload: Object.keys(config.experiments).reduce( - (all, key) => ({ - ...all, - [key]: { - enabled: config.experiments[key] - } - }), - {} - ) - }) - } - - if (changed) { - const isExperiment = changed.startsWith('experiments.') - const key = isExperiment - ? changed.replace('experiments.', '') - : changed - - const type = isExperiment - ? success - ? EXP_ACTIONS.EXP_TOGGLE_FINISHED - : EXP_ACTIONS.EXP_TOGGLE_FAILED - : success - ? ACTIONS.SETTING_TOGGLE_FINISHED - : ACTIONS.SETTING_TOGGLE_FAILED - - const value = isExperiment - ? config.experiments[key] - : config[key] - - dispatch({ type, payload: { key, value } }) - } - - dispatch({ - type: 'DESKTOP_SETTINGS_CHANGED', - payload: config ? { ...config, platform } : undefined - }) - }) - }, - - doDesktopSettingsToggle: setting => ({ dispatch }) => { - dispatch({ type: ACTIONS.SETTING_TOGGLE_STARTED, payload: { key: setting } }) - window.ipfsDesktop.toggleSetting(setting) - }, - - doDesktopIpfsConfigChanged: () => () => { - window.ipfsDesktop.configHasChanged() - }, - doDesktopSelectDirectory: () => () => { return window.ipfsDesktop.selectDirectory() }, @@ -108,10 +24,6 @@ if (window.ipfsDesktop) { doDesktopRemoveConsent: consent => () => { return window.ipfsDesktop.removeConsent(consent) - }, - - init: store => { - store.doDesktopStartListening() } } } diff --git a/src/bundles/notify.js b/src/bundles/notify.js index f02d53e12..24c650a05 100644 --- a/src/bundles/notify.js +++ b/src/bundles/notify.js @@ -1,7 +1,6 @@ import { createSelector } from 'redux-bundler' import { ACTIONS as EXP_ACTIONS } from './experiments' import { ACTIONS as FILES_ACTIONS } from './files' -import { ACTIONS as DESK_ACTIONS } from './ipfs-desktop' /* # Notify @@ -71,15 +70,6 @@ const notify = { } } - if (action.type === DESK_ACTIONS.SETTING_TOGGLE_FAILED) { - return { - ...state, - show: true, - error: true, - eventId: `desktopToggleErrors.${action.payload.key}` - } - } - return state }, diff --git a/src/settings/DesktopSettings.js b/src/settings/DesktopSettings.js deleted file mode 100644 index 86202152a..000000000 --- a/src/settings/DesktopSettings.js +++ /dev/null @@ -1,94 +0,0 @@ -import React from 'react' -import { connect } from 'redux-bundler-react' -import { withTranslation, Trans } from 'react-i18next' -import Box from '../components/box/Box' -import Checkbox from '../components/checkbox/Checkbox' -import Title from './Title' - -const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0 - -const keys = { - option: '⌥ option', - cmd: '⌘ command', - ctrlMac: '⌃ control', - alt: 'ALT', - ctrl: 'CTRL' -} - -const CheckboxSetting = ({ children, title, ...props }) => ( -
-
-
- -
-

{title}

-
- -

- {children} -

-
-) - -const Key = ({ children }) => { children } - -export function DesktopSettings ({ t, doDesktopSettingsToggle, desktopSettings, desktopPlatform }) { - return ( - - {t('ipfsDesktop')} - - doDesktopSettingsToggle('autoLaunch')} /> - doDesktopSettingsToggle('ipfsOnPath')}> - 0, 0, 0, 0]} /> - - -

{t('globalShortcuts')}

-

{t('globalShortcutsAre')}

- - doDesktopSettingsToggle('screenshotShortcut')}> - 0, 0, 0, 0]} /> - - doDesktopSettingsToggle('downloadHashShortcut')}> - 0, 0, 0, 0]} /> - -
- ) -} - -export const TranslatedDesktopSettings = withTranslation('settings')(DesktopSettings) - -export default connect( - 'selectDesktopSettings', - 'selectDesktopPlatform', - 'doDesktopSettingsToggle', - TranslatedDesktopSettings -) diff --git a/src/settings/SettingsPage.js b/src/settings/SettingsPage.js index 3a8c16d01..398e822fb 100644 --- a/src/settings/SettingsPage.js +++ b/src/settings/SettingsPage.js @@ -14,7 +14,6 @@ import Button from '../components/button/Button' import LanguageSelector from '../components/language-selector/LanguageSelector' import AnalyticsToggle from '../components/analytics-toggle/AnalyticsToggle' import JsonEditor from './editor/JsonEditor' -import DesktopSettings from './DesktopSettings' import Experiments from '../components/experiments/ExperimentsPanel' import Title from './Title' @@ -23,7 +22,7 @@ const PAUSE_AFTER_SAVE_MS = 3000 export const SettingsPage = ({ t, tReady, isIpfsConnected, isConfigBlocked, isLoading, isSaving, - hasSaveFailed, hasSaveSucceded, hasErrors, hasLocalChanges, hasExternalChanges, isIpfsDesktop, + hasSaveFailed, hasSaveSucceded, hasErrors, hasLocalChanges, hasExternalChanges, config, onChange, onReset, onSave, editorKey, analyticsEnabled, doToggleAnalytics, toursEnabled, handleJoyrideCallback }) => ( @@ -32,8 +31,6 @@ export const SettingsPage = ({ {t('title')} - IPFS - { isIpfsDesktop && } -
{t('language')} diff --git a/src/settings/SettingsPage.stories.js b/src/settings/SettingsPage.stories.js index 20fa730f3..37a764a76 100644 --- a/src/settings/SettingsPage.stories.js +++ b/src/settings/SettingsPage.stories.js @@ -6,7 +6,6 @@ import { withKnobs, boolean } from '@storybook/addon-knobs' import i18n from '../i18n' import { SettingsPage } from './SettingsPage' import i18nDecorator from '../i18n-decorator' -import { TranslatedDesktopSettings as DesktopSettings } from './DesktopSettings' import config from './editor/fixtures/example-config.json' storiesOf('Settings Page', module) @@ -31,14 +30,3 @@ storiesOf('Settings Page', module) onSave={action('save')} />
)) - .add('Desktop Settings', () => ( -
- -
- ))