// @flow 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 } from 'component/common/form'; import Button from 'component/button'; import Page from 'component/page'; import SettingAccount from 'component/settingAccount'; import SettingAppearance from 'component/settingAppearance'; import SettingSystem from 'component/settingSystem'; import FileSelector from 'component/common/file-selector'; import Card from 'component/common/card'; import classnames from 'classnames'; import { SIMPLE_SITE } from 'config'; import { Lbryio } from 'lbryinc'; import Yrbl from 'component/yrbl'; import { getStripeEnvironment } from 'util/stripe'; type Price = { currency: string, amount: number, }; type SetDaemonSettingArg = boolean | string | number; type DaemonSettings = { download_dir: string, share_usage_data: boolean, }; type Props = { setDaemonSetting: (string, ?SetDaemonSettingArg) => void, clearDaemonSetting: (string) => void, setClientSetting: (string, SetDaemonSettingArg) => void, toggle3PAnalytics: (boolean) => void, daemonSettings: DaemonSettings, allowAnalytics: boolean, showNsfw: boolean, isAuthenticated: boolean, instantPurchaseEnabled: boolean, instantPurchaseMax: Price, autoplay: boolean, floatingPlayer: boolean, hideReposts: ?boolean, clearPlayingUri: () => void, openModal: (string) => void, enterSettings: () => void, exitSettings: () => void, myChannelUrls: ?Array, user: User, }; class SettingsPage extends React.PureComponent { componentDidMount() { const { enterSettings } = this.props; enterSettings(); } componentWillUnmount() { const { exitSettings } = this.props; exitSettings(); } setDaemonSetting(name: string, value: ?SetDaemonSettingArg): void { this.props.setDaemonSetting(name, value); } clearDaemonSetting(name: string): void { this.props.clearDaemonSetting(name); } render() { const { daemonSettings, allowAnalytics, showNsfw, isAuthenticated, autoplay, // autoDownload, setDaemonSetting, setClientSetting, toggle3PAnalytics, floatingPlayer, hideReposts, clearPlayingUri, openModal, myChannelUrls, user, } = this.props; const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0; const newStyle = true; return newStyle ? ( ) : ( {!isAuthenticated && IS_WEB && (
} /> )} {!IS_WEB && noDaemonSettings ? (
{__('Failed to load settings.')}
) : (
{/* @if TARGET='app' */} { setDaemonSetting('download_dir', newDirectory.path); }} />

{__('LBRY downloads will be saved here.')}

} /> {/* @endif */} { setClientSetting(SETTINGS.FLOATING_PLAYER, !floatingPlayer); clearPlayingUri(); }} checked={floatingPlayer} label={__('Floating video player')} helper={__('Keep content playing in the corner when navigating to a different page.')} /> setClientSetting(SETTINGS.AUTOPLAY, !autoplay)} checked={autoplay} label={__('Autoplay media files')} helper={__( 'Autoplay video and audio files when navigating to a file, as well as the next related item when a file finishes playing.' )} /> {!SIMPLE_SITE && ( <> { if (isAuthenticated) { let param = e.target.checked ? { add: 'noreposts' } : { remove: 'noreposts' }; Lbryio.call('user_tag', 'edit', param); } setClientSetting(SETTINGS.HIDE_REPOSTS, !hideReposts); }} checked={hideReposts} label={__('Hide reposts')} helper={__( 'You will not see reposts by people you follow or receive email notifying about them.' )} /> {/* setClientSetting(SETTINGS.SHOW_ANONYMOUS, !showAnonymous)} checked={showAnonymous} label={__('Show anonymous content')} helper={__('Anonymous content is published without a channel.')} /> */} !IS_WEB || showNsfw ? setClientSetting(SETTINGS.SHOW_MATURE, !showNsfw) : openModal(MODALS.CONFIRM_AGE) } checked={showNsfw} label={__('Show mature content')} helper={__( 'Mature content may include nudity, intense sexuality, profanity, or other adult content. By displaying mature content, you are affirming you are of legal age to view mature content in your country or jurisdiction. ' )} /> )} } /> {/* @if TARGET='app' */} {__( `This is information like error logging, performance tracking, and usage statistics. It includes your IP address and basic system details, but no other identifying information (unless you sign in to lbry.tv)` )}{' '}
} /> )} {/* @endif */} {/* @if TARGET='web' */} {isAuthenticated && getStripeEnvironment() && (