diff --git a/static/app-strings.json b/static/app-strings.json index fb7124da6..b153fbec6 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -916,6 +916,17 @@ "Loading 3D model.": "Loading 3D model.", "Click here": "Click here", "PDF opened externally. %click_here% to open it again.": "PDF opened externally. %click_here% to open it again.", + "Wallet Server": "Wallet Server", + "lbry.tv wallet servers": "lbry.tv wallet servers", + "Custom wallet servers": "Custom wallet servers", + "Choose a different provider's wallet server.": "Choose a different provider's wallet server.", + "Host": "Host", + "Port": "Port", + "Available": "Available", + "Unable to load your saved preferences.": "Unable to load your saved preferences.", + "Add/Delete": "Add/Delete", + "The wallet server took a bit too long. Resetting defaults just in case.": "The wallet server took a bit too long. Resetting defaults just in case.", + "PDF opened externally. %click_here% to open it again.": "PDF opened externally. %click_here% to open it again.", "%numberOfMonthsSincePublish% years ago": "%numberOfMonthsSincePublish% years ago", "%numberOfYearsSincePublish% years ago": "%numberOfYearsSincePublish% years ago", "%numberOfYearsSincePublish% year ago": "%numberOfYearsSincePublish% year ago", @@ -925,4 +936,4 @@ "%numberOfMonthsSincePublish% months ago": "%numberOfMonthsSincePublish% months ago", "%numberOfDaysSincePublish% months ago": "%numberOfDaysSincePublish% months ago", "%numberOfDaysSincePublish% days ago": "%numberOfDaysSincePublish% days ago" -} \ No newline at end of file +} diff --git a/ui/component/app/index.js b/ui/component/app/index.js index 0ffc13033..33cc17d4a 100644 --- a/ui/component/app/index.js +++ b/ui/component/app/index.js @@ -6,7 +6,7 @@ import { doFetchTransactions, doFetchChannelListMine } from 'lbry-redux'; import { makeSelectClientSetting, selectLoadedLanguages, selectThemePath } from 'redux/selectors/settings'; import { selectIsUpgradeAvailable, selectAutoUpdateDownloaded } from 'redux/selectors/app'; import { doSetLanguage } from 'redux/actions/settings'; -import { doDownloadUpgradeRequested, doSignIn, doSyncWithPreferences } from 'redux/actions/app'; +import { doDownloadUpgradeRequested, doSignIn, doSyncWithPreferences, doGetAndPopulatePreferences } from 'redux/actions/app'; import App from './view'; const select = state => ({ @@ -30,6 +30,7 @@ const perform = dispatch => ({ signIn: () => dispatch(doSignIn()), requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()), checkSync: () => dispatch(doSyncWithPreferences()), + updatePreferences: () => dispatch(doGetAndPopulatePreferences()), }); export default hot( diff --git a/ui/component/app/view.jsx b/ui/component/app/view.jsx index 14e51631e..de6b220c3 100644 --- a/ui/component/app/view.jsx +++ b/ui/component/app/view.jsx @@ -46,6 +46,7 @@ type Props = { isUpgradeAvailable: boolean, autoUpdateDownloaded: boolean, checkSync: () => void, + updatePreferences: () => void, syncEnabled: boolean, uploadCount: number, balance: ?number, @@ -73,6 +74,7 @@ function App(props: Props) { language, languages, setLanguage, + updatePreferences, } = props; const appRef = useRef(); @@ -168,6 +170,12 @@ function App(props: Props) { } }, [hasVerifiedEmail, syncEnabled, checkSync]); + useEffect(() => { + if (hasVerifiedEmail === false) { + updatePreferences(); + } + }, [hasVerifiedEmail]); + useEffect(() => { if (syncError) { history.push(`/$/${PAGES.AUTH}?redirect=${pathname}`); diff --git a/ui/component/settingWalletServer/index.js b/ui/component/settingWalletServer/index.js new file mode 100644 index 000000000..79d9e4b19 --- /dev/null +++ b/ui/component/settingWalletServer/index.js @@ -0,0 +1,24 @@ +import { connect } from 'react-redux'; +import { DAEMON_SETTINGS } from 'lbry-redux'; +import { doSetDaemonSetting, doClearDaemonSetting, doGetDaemonStatus, doCacheCustomWalletServers, doFetchDaemonSettings } from 'redux/actions/settings'; +import { selectDaemonSettings, selectCachedWalletServers, makeSelectSharedPrefsForKey } from 'redux/selectors/settings'; +import SettingWalletServer from './view'; + +const select = state => ({ + daemonSettings: selectDaemonSettings(state), + customServers: selectCachedWalletServers(state), + serverPrefs: makeSelectSharedPrefsForKey(DAEMON_SETTINGS.LBRYUM_SERVERS)(state), +}); + +const perform = dispatch => ({ + setWalletServers: (value) => dispatch(doSetDaemonSetting(DAEMON_SETTINGS.LBRYUM_SERVERS, value)), + clearWalletServers: () => dispatch(doClearDaemonSetting(DAEMON_SETTINGS.LBRYUM_SERVERS)), + getDaemonStatus: () => dispatch(doGetDaemonStatus()), + saveServers: (servers) => dispatch(doCacheCustomWalletServers(servers)), + fetchDaemonSettings: () => dispatch(doFetchDaemonSettings()), +}); + +export default connect( + select, + perform +)(SettingWalletServer); diff --git a/ui/component/settingWalletServer/internal/displayRow.jsx b/ui/component/settingWalletServer/internal/displayRow.jsx new file mode 100644 index 000000000..da17294d8 --- /dev/null +++ b/ui/component/settingWalletServer/internal/displayRow.jsx @@ -0,0 +1,35 @@ +// @flow +import * as ICONS from 'constants/icons'; +import React from 'react'; +import Button from 'component/button'; +import Icon from 'component/common/icon'; + +type Props = { + host: string, + port: string, + available: boolean, + index: number, + remove: number => void, +}; + +function ServerDisplayRow(props: Props) { + const { host, port, available, index, remove } = props; + return ( + + + {host} + + + {port} + + + {available && } + + +