diff --git a/static/app-strings.json b/static/app-strings.json index 52578ed12..fa79d49ed 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -1269,5 +1269,9 @@ "These changes will appear shortly.": "These changes will appear shortly.", "Block Channel": "Block Channel", "Manage Notifications": "Manage Notifications", + "Uploads": "Uploads", + "Advanced Settings": "Advanced Settings", + "Browse": "Browse", + "Automatic Transcoding": "Automatic Transcoding", "--end--": "--end--" } diff --git a/ui/component/router/view.jsx b/ui/component/router/view.jsx index bb76941f5..b17de37ed 100644 --- a/ui/component/router/view.jsx +++ b/ui/component/router/view.jsx @@ -4,6 +4,7 @@ import React, { useEffect } from 'react'; import { Route, Redirect, Switch, withRouter } from 'react-router-dom'; import SettingsPage from 'page/settings'; import SettingsNotificationsPage from 'page/settingsNotifications'; +import SettingsAdvancedPage from 'page/settingsAdvanced'; import HelpPage from 'page/help'; // @if TARGET='app' import BackupPage from 'page/backup'; @@ -204,6 +205,7 @@ function AppRouter(props: Props) { + diff --git a/ui/constants/pages.js b/ui/constants/pages.js index 173969336..4a66d9759 100644 --- a/ui/constants/pages.js +++ b/ui/constants/pages.js @@ -21,6 +21,7 @@ exports.REWARDS_VERIFY = 'rewards/verify'; exports.SEND = 'send'; exports.SETTINGS = 'settings'; exports.SETTINGS_NOTIFICATIONS = 'settings/notifications'; +exports.SETTINGS_ADVANCED = 'settings/advanced'; exports.SHOW = 'show'; exports.ACCOUNT = 'account'; exports.SEARCH = 'search'; diff --git a/ui/page/settings/index.js b/ui/page/settings/index.js index dcf13a0f5..37101bd1a 100644 --- a/ui/page/settings/index.js +++ b/ui/page/settings/index.js @@ -1,28 +1,15 @@ import { connect } from 'react-redux'; -import { - doClearCache, - doNotifyEncryptWallet, - doNotifyDecryptWallet, - doNotifyForgetPassword, - doToggle3PAnalytics, - doOpenModal, -} from 'redux/actions/app'; +import { doClearCache, doNotifyForgetPassword, doToggle3PAnalytics, doOpenModal } from 'redux/actions/app'; import { selectAllowAnalytics } from 'redux/selectors/app'; import { doSetDaemonSetting, doClearDaemonSetting, doSetClientSetting, doSetDarkTime, - doFindFFmpeg, doSyncClientSettings, } from 'redux/actions/settings'; import { doSetPlayingUri } from 'redux/actions/content'; -import { - makeSelectClientSetting, - selectDaemonSettings, - selectFfmpegStatus, - selectFindingFFmpeg, -} from 'redux/selectors/settings'; +import { makeSelectClientSetting, selectDaemonSettings } from 'redux/selectors/settings'; import { doWalletStatus, selectWalletIsEncrypted, SETTINGS } from 'lbry-redux'; import { selectBlockedChannelsCount } from 'redux/selectors/blocked'; import SettingsPage from './view'; @@ -33,8 +20,6 @@ const select = state => ({ allowAnalytics: selectAllowAnalytics(state), isAuthenticated: selectUserVerifiedEmail(state), showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state), - instantPurchaseEnabled: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED)(state), - instantPurchaseMax: makeSelectClientSetting(SETTINGS.INSTANT_PURCHASE_MAX)(state), currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state), themes: makeSelectClientSetting(SETTINGS.THEMES)(state), automaticDarkModeEnabled: makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED)(state), @@ -46,8 +31,6 @@ const select = state => ({ floatingPlayer: makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state), hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state), darkModeTimes: makeSelectClientSetting(SETTINGS.DARK_MODE_TIMES)(state), - ffmpegStatus: selectFfmpegStatus(state), - findingFFmpeg: selectFindingFFmpeg(state), language: makeSelectClientSetting(SETTINGS.LANGUAGE)(state), syncEnabled: makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state), }); @@ -59,13 +42,10 @@ const perform = dispatch => ({ toggle3PAnalytics: allow => dispatch(doToggle3PAnalytics(allow)), clearCache: () => dispatch(doClearCache()), setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)), - encryptWallet: () => dispatch(doNotifyEncryptWallet()), - decryptWallet: () => dispatch(doNotifyDecryptWallet()), updateWalletStatus: () => dispatch(doWalletStatus()), confirmForgetPassword: modalProps => dispatch(doNotifyForgetPassword(modalProps)), clearPlayingUri: () => dispatch(doSetPlayingUri(null)), setDarkTime: (time, options) => dispatch(doSetDarkTime(time, options)), - findFFmpeg: () => dispatch(doFindFFmpeg()), openModal: (id, params) => dispatch(doOpenModal(id, params)), }); diff --git a/ui/page/settings/view.jsx b/ui/page/settings/view.jsx index bcbd20325..f19dbb09d 100644 --- a/ui/page/settings/view.jsx +++ b/ui/page/settings/view.jsx @@ -1,39 +1,27 @@ // @flow -/* eslint react/no-unescaped-entities:0 */ -/* eslint react/jsx-no-comment-textnodes:0 */ - import * as PAGES from 'constants/pages'; import * as MODALS from 'constants/modal_types'; import * as ICONS from 'constants/icons'; import * as React from 'react'; +import { SETTINGS } from 'lbry-redux'; -import { FormField, FormFieldPrice } from 'component/common/form'; +import { FormField } from 'component/common/form'; import Button from 'component/button'; -import I18nMessage from 'component/i18nMessage'; import Page from 'component/page'; import SettingLanguage from 'component/settingLanguage'; -import SettingWalletServer from 'component/settingWalletServer'; -import SettingAutoLaunch from 'component/settingAutoLaunch'; import FileSelector from 'component/common/file-selector'; import SyncToggle from 'component/syncToggle'; -import { SETTINGS } from 'lbry-redux'; import Card from 'component/common/card'; -import { getPasswordFromCookie } from 'util/saved-passwords'; -import Spinner from 'component/spinner'; import SettingAccountPassword from 'component/settingAccountPassword'; +import { getPasswordFromCookie } from 'util/saved-passwords'; import { Lbryio } from 'lbryinc'; -import { withRouter } from 'react-router-dom'; - -// @if TARGET='app' -export const IS_MAC = process.platform === 'darwin'; -// @endif type Price = { currency: string, amount: number, }; -type SetDaemonSettingArg = boolean | string | number | Price; +type SetDaemonSettingArg = boolean | string | number; type DarkModeTimes = { from: { hour: string, min: string, formattedTime: string }, @@ -48,11 +36,6 @@ type OptionTimes = { type DaemonSettings = { download_dir: string, share_usage_data: boolean, - max_key_fee?: Price, - max_connections_per_download?: number, - save_files: boolean, - save_blobs: boolean, - ffmpeg_path: string, }; type Props = { @@ -71,25 +54,17 @@ type Props = { themes: Array, automaticDarkModeEnabled: boolean, autoplay: boolean, - // autoDownload: boolean, - encryptWallet: () => void, - decryptWallet: () => void, updateWalletStatus: () => void, walletEncrypted: boolean, userBlockedChannelsCount?: number, - hideBalance: boolean, confirmForgetPassword: ({}) => void, floatingPlayer: boolean, hideReposts: ?boolean, clearPlayingUri: () => void, darkModeTimes: DarkModeTimes, setDarkTime: (string, {}) => void, - ffmpegStatus: { available: boolean, which: string }, - findingFFmpeg: boolean, - findFFmpeg: () => void, openModal: string => void, language?: string, - history: { goBack: () => void }, syncEnabled: boolean, syncSettings: () => void, }; @@ -108,10 +83,6 @@ class SettingsPage extends React.PureComponent { storedPassword: false, }; - (this: any).onKeyFeeChange = this.onKeyFeeChange.bind(this); - (this: any).onMaxConnectionsChange = this.onMaxConnectionsChange.bind(this); - (this: any).onKeyFeeDisableChange = this.onKeyFeeDisableChange.bind(this); - (this: any).onInstantPurchaseMaxChange = this.onInstantPurchaseMaxChange.bind(this); (this: any).onThemeChange = this.onThemeChange.bind(this); (this: any).onAutomaticDarkModeChange = this.onAutomaticDarkModeChange.bind(this); (this: any).onChangeTime = this.onChangeTime.bind(this); @@ -120,17 +91,8 @@ class SettingsPage extends React.PureComponent { } componentDidMount() { - const { isAuthenticated, ffmpegStatus, daemonSettings, findFFmpeg } = this.props; - // @if TARGET='app' - const { available } = ffmpegStatus; - const { ffmpeg_path: ffmpegPath } = daemonSettings; - if (!available) { - if (ffmpegPath) { - this.clearDaemonSetting('ffmpeg_path'); - } - findFFmpeg(); - } - // @endif + const { isAuthenticated } = this.props; + if (isAuthenticated || !IS_WEB) { this.props.updateWalletStatus(); getPasswordFromCookie().then(p => { @@ -149,24 +111,6 @@ class SettingsPage extends React.PureComponent { } } - onFFmpegFolder(path: string) { - this.setDaemonSetting('ffmpeg_path', path); - this.findFFmpeg(); - } - - onKeyFeeChange(newValue: Price) { - this.setDaemonSetting('max_key_fee', newValue); - } - - onMaxConnectionsChange(event: SyntheticInputEvent<*>) { - const { value } = event.target; - this.setDaemonSetting('max_connections_per_download', value); - } - - onKeyFeeDisableChange(isDisabled: boolean) { - if (isDisabled) this.setDaemonSetting('max_key_fee'); - } - onThemeChange(event: SyntheticInputEvent<*>) { const { value } = event.target; @@ -181,23 +125,6 @@ class SettingsPage extends React.PureComponent { this.props.setClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED, value); } - onInstantPurchaseEnabledChange(enabled: boolean) { - this.props.setClientSetting(SETTINGS.INSTANT_PURCHASE_ENABLED, enabled); - } - - onInstantPurchaseMaxChange(newValue: Price) { - this.props.setClientSetting(SETTINGS.INSTANT_PURCHASE_MAX, newValue); - } - - onChangeEncryptWallet() { - const { decryptWallet, walletEncrypted, encryptWallet } = this.props; - if (walletEncrypted) { - decryptWallet(); - } else { - encryptWallet(); - } - } - onConfirmForgetPassword() { const { confirmForgetPassword } = this.props; confirmForgetPassword({ @@ -229,18 +156,11 @@ class SettingsPage extends React.PureComponent { this.props.clearDaemonSetting(name); } - findFFmpeg(): void { - this.props.findFFmpeg(); - } - render() { const { daemonSettings, - ffmpegStatus, allowAnalytics, showNsfw, - instantPurchaseEnabled, - instantPurchaseMax, isAuthenticated, currentTheme, themes, @@ -251,26 +171,16 @@ class SettingsPage extends React.PureComponent { setDaemonSetting, setClientSetting, toggle3PAnalytics, - hideBalance, userBlockedChannelsCount, floatingPlayer, hideReposts, clearPlayingUri, darkModeTimes, clearCache, - findingFFmpeg, openModal, - language, } = this.props; const { storedPassword } = this.state; const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0; - // @if TARGET='app' - const { available: ffmpegAvailable, which: ffmpegPath } = ffmpegStatus; - // @endif - const defaultMaxKeyFee = { currency: 'USD', amount: 50 }; - - const disableMaxKeyFee = !(daemonSettings && daemonSettings.max_key_fee); - const connectionOptions = [1, 2, 4, 6, 10, 20]; const startHours = ['18', '19', '20', '21']; const endHours = ['5', '6', '7', '8']; @@ -294,15 +204,6 @@ class SettingsPage extends React.PureComponent { } /> {isAuthenticated && } {/* @if TARGET='app' */} - } - /> { } /> - - setDaemonSetting('save_files', !daemonSettings.save_files)} - checked={daemonSettings.save_files} - label={__('Save all viewed content to your downloads directory')} - helper={__( - 'Paid content and some file types are saved by default. Changing this setting will not affect previously downloaded content.' - )} - /> - - setDaemonSetting('save_blobs', !daemonSettings.save_blobs)} - checked={daemonSettings.save_blobs} - label={__('Save hosting data to help the LBRY network')} - helper={ - - {__("If disabled, LBRY will be very sad and you won't be helping improve the network.")}{' '} -