diff --git a/package.json b/package.json index ca25eb11b..5175995a3 100644 --- a/package.json +++ b/package.json @@ -129,7 +129,7 @@ "json-loader": "^0.5.4", "lbry-format": "https://github.com/lbryio/lbry-format.git", "lbry-redux": "lbryio/lbry-redux#85fe532d69704a283fd2ec640ad6e3b8dacd6d0d", - "lbryinc": "lbryio/lbryinc#44b6373ada13299a0fba1e60ac508f485af75388", + "lbryinc": "lbryio/lbryinc#d1dba98bb6f1dc67bc0db4c0a20fc13b8a0de98b", "lint-staged": "^7.0.2", "localforage": "^1.7.1", "lodash-es": "^4.17.14", diff --git a/src/ui/component/app/index.js b/src/ui/component/app/index.js index a7e13ac13..8788fb428 100644 --- a/src/ui/component/app/index.js +++ b/src/ui/component/app/index.js @@ -2,7 +2,7 @@ import * as SETTINGS from 'constants/settings'; import { hot } from 'react-hot-loader/root'; import { connect } from 'react-redux'; import { selectUser, doRewardList, doFetchRewardedContent, doFetchAccessToken } from 'lbryinc'; -import { doFetchTransactions, doFetchChannelListMine } from 'lbry-redux'; +import { doFetchTransactions, doFetchChannelListMine, selectBalance } from 'lbry-redux'; import { makeSelectClientSetting, selectThemePath } from 'redux/selectors/settings'; import { selectIsUpgradeAvailable, selectAutoUpdateDownloaded } from 'redux/selectors/app'; import { doDownloadUpgradeRequested, doSignIn } from 'redux/actions/app'; @@ -14,6 +14,7 @@ const select = state => ({ language: makeSelectClientSetting(SETTINGS.LANGUAGE)(state), autoUpdateDownloaded: selectAutoUpdateDownloaded(state), isUpgradeAvailable: selectIsUpgradeAvailable(state), + balance: selectBalance(state), }); const perform = dispatch => ({ diff --git a/src/ui/component/app/view.jsx b/src/ui/component/app/view.jsx index 37c02008b..9b2027d3d 100644 --- a/src/ui/component/app/view.jsx +++ b/src/ui/component/app/view.jsx @@ -34,6 +34,7 @@ type Props = { onSignedIn: () => void, isUpgradeAvailable: boolean, autoUpdateDownloaded: boolean, + balance: ?number, }; function App(props: Props) { @@ -49,6 +50,7 @@ function App(props: Props) { autoUpdateDownloaded, isUpgradeAvailable, requestDownloadUpgrade, + balance, } = props; const appRef = useRef(); const isEnhancedLayout = useKonamiListener(); @@ -106,10 +108,10 @@ function App(props: Props) { // Keep this at the end to ensure initial setup effects are run first useEffect(() => { - if (!previousHasVerifiedEmail && hasVerifiedEmail) { + if (hasVerifiedEmail && balance !== undefined) { signIn(); } - }, [previousHasVerifiedEmail, hasVerifiedEmail, signIn]); + }, [hasVerifiedEmail, signIn, balance]); if (!user) { return null; diff --git a/src/ui/component/syncPassword/view.jsx b/src/ui/component/syncPassword/view.jsx index 585dc8164..539bb8c91 100644 --- a/src/ui/component/syncPassword/view.jsx +++ b/src/ui/component/syncPassword/view.jsx @@ -45,7 +45,7 @@ function SyncPassword(props: Props) { onChange={() => setRememberPassword(!rememberPassword)} />
-
} diff --git a/src/ui/component/userSignIn/view.jsx b/src/ui/component/userSignIn/view.jsx index 23831cced..5eede6c02 100644 --- a/src/ui/component/userSignIn/view.jsx +++ b/src/ui/component/userSignIn/view.jsx @@ -112,7 +112,6 @@ function UserSignIn(props: Props) { showEmail && , showEmailVerification && , showUserVerification && , - showSyncPassword && , showChannelCreation && , // @if TARGET='app' showYoutubeTransfer && ( @@ -120,6 +119,7 @@ function UserSignIn(props: Props) { ), + showSyncPassword && , // @endif showLoadingSpinner && (
diff --git a/src/ui/component/walletSecurityAndSync/index.js b/src/ui/component/walletSecurityAndSync/index.js index 9d15f9091..0652588b6 100644 --- a/src/ui/component/walletSecurityAndSync/index.js +++ b/src/ui/component/walletSecurityAndSync/index.js @@ -49,7 +49,7 @@ const perform = dispatch => ({ decryptWallet: () => dispatch(doWalletDecrypt()), updateWalletStatus: () => dispatch(doWalletStatus()), syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)), - getSync: password => dispatch(doGetSync(password)), + getSync: password => dispatch(doGetSync(password, true)), checkSync: () => dispatch(doCheckSync()), setDefaultAccount: () => dispatch(doSetDefaultAccount()), setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)), diff --git a/src/ui/modal/modalWalletUnlock/view.jsx b/src/ui/modal/modalWalletUnlock/view.jsx index 853928dd9..22fb9230e 100644 --- a/src/ui/modal/modalWalletUnlock/view.jsx +++ b/src/ui/modal/modalWalletUnlock/view.jsx @@ -24,10 +24,13 @@ class ModalWalletUnlock extends React.PureComponent { }; componentDidMount() { + const { unlockWallet } = this.props; + getSavedPassword() .then(p => { - if (p) { + if (p !== null) { this.setState({ password: p, rememberPassword: true }); + unlockWallet(p); } }) .catch(); diff --git a/src/ui/redux/actions/app.js b/src/ui/redux/actions/app.js index c6cd36d2c..6b6b87c70 100644 --- a/src/ui/redux/actions/app.js +++ b/src/ui/redux/actions/app.js @@ -37,7 +37,7 @@ import { Lbryio, doAuthenticate, doGetSync, selectSyncHash, doResetSync } from ' import { lbrySettings as config, version as appVersion } from 'package.json'; import { push } from 'connected-react-router'; import analytics from 'analytics'; -import { deleteAuthToken } from 'util/saved-passwords'; +import { deleteAuthToken, getSavedPassword } from 'util/saved-passwords'; import cookie from 'cookie'; import { makeSelectClientSetting } from 'redux/selectors/settings'; @@ -461,16 +461,19 @@ export function doSignIn() { // @if TARGET='app' const state = getState(); const syncEnabled = makeSelectClientSetting(SETTINGS.ENABLE_SYNC)(state); - const syncHash = selectSyncHash(state); + const hasSyncedBefore = selectSyncHash(state); const balance = selectBalance(state); // For existing users, check if they've synced before, or have 0 balance - if (syncEnabled && (syncHash || balance === 0)) { - dispatch(doGetSync()); + if (syncEnabled && (hasSyncedBefore || balance === 0)) { + getSavedPassword().then(password => { + const passwordArgument = password === null ? '' : password; + dispatch(doGetSync(passwordArgument, !hasSyncedBefore)); - setInterval(() => { - dispatch(doGetSync()); - }, 1000 * 60 * 5); + setInterval(() => { + dispatch(doGetSync(passwordArgument)); + }, 1000 * 60 * 5); + }); } // @endif diff --git a/static/app-strings.json b/static/app-strings.json index 5962b61b0..43cd408c9 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -738,5 +738,57 @@ "Earned and bound in tips": "Earned and bound in tips", "LBC Currently Staked": "LBC Currently Staked", "... in your publishes": "... in your publishes", - "... in your supports": "... in your supports" + "... in your supports": "... in your supports", + "Add a tag": "Add a tag", + "Publish something totally wacky and wild.": "Publish something totally wacky and wild.", + "Available Rewards": "Available Rewards", + "Nothing published to LBRY yet.": "Nothing published to LBRY yet.", + "Follow New Tags": "Follow New Tags", + "Sign In": "Sign In", + "Go Back": "Go Back", + "Welcome To LBRY": "Welcome To LBRY", + "Create a new account or sign in.": "Create a new account or sign in.", + "hotstuff_96@hotmail.com": "hotstuff_96@hotmail.com", + "Terms of Service": "Terms of Service", + "Sync balance and preferences across devices": "Sync balance and preferences across devices", + "Learn More": "Learn More", + "I am over the age of 13 and agree to the %terms%.": "I am over the age of 13 and agree to the %terms%.", + "Blockchain expert? %learn_more%": "Blockchain expert? %learn_more%", + "Confirm Your Email": "Confirm Your Email", + "Follow the link to sign in. This will update automatically.": "Follow the link to sign in. This will update automatically.", + "Resend Verification Email": "Resend Verification Email", + "Start Over": "Start Over", + "Your YouTube Channel": "Your YouTube Channel", + "Please check back later.": "Please check back later.", + "here": "here", + "%channelName% is not ready to be transferred. You can check the status %statusLink% or check back later.": "%channelName% is not ready to be transferred. You can check the status %statusLink% or check back later.", + "Enter Your LBRY Password": "Enter Your LBRY Password", + "You set your wallet password when you previously installed LBRY.": "You set your wallet password when you previously installed LBRY.", + "Remember My Password": "Remember My Password", + "Extra Verification Needed": "Extra Verification Needed", + "We weren't able to auto-approve you for rewards. Please complete one of the steps below to unlock them.": "We weren't able to auto-approve you for rewards. Please complete one of the steps below to unlock them.", + "Proof via Text": "Proof via Text", + "Verify Phone Number": "Verify Phone Number", + "OR": "OR", + "Proof via Credit": "Proof via Credit", + "If you have a valid credit or debit card, you can use it to instantly prove your humanity. LBRY does not store your credit card information. There is no charge at all for this, now or in the future.": "If you have a valid credit or debit card, you can use it to instantly prove your humanity. LBRY does not store your credit card information. There is no charge at all for this, now or in the future.", + "Verify Card": "Verify Card", + "Read more": "Read more", + "Proof via Chat": "Proof via Chat", + "A moderator capable of approving you is typically available in the discord server. Check out the #rewards-approval channel for more information. This process will likely involve providing proof of a stable and established online or real-life identity.": "A moderator capable of approving you is typically available in the discord server. Check out the #rewards-approval channel for more information. This process will likely involve providing proof of a stable and established online or real-life identity.", + "We're friendly. We promise.": "We're friendly. We promise.", + "No Channels Created Yet": "No Channels Created Yet", + "Create A Channel": "Create A Channel", + "Wallet encryption is currently unavailable until it's supported for synced accounts. It will be added back soon. %learn_more%": "Wallet encryption is currently unavailable until it's supported for synced accounts. It will be added back soon. %learn_more%", + "Unsave Password": "Unsave Password", + "Clear Saved Password": "Clear Saved Password", + "Forget": "Forget", + "Nevermind": "Nevermind", + "You are about to delete your saved password.": "You are about to delete your saved password.", + "Your wallet will still be encrypted, but you will have to remember and enter it manually on startup.": "Your wallet will still be encrypted, but you will have to remember and enter it manually on startup.", + "A channel is your identity on the LBRY network.": "A channel is your identity on the LBRY network.", + "You can have more than one or change this later.": "You can have more than one or change this later.", + "Your Channel": "Your Channel", + "channel": "channel", + "Create": "Create" } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index aa34f043e..37d0c1a57 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6858,9 +6858,9 @@ lbry-redux@lbryio/lbry-redux#85fe532d69704a283fd2ec640ad6e3b8dacd6d0d: reselect "^3.0.0" uuid "^3.3.2" -lbryinc@lbryio/lbryinc#44b6373ada13299a0fba1e60ac508f485af75388: +lbryinc@lbryio/lbryinc#d1dba98bb6f1dc67bc0db4c0a20fc13b8a0de98b: version "0.0.1" - resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/44b6373ada13299a0fba1e60ac508f485af75388" + resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/d1dba98bb6f1dc67bc0db4c0a20fc13b8a0de98b" dependencies: reselect "^3.0.0"