mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-29 08:21:30 +00:00
set default value of 'enableSync' to false for exisiting users
This commit is contained in:
parent
be28a700f3
commit
d74f573763
6 changed files with 23 additions and 8 deletions
|
@ -6,6 +6,7 @@ import { doFetchTransactions, doFetchChannelListMine, selectBalance } from 'lbry
|
||||||
import { makeSelectClientSetting, selectThemePath } from 'redux/selectors/settings';
|
import { makeSelectClientSetting, selectThemePath } from 'redux/selectors/settings';
|
||||||
import { selectIsUpgradeAvailable, selectAutoUpdateDownloaded } from 'redux/selectors/app';
|
import { selectIsUpgradeAvailable, selectAutoUpdateDownloaded } from 'redux/selectors/app';
|
||||||
import { doDownloadUpgradeRequested, doSignIn, doSyncWithPreferences } from 'redux/actions/app';
|
import { doDownloadUpgradeRequested, doSignIn, doSyncWithPreferences } from 'redux/actions/app';
|
||||||
|
import { doSetClientSetting } from 'redux/actions/settings';
|
||||||
import App from './view';
|
import App from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
|
@ -27,6 +28,7 @@ const perform = dispatch => ({
|
||||||
signIn: () => dispatch(doSignIn()),
|
signIn: () => dispatch(doSignIn()),
|
||||||
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
|
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
|
||||||
checkSync: () => dispatch(doSyncWithPreferences()),
|
checkSync: () => dispatch(doSyncWithPreferences()),
|
||||||
|
setSyncEnabled: value => dispatch(doSetClientSetting(SETTINGS.ENABLE_SYNC, value)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default hot(
|
export default hot(
|
||||||
|
|
|
@ -14,6 +14,7 @@ import FileViewer from 'component/fileViewer';
|
||||||
import { withRouter } from 'react-router';
|
import { withRouter } from 'react-router';
|
||||||
import usePrevious from 'effects/use-previous';
|
import usePrevious from 'effects/use-previous';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
import cookie from 'cookie';
|
||||||
|
|
||||||
export const MAIN_WRAPPER_CLASS = 'main-wrapper';
|
export const MAIN_WRAPPER_CLASS = 'main-wrapper';
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
|
@ -21,6 +22,8 @@ export const IS_MAC = process.platform === 'darwin';
|
||||||
// @endif
|
// @endif
|
||||||
const SYNC_INTERVAL = 1000 * 60 * 5; // 5 minutes
|
const SYNC_INTERVAL = 1000 * 60 * 5; // 5 minutes
|
||||||
|
|
||||||
|
const { auth_token: authToken } = cookie.parse(document.cookie);
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
alertError: (string | {}) => void,
|
alertError: (string | {}) => void,
|
||||||
pageTitle: ?string,
|
pageTitle: ?string,
|
||||||
|
@ -40,6 +43,7 @@ type Props = {
|
||||||
isUpgradeAvailable: boolean,
|
isUpgradeAvailable: boolean,
|
||||||
autoUpdateDownloaded: boolean,
|
autoUpdateDownloaded: boolean,
|
||||||
checkSync: () => void,
|
checkSync: () => void,
|
||||||
|
setSyncEnabled: boolean => void,
|
||||||
syncEnabled: boolean,
|
syncEnabled: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,9 +60,11 @@ function App(props: Props) {
|
||||||
autoUpdateDownloaded,
|
autoUpdateDownloaded,
|
||||||
isUpgradeAvailable,
|
isUpgradeAvailable,
|
||||||
requestDownloadUpgrade,
|
requestDownloadUpgrade,
|
||||||
|
setSyncEnabled,
|
||||||
syncEnabled,
|
syncEnabled,
|
||||||
checkSync,
|
checkSync,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const appRef = useRef();
|
const appRef = useRef();
|
||||||
const isEnhancedLayout = useKonamiListener();
|
const isEnhancedLayout = useKonamiListener();
|
||||||
const [hasSignedIn, setHasSignedIn] = useState(false);
|
const [hasSignedIn, setHasSignedIn] = useState(false);
|
||||||
|
@ -77,6 +83,17 @@ function App(props: Props) {
|
||||||
uri = newpath + hash;
|
uri = newpath + hash;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
// This should not be needed and will be removed after 37 is released
|
||||||
|
// We should just be able to default the enableSync setting to true, but we don't want
|
||||||
|
// to automatically opt-in existing users. Only users that go through the new sign in flow
|
||||||
|
// should be automatically opted-in (they choose to uncheck the option and turn off sync still)
|
||||||
|
useEffect(() => {
|
||||||
|
if (!authToken) {
|
||||||
|
setSyncEnabled(true);
|
||||||
|
}
|
||||||
|
// don't pass in any props to this, we only want the initial value
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
ReactModal.setAppElement(appRef.current);
|
ReactModal.setAppElement(appRef.current);
|
||||||
fetchAccessToken();
|
fetchAccessToken();
|
||||||
|
|
|
@ -44,7 +44,7 @@ function SyncToggle(props: Props) {
|
||||||
<FormField
|
<FormField
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
name="sync_toggle"
|
name="sync_toggle"
|
||||||
label={__('Sync your balance and preferences accross LBRY apps.')}
|
label={__('Sync your balance and preferences accross devices.')}
|
||||||
checked={syncEnabled}
|
checked={syncEnabled}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -11,7 +11,7 @@ const defaultState = {
|
||||||
// UX
|
// UX
|
||||||
[SETTINGS.NEW_USER_ACKNOWLEDGED]: false,
|
[SETTINGS.NEW_USER_ACKNOWLEDGED]: false,
|
||||||
[SETTINGS.EMAIL_COLLECTION_ACKNOWLEDGED]: false,
|
[SETTINGS.EMAIL_COLLECTION_ACKNOWLEDGED]: false,
|
||||||
[SETTINGS.ENABLE_SYNC]: true,
|
[SETTINGS.ENABLE_SYNC]: false,
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
[SETTINGS.LANGUAGE]: window.localStorage.getItem(SETTINGS.LANGUAGE) || 'en',
|
[SETTINGS.LANGUAGE]: window.localStorage.getItem(SETTINGS.LANGUAGE) || 'en',
|
||||||
|
|
|
@ -9,7 +9,7 @@ export const setSavedPassword = (value, saveToDisk) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
sessionPassword = value;
|
sessionPassword = value;
|
||||||
if (saveToDisk && value !== undefined && value !== null) {
|
if (saveToDisk && value !== undefined && value !== null && value !== '') {
|
||||||
ipcRenderer.send('set-password', value);
|
ipcRenderer.send('set-password', value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -817,12 +817,8 @@
|
||||||
"Show anonymous content": "Show anonymous content",
|
"Show anonymous content": "Show anonymous content",
|
||||||
"Anonymous content is published without a channel.": "Anonymous content is published without a channel.",
|
"Anonymous content is published without a channel.": "Anonymous content is published without a channel.",
|
||||||
"settings": "settings",
|
"settings": "settings",
|
||||||
"Content may be hidden on this %type% because of your %settings%": "Content may be hidden on this %type% because of your %settings%",
|
|
||||||
"Content may be hidden on this %type% because of your %settings%.": "Content may be hidden on this %type% because of your %settings%.",
|
"Content may be hidden on this %type% because of your %settings%.": "Content may be hidden on this %type% because of your %settings%.",
|
||||||
"Sync balance and preferences across devices.": "Sync balance and preferences across devices.",
|
|
||||||
"By continuing, I agree to the %terms% and confirm I am over the age of 13.": "By continuing, I agree to the %terms% and confirm I am over the age of 13.",
|
|
||||||
"Sync": "Sync",
|
"Sync": "Sync",
|
||||||
"Sync your balance and preferences accross LBRY apps.": "Sync your balance and preferences accross LBRY apps.",
|
|
||||||
"earned and bound in tips": "earned and bound in tips",
|
"earned and bound in tips": "earned and bound in tips",
|
||||||
"currently staked": "currently staked"
|
"currently staked": "currently staked"
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue