set default value of 'enableSync' to false for exisiting users

This commit is contained in:
Sean Yesmunt 2019-10-16 13:18:12 -04:00
parent be28a700f3
commit d74f573763
6 changed files with 23 additions and 8 deletions

View file

@ -6,6 +6,7 @@ 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 => ({
@ -27,6 +28,7 @@ const perform = dispatch => ({
signIn: () => dispatch(doSignIn()),
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
checkSync: () => dispatch(doSyncWithPreferences()),
setSyncEnabled: value => dispatch(doSetClientSetting(SETTINGS.ENABLE_SYNC, value)),
});
export default hot(

View file

@ -14,6 +14,7 @@ import FileViewer from 'component/fileViewer';
import { withRouter } from 'react-router';
import usePrevious from 'effects/use-previous';
import Button from 'component/button';
import cookie from 'cookie';
export const MAIN_WRAPPER_CLASS = 'main-wrapper';
// @if TARGET='app'
@ -21,6 +22,8 @@ export const IS_MAC = process.platform === 'darwin';
// @endif
const SYNC_INTERVAL = 1000 * 60 * 5; // 5 minutes
const { auth_token: authToken } = cookie.parse(document.cookie);
type Props = {
alertError: (string | {}) => void,
pageTitle: ?string,
@ -40,6 +43,7 @@ type Props = {
isUpgradeAvailable: boolean,
autoUpdateDownloaded: boolean,
checkSync: () => void,
setSyncEnabled: boolean => void,
syncEnabled: boolean,
};
@ -56,9 +60,11 @@ function App(props: Props) {
autoUpdateDownloaded,
isUpgradeAvailable,
requestDownloadUpgrade,
setSyncEnabled,
syncEnabled,
checkSync,
} = props;
const appRef = useRef();
const isEnhancedLayout = useKonamiListener();
const [hasSignedIn, setHasSignedIn] = useState(false);
@ -77,6 +83,17 @@ function App(props: Props) {
uri = newpath + hash;
} 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(() => {
ReactModal.setAppElement(appRef.current);
fetchAccessToken();

View file

@ -44,7 +44,7 @@ function SyncToggle(props: Props) {
<FormField
type="checkbox"
name="sync_toggle"
label={__('Sync your balance and preferences accross LBRY apps.')}
label={__('Sync your balance and preferences accross devices.')}
checked={syncEnabled}
onChange={handleChange}
/>

View file

@ -11,7 +11,7 @@ const defaultState = {
// UX
[SETTINGS.NEW_USER_ACKNOWLEDGED]: false,
[SETTINGS.EMAIL_COLLECTION_ACKNOWLEDGED]: false,
[SETTINGS.ENABLE_SYNC]: true,
[SETTINGS.ENABLE_SYNC]: false,
// UI
[SETTINGS.LANGUAGE]: window.localStorage.getItem(SETTINGS.LANGUAGE) || 'en',

View file

@ -9,7 +9,7 @@ export const setSavedPassword = (value, saveToDisk) => {
});
sessionPassword = value;
if (saveToDisk && value !== undefined && value !== null) {
if (saveToDisk && value !== undefined && value !== null && value !== '') {
ipcRenderer.send('set-password', value);
}
});

View file

@ -817,12 +817,8 @@
"Show anonymous content": "Show anonymous content",
"Anonymous content is published without a channel.": "Anonymous content is published without a channel.",
"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%.",
"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 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",
"currently staked": "currently staked"
}
}