disable sync for encrypted wallets with no saved password

This commit is contained in:
Sean Yesmunt 2019-10-17 15:15:32 -04:00
parent 973e5f0836
commit 52dd9d269c
3 changed files with 15 additions and 2 deletions

View file

@ -12,6 +12,7 @@ type Props = {
history: { push: string => void }, history: { push: string => void },
location: UrlLocation, location: UrlLocation,
getSyncError: ?string, getSyncError: ?string,
disabled: boolean,
}; };
function SyncToggle(props: Props) { function SyncToggle(props: Props) {
@ -22,6 +23,7 @@ function SyncToggle(props: Props) {
getSyncError, getSyncError,
history, history,
location: { pathname }, location: { pathname },
disabled = false,
} = props; } = props;
function handleChange() { function handleChange() {
@ -47,6 +49,7 @@ function SyncToggle(props: Props) {
label={__('Sync your balance and preferences accross devices.')} label={__('Sync your balance and preferences accross devices.')}
checked={syncEnabled} checked={syncEnabled}
onChange={handleChange} onChange={handleChange}
disabled={disabled}
/> />
)} )}
</div> </div>

View file

@ -196,6 +196,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
darkModeTimes, darkModeTimes,
clearCache, clearCache,
} = this.props; } = this.props;
const { storedPassword } = this.state;
const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0; const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0;
@ -215,7 +216,15 @@ class SettingsPage extends React.PureComponent<Props, State> {
) : ( ) : (
<div> <div>
<Card title={__('Language')} actions={<SettingLanguage />} /> <Card title={__('Language')} actions={<SettingLanguage />} />
<Card title={__('Sync')} actions={<SyncToggle />} /> <Card
title={__('Sync')}
subtitle={
walletEncrypted && !storedPassword
? __("To enable this feature, check 'Save Password' the next time you start the app.")
: null
}
actions={<SyncToggle disabled={walletEncrypted && !storedPassword} />}
/>
{/* @if TARGET='app' */} {/* @if TARGET='app' */}
<Card <Card
title={__('Download Directory')} title={__('Download Directory')}

View file

@ -829,5 +829,6 @@
"Sync your balance and preferences accross devices.": "Sync your balance and preferences accross devices.", "Sync your balance and preferences accross devices.": "Sync your balance and preferences accross devices.",
"%nameOrTitle% has been published to lbry://%name%. Click here to view it.": "%nameOrTitle% has been published to lbry://%name%. Click here to view it.", "%nameOrTitle% has been published to lbry://%name%. Click here to view it.": "%nameOrTitle% has been published to lbry://%name%. Click here to view it.",
"Discussion": "Discussion", "Discussion": "Discussion",
"If you don't choose a file, the file from your existing claim %name% will be used": "If you don't choose a file, the file from your existing claim %name% will be used" "If you don't choose a file, the file from your existing claim %name% will be used": "If you don't choose a file, the file from your existing claim %name% will be used",
"To enable this feature, check 'Save Password' the next time you start the app.": "To enable this feature, check 'Save Password' the next time you start the app."
} }