fix sync becoming untoggled
This commit is contained in:
parent
a3b3a204b0
commit
d7c0f5c6b7
6 changed files with 11 additions and 14 deletions
|
@ -6,7 +6,6 @@ import { doFetchTransactions, doFetchChannelListMine, selectBalance } from 'lbry
|
|||
import { makeSelectClientSetting, selectThemePath } from 'redux/selectors/settings';
|
||||
import { selectIsUpgradeAvailable, selectAutoUpdateDownloaded } from 'redux/selectors/app';
|
||||
import { doDownloadUpgradeRequested, doSignIn, doSyncWithPreferences } from 'redux/actions/app';
|
||||
import { doSetClientSetting } from 'redux/actions/settings';
|
||||
import App from './view';
|
||||
|
||||
const select = state => ({
|
||||
|
@ -28,7 +27,6 @@ const perform = dispatch => ({
|
|||
signIn: () => dispatch(doSignIn()),
|
||||
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
|
||||
checkSync: () => dispatch(doSyncWithPreferences()),
|
||||
setSyncEnabled: value => dispatch(doSetClientSetting(SETTINGS.ENABLE_SYNC, value)),
|
||||
});
|
||||
|
||||
export default hot(
|
||||
|
|
|
@ -40,7 +40,6 @@ type Props = {
|
|||
isUpgradeAvailable: boolean,
|
||||
autoUpdateDownloaded: boolean,
|
||||
checkSync: () => void,
|
||||
setSyncEnabled: boolean => void,
|
||||
syncEnabled: boolean,
|
||||
};
|
||||
|
||||
|
@ -59,7 +58,6 @@ function App(props: Props) {
|
|||
requestDownloadUpgrade,
|
||||
syncEnabled,
|
||||
checkSync,
|
||||
setSyncEnabled,
|
||||
} = props;
|
||||
const appRef = useRef();
|
||||
const isEnhancedLayout = useKonamiListener();
|
||||
|
@ -126,9 +124,7 @@ function App(props: Props) {
|
|||
}, [hasVerifiedEmail, signIn, hasSignedIn]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!hasVerifiedEmail && syncEnabled) {
|
||||
setSyncEnabled(false);
|
||||
} else if (hasVerifiedEmail && syncEnabled) {
|
||||
if (userId && hasVerifiedEmail && syncEnabled) {
|
||||
checkSync();
|
||||
|
||||
let syncInterval = setInterval(() => {
|
||||
|
@ -139,7 +135,7 @@ function App(props: Props) {
|
|||
clearInterval(syncInterval);
|
||||
};
|
||||
}
|
||||
}, [hasVerifiedEmail, syncEnabled, checkSync, setSyncEnabled]);
|
||||
}, [hasVerifiedEmail, syncEnabled, checkSync, userId]);
|
||||
|
||||
if (!user) {
|
||||
return null;
|
||||
|
|
|
@ -22,7 +22,7 @@ export default function Card(props: Props) {
|
|||
{icon && <Icon sectionIcon icon={icon} />}
|
||||
<div>
|
||||
<h2 className="section__title">{title}</h2>
|
||||
<p className="section__subtitle">{subtitle}</p>
|
||||
<div className="section__subtitle">{subtitle}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -11,7 +11,7 @@ type Props = {
|
|||
|
||||
function SyncToggle(props: Props) {
|
||||
const { setSyncEnabled, syncEnabled, verifiedEmail } = props;
|
||||
|
||||
console.log('??', syncEnabled);
|
||||
function handleChange() {
|
||||
setSyncEnabled(!syncEnabled);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ const WalletBalance = (props: Props) => {
|
|||
<strong>
|
||||
<CreditAmount badge={false} amount={tipsBalance} precision={8} />
|
||||
</strong>{' '}
|
||||
{__('Earned and bound in tips')}
|
||||
{__('earned and bound in tips')}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -50,7 +50,10 @@ const WalletBalance = (props: Props) => {
|
|||
<Icon sectionIcon icon={ICONS.LOCK} />
|
||||
<div>
|
||||
<h2 className="section__title--small">
|
||||
<strong>{(claimsBalance + supportsBalance).toFixed(2)}</strong> {__('LBC Currently Staked')}
|
||||
<strong>
|
||||
<CreditAmount badge={false} amount={claimsBalance + supportsBalance} precision={8} />
|
||||
</strong>{' '}
|
||||
{__('currently staked')}
|
||||
</h2>
|
||||
<div className="section__subtitle">
|
||||
<dl>
|
||||
|
|
|
@ -641,11 +641,11 @@ class SettingsPage extends React.PureComponent<Props, State> {
|
|||
<Card
|
||||
title={__('Application Cache')}
|
||||
subtitle={
|
||||
<span className="card__subtitle--status">
|
||||
<p className="card__subtitle--status">
|
||||
{__(
|
||||
'This will clear the application cache. Your wallet will not be affected. Currently, followed tags and blocked channels will be cleared.'
|
||||
)}
|
||||
</span>
|
||||
</p>
|
||||
}
|
||||
actions={
|
||||
<Button
|
||||
|
|
Loading…
Reference in a new issue