From 190386ae4c2dcc7a38e9d6e7cf9e90d2c2c0ef02 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Thu, 16 Aug 2018 01:17:15 -0400 Subject: [PATCH 1/2] record user earlier --- src/renderer/component/splash/view.jsx | 8 +++++++- src/renderer/index.js | 7 +++++-- src/renderer/redux/actions/app.js | 2 -- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/renderer/component/splash/view.jsx b/src/renderer/component/splash/view.jsx index 6fb1be0c8..f72d28d87 100644 --- a/src/renderer/component/splash/view.jsx +++ b/src/renderer/component/splash/view.jsx @@ -12,6 +12,7 @@ type Props = { notifyUnlockWallet: () => Promise, daemonVersionMatched: boolean, onReadyToLaunch: () => void, + authenticate: () => void, notification: ?{ id: string, }, @@ -61,8 +62,13 @@ export class SplashScreen extends React.PureComponent { } updateStatusCallback(status) { - const { notifyUnlockWallet } = this.props; + const { notifyUnlockWallet, authenticate } = this.props; const { launchedModal } = this.state; + + if (status) { + authenticate(); + } + if (status.wallet && status.wallet.is_locked) { this.setState({ isRunning: true, diff --git a/src/renderer/index.js b/src/renderer/index.js index 0458f7564..d4b979091 100644 --- a/src/renderer/index.js +++ b/src/renderer/index.js @@ -11,7 +11,7 @@ import { doConditionalAuthNavigate, doDaemonReady, doAutoUpdate } from 'redux/ac import { doNotify, doBlackListedOutpointsSubscribe, isURIValid } from 'lbry-redux'; import { doNavigate } from 'redux/actions/navigation'; import { doDownloadLanguages, doUpdateIsNightAsync } from 'redux/actions/settings'; -import { doUserEmailVerify } from 'redux/actions/user'; +import { doUserEmailVerify, doAuthenticate } from 'redux/actions/user'; import 'scss/all.scss'; import store from 'store'; import app from './app'; @@ -155,7 +155,10 @@ const init = () => { } else { ReactDOM.render( - + app.store.dispatch(doAuthenticate())} + onReadyToLaunch={onDaemonReady} + /> , document.getElementById('app') ); diff --git a/src/renderer/redux/actions/app.js b/src/renderer/redux/actions/app.js index d3d5a56f7..4ae364a1c 100644 --- a/src/renderer/redux/actions/app.js +++ b/src/renderer/redux/actions/app.js @@ -16,7 +16,6 @@ import Native from 'native'; import { doFetchRewardedContent } from 'redux/actions/content'; import { doFetchDaemonSettings } from 'redux/actions/settings'; import { doAuthNavigate } from 'redux/actions/navigation'; -import { doAuthenticate } from 'redux/actions/user'; import { doPause } from 'redux/actions/media'; import { doCheckSubscriptions } from 'redux/actions/subscriptions'; import { @@ -337,7 +336,6 @@ export function doDaemonReady() { return (dispatch, getState) => { const state = getState(); - dispatch(doAuthenticate()); dispatch({ type: ACTIONS.DAEMON_READY }); dispatch(doFetchDaemonSettings()); dispatch(doBalanceSubscribe()); -- 2.45.3 From d1d1e32063e8396590d2d3ad1a0c2ff10a4ae149 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Mon, 20 Aug 2018 12:33:36 -0400 Subject: [PATCH 2/2] only record user once --- src/renderer/component/splash/view.jsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/renderer/component/splash/view.jsx b/src/renderer/component/splash/view.jsx index f72d28d87..708dc731a 100644 --- a/src/renderer/component/splash/view.jsx +++ b/src/renderer/component/splash/view.jsx @@ -35,6 +35,8 @@ export class SplashScreen extends React.PureComponent { isRunning: false, launchedModal: false, }; + + this.hasRecordedUser = false; } componentDidMount() { @@ -65,8 +67,9 @@ export class SplashScreen extends React.PureComponent { const { notifyUnlockWallet, authenticate } = this.props; const { launchedModal } = this.state; - if (status) { + if (!this.hasRecordedUser && status) { authenticate(); + this.hasRecordedUser = true; } if (status.wallet && status.wallet.is_locked) { @@ -119,6 +122,8 @@ export class SplashScreen extends React.PureComponent { }, 500); } + hasRecordedUser: boolean; + render() { const { notification } = this.props; const { message, details, isRunning } = this.state; -- 2.45.3