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

View file

@ -196,6 +196,7 @@ class SettingsPage extends React.PureComponent<Props, State> {
darkModeTimes,
clearCache,
} = this.props;
const { storedPassword } = this.state;
const noDaemonSettings = !daemonSettings || Object.keys(daemonSettings).length === 0;
@ -215,7 +216,15 @@ class SettingsPage extends React.PureComponent<Props, State> {
) : (
<div>
<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' */}
<Card
title={__('Download Directory')}

View file

@ -829,5 +829,6 @@
"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.",
"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."
}