diff --git a/src/assets/gerbil-happy.png b/src/assets/gerbil-happy.png new file mode 100644 index 0000000..4247f83 Binary files /dev/null and b/src/assets/gerbil-happy.png differ diff --git a/src/assets/gerbil-sad.png b/src/assets/gerbil-sad.png new file mode 100644 index 0000000..153d4ad Binary files /dev/null and b/src/assets/gerbil-sad.png differ diff --git a/src/component/AppNavigator.js b/src/component/AppNavigator.js index db24edb..a5fb642 100644 --- a/src/component/AppNavigator.js +++ b/src/component/AppNavigator.js @@ -29,8 +29,9 @@ import { import { connect } from 'react-redux'; import { AppState, BackHandler, Linking, NativeModules, TextInput, ToastAndroid } from 'react-native'; import { selectDrawerStack } from 'redux/selectors/drawer'; -import { SETTINGS, doDismissToast, doToast, selectToast } from 'lbry-redux'; +import { SETTINGS, doDismissToast, doPopulateSharedUserState, doToast, selectToast } from 'lbry-redux'; import { + Lbryio, doGetSync, doUserCheckEmailVerified, doUserEmailVerify, @@ -305,6 +306,13 @@ class AppWithNavigationState extends React.Component { }); }; + getUserSettings = () => { + const { dispatch } = this.props; + Lbryio.call('user_settings', 'get').then(settings => { + dispatch(doPopulateSharedUserState(settings)); + }); + }; + componentWillUnmount() { AppState.removeEventListener('change', this._handleAppStateChange); BackHandler.removeEventListener('hardwareBackPress'); @@ -321,12 +329,8 @@ class AppWithNavigationState extends React.Component { NativeModules.Firebase.track('email_verified', { email: user.primary_email }); ToastAndroid.show('Your email address was successfully verified.', ToastAndroid.LONG); - // upon successful email verification, do wallet sync (if password has been set) - NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => { - if (walletPassword && walletPassword.trim().length > 0) { - dispatch(doGetSync(walletPassword)); - } - }); + // get user settings after email verification + this.getUserSettings(); } } diff --git a/src/component/channelSelector/view.js b/src/component/channelSelector/view.js index 1faf7b6..b8d81a8 100644 --- a/src/component/channelSelector/view.js +++ b/src/component/channelSelector/view.js @@ -27,7 +27,7 @@ export default class ChannelSelector extends React.PureComponent { componentDidMount() { const { channels = [], channelName, fetchChannelListMine, fetchingChannels } = this.props; - if (!channels.length && !fetchingChannels) { + if ((!channels || channels.length === 0) && !fetchingChannels) { fetchChannelListMine(); } this.setState({ currentSelectedValue: channelName }); @@ -37,7 +37,7 @@ export default class ChannelSelector extends React.PureComponent { const { channels: prevChannels = [], channelName } = this.props; const { channels = [] } = nextProps; - if (channels.length !== prevChannels.length && channelName !== this.state.currentSelectedValue) { + if (channels && channels.length !== prevChannels.length && channelName !== this.state.currentSelectedValue) { this.setState({ currentSelectedValue: channelName }); } } @@ -182,7 +182,9 @@ export default class ChannelSelector extends React.PureComponent { render() { const channel = this.state.addingChannel ? 'new' : this.props.channel; const { enabled, fetchingChannels, channels = [] } = this.props; - const pickerItems = [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].concat(channels.map(ch => ch.name)); + const pickerItems = [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].concat( + channels ? channels.map(ch => ch.name) : [] + ); const { newChannelName, diff --git a/src/component/emptyStateView/index.js b/src/component/emptyStateView/index.js new file mode 100644 index 0000000..53e1c84 --- /dev/null +++ b/src/component/emptyStateView/index.js @@ -0,0 +1,4 @@ +import { connect } from 'react-redux'; +import EmptyStateView from './view'; + +export default connect()(EmptyStateView); diff --git a/src/component/emptyStateView/view.js b/src/component/emptyStateView/view.js new file mode 100644 index 0000000..e69ceda --- /dev/null +++ b/src/component/emptyStateView/view.js @@ -0,0 +1,26 @@ +import React from 'react'; +import { NativeModules, Text, View, Image, TouchableOpacity } from 'react-native'; +import Button from '../button'; +import emptyStateStyle from 'styles/emptyState'; + +class EmptyStateView extends React.PureComponent { + render() { + const { message, buttonText, inner, onButtonPress } = this.props; + + return ( + + + {message} + {buttonText && ( + +