From eb4995da86181bfff81bda61b20a22eb24bda3db Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 20 Nov 2018 12:07:12 -0500 Subject: [PATCH] move to new notificaion logic - UNTESTED --- app/src/component/AppNavigator.js | 17 ++++++++--------- app/src/component/address/index.js | 4 ++-- app/src/component/address/view.js | 9 ++++----- app/src/component/emailRewardSubcard/index.js | 6 +++--- app/src/component/emailRewardSubcard/view.js | 4 +--- app/src/component/link/index.js | 4 ++-- app/src/component/link/view.js | 2 +- .../component/phoneNumberRewardSubcard/index.js | 6 +++--- .../component/phoneNumberRewardSubcard/view.js | 8 +++----- app/src/component/rewardCard/index.js | 4 ++-- app/src/component/rewardCard/view.js | 6 +++--- app/src/component/rewardSummary/index.js | 4 ++-- app/src/component/rewardSummary/view.js | 1 - app/src/component/walletSend/index.js | 4 ++-- app/src/component/walletSend/view.js | 3 --- app/src/page/file/index.js | 4 ++-- app/src/page/file/view.js | 1 - app/src/page/firstRun/index.js | 6 +++--- app/src/page/firstRun/view.js | 3 +-- app/src/page/rewards/index.js | 6 +++--- app/src/page/splash/index.js | 4 ++-- app/src/page/splash/view.js | 3 +-- app/src/redux/actions/file.js | 11 ++++------- 23 files changed, 52 insertions(+), 68 deletions(-) diff --git a/app/src/component/AppNavigator.js b/app/src/component/AppNavigator.js index 2efe153b..16603008 100644 --- a/app/src/component/AppNavigator.js +++ b/app/src/component/AppNavigator.js @@ -33,7 +33,7 @@ import { ToastAndroid } from 'react-native'; import { doDeleteCompleteBlobs } from '../redux/actions/file'; -import { SETTINGS, doHideNotification, doNotify, selectNotification } from 'lbry-redux'; +import { SETTINGS, doHideNotification, doToast, selectToast } from 'lbry-redux'; import { doUserEmailVerify, doUserEmailVerifyFailure, @@ -240,15 +240,15 @@ class AppWithNavigationState extends React.Component { componentWillUpdate(nextProps) { const { dispatch } = this.props; const { - notification, + toast, emailToVerify, emailVerifyPending, emailVerifyErrorMessage, user } = nextProps; - if (notification) { - const { displayType, message } = notification; + if (toast) { + const { message } = toast; let currentDisplayType; if (displayType && displayType.length) { for (let i = 0; i < displayType.length; i++) { @@ -287,7 +287,7 @@ class AppWithNavigationState extends React.Component { AsyncStorage.removeItem(Constants.KEY_FIRST_RUN_EMAIL); } AsyncStorage.removeItem(Constants.KEY_SHOULD_VERIFY_EMAIL); - dispatch(doNotify({ message, displayType: ['toast'] })); + dispatch(doToast({ message })); } }); } @@ -340,12 +340,11 @@ class AppWithNavigationState extends React.Component { } catch (error) { const message = 'Invalid Verification Token'; dispatch(doUserEmailVerifyFailure(message)); - dispatch(doNotify({ message, displayType: ['toast'] })); + dispatch(doToast({ message })); } } else { - dispatch(doNotify({ + dispatch(doToast({ message: 'Invalid Verification URI', - displayType: ['toast'], })); } } else { @@ -363,7 +362,7 @@ const mapStateToProps = state => ({ backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state), keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state), nav: state.nav, - notification: selectNotification(state), + toast: selectToast(state), emailToVerify: selectEmailToVerify(state), emailVerifyPending: selectEmailVerifyIsPending(state), emailVerifyErrorMessage: selectEmailVerifyErrorMessage(state), diff --git a/app/src/component/address/index.js b/app/src/component/address/index.js index 9aaa4a3b..fea1b6ce 100644 --- a/app/src/component/address/index.js +++ b/app/src/component/address/index.js @@ -1,7 +1,7 @@ import { connect } from 'react-redux'; -import { doNotify } from 'lbry-redux'; +import { doToast } from 'lbry-redux'; import Address from './view'; export default connect(null, { - doNotify, + doToast, })(Address); diff --git a/app/src/component/address/view.js b/app/src/component/address/view.js index 1730dd27..6562bb39 100644 --- a/app/src/component/address/view.js +++ b/app/src/component/address/view.js @@ -6,21 +6,20 @@ import walletStyle from '../../styles/wallet'; type Props = { address: string, - doNotify: ({ message: string, displayType: Array }) => void, + doToast: ({ message: string }) => void, }; export default class Address extends React.PureComponent { render() { - const { address, doNotify, style } = this.props; - + const { address, doToast, style } = this.props; + return ( {address || ''}