additional rewards page changes and new verification flow #542

Merged
akinwale merged 9 commits from rewards-rework into master 2019-05-15 12:00:15 +02:00
11 changed files with 81 additions and 15 deletions
Showing only changes of commit 945f2534c3 - Show all commits

View file

@ -1,5 +1,6 @@
import { connect } from 'react-redux';
import { doToast } from 'lbry-redux';
import { doSetClientSetting } from 'redux/actions/settings';
import { doRewardList, selectUnclaimedRewardValue, selectFetchingRewards, selectUser } from 'lbryinc';
import RewardEnrolment from './view';
@ -11,7 +12,8 @@ const select = state => ({
const perform = dispatch => ({
fetchRewards: () => dispatch(doRewardList()),
notify: data => dispatch(doToast(data))
notify: data => dispatch(doToast(data)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
});
export default connect(select, perform)(RewardEnrolment);

View file

@ -2,6 +2,7 @@ import React from 'react';
import { NativeModules, Text, TouchableOpacity, View } from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import Button from 'component/button';
import Constants from 'constants';
import Link from 'component/link';
import Colors from 'styles/colors';
import Icon from 'react-native-vector-icons/FontAwesome5';
@ -13,8 +14,9 @@ class RewardEnrolment extends React.Component {
}
onNotInterestedPressed = () => {
const { navigation } = this.props;
navigation.navigate({ routeName: 'DiscoverStack' })
const { navigation, setClientSetting } = this.props;
setClientSetting(Constants.SETTING_REWARDS_NOT_INTERESTED, true);
navigation.navigate({ routeName: 'DiscoverStack' });
}
onEnrollPressed = () => {

View file

@ -1,9 +1,9 @@
import { connect } from 'react-redux';
import { selectTotalBalance } from 'lbry-redux';
import { selectBalance } from 'lbry-redux';
import WalletBalance from './view';
const select = state => ({
balance: selectTotalBalance(state),
balance: selectBalance(state),
});
export default connect(select, null)(WalletBalance);

View file

@ -0,0 +1,6 @@
import { connect } from 'react-redux';
import WalletRewardsDriver from './view';
const select = state => ({});
export default connect(select, null)(WalletRewardsDriver);

View file

@ -0,0 +1,17 @@
import React from 'react';
import { Text, TouchableOpacity } from 'react-native';
import walletStyle from 'styles/wallet';
class WalletRewardsDriver extends React.PureComponent<Props> {
render() {
const { navigation } = this.props;
return (
<TouchableOpacity style={walletStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
<Text style={walletStyle.rewardDriverText}>Earn credits while using the LBRY app. Tap to get started.</Text>
</TouchableOpacity>
);
}
}
export default WalletRewardsDriver;

View file

@ -22,6 +22,8 @@ const Constants = {
SETTING_SUBSCRIPTIONS_VIEW_MODE: "subscriptionsViewMode",
SETTING_RATING_REMINDER_LAST_SHOWN: "ratingReminderLastShown",
SETTING_RATING_REMINDER_DISABLED: "ratingReminderDisabled",
SETTING_BACKUP_DISMISSED: "backupDismissed",
SETTING_REWARDS_NOT_INTERESTED: "rewardsNotInterested",
ACTION_DELETE_COMPLETED_BLOBS: "DELETE_COMPLETED_BLOBS",
ACTION_FIRST_RUN_PAGE_CHANGED: "FIRST_RUN_PAGE_CHANGED",

View file

@ -1,5 +1,5 @@
import { connect } from 'react-redux';
import { doTotalBalanceSubscribe, doUpdateBlockHeight, doToast } from 'lbry-redux';
import { doBalanceSubscribe, doUpdateBlockHeight, doToast } from 'lbry-redux';
import {
doAuthenticate,
doBlackListedOutpointsSubscribe,
@ -23,7 +23,7 @@ const select = state => ({
const perform = dispatch => ({
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)),
totalBalanceSubscribe: () => dispatch(doTotalBalanceSubscribe()),
balanceSubscribe: () => dispatch(doBalanceSubscribe()),
blacklistedOutpointsSubscribe: () => dispatch(doBlackListedOutpointsSubscribe()),
checkSubscriptionsInit: () => dispatch(doCheckSubscriptionsInit()),
deleteCompleteBlobs: () => dispatch(doDeleteCompleteBlobs()),

View file

@ -137,7 +137,7 @@ class SplashScreen extends React.PureComponent {
finishSplashScreen = () => {
const {
authenticate,
totalBalanceSubscribe,
balanceSubscribe,
blacklistedOutpointsSubscribe,
checkSubscriptionsInit,
updateBlockHeight,
@ -147,7 +147,7 @@ class SplashScreen extends React.PureComponent {
Lbry.resolve({ urls: 'lbry://one' }).then(() => {
// Leave the splash screen
totalBalanceSubscribe();
balanceSubscribe();
blacklistedOutpointsSubscribe();
checkSubscriptionsInit();
updateBlockHeight();

View file

@ -2,13 +2,17 @@ import { connect } from 'react-redux';
import { doSetClientSetting } from 'redux/actions/settings';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { doPushDrawerStack } from 'redux/actions/drawer';
import { selectBalance } from 'lbry-redux';
import { doGetSync, selectUser } from 'lbryinc';
import Constants from 'constants';
import WalletPage from './view';
const select = state => ({
user: selectUser(state),
balance: selectBalance(state),
understandsRisks: makeSelectClientSetting(Constants.SETTING_ALPHA_UNDERSTANDS_RISKS)(state),
backupDismissed: makeSelectClientSetting(Constants.SETTING_BACKUP_DISMISSED)(state),
rewardsNotInterested: makeSelectClientSetting(Constants.SETTING_REWARDS_NOT_INTERESTED)(state),
});
const perform = dispatch => ({

View file

@ -1,6 +1,7 @@
import React from 'react';
import { NativeModules, ScrollView, Text, View } from 'react-native';
import TransactionListRecent from 'component/transactionListRecent';
import WalletRewardsDriver from 'component/walletRewardsDriver';
import WalletAddress from 'component/walletAddress';
import WalletBalance from 'component/walletBalance';
import WalletSend from 'component/walletSend';
@ -20,8 +21,20 @@ class WalletPage extends React.PureComponent {
}
}
onDismissBackupPressed = () => {
const { setClientSetting } = this.props;
setClientSetting(Constants.SETTING_BACKUP_DISMISSED, true);
}
render() {
const { understandsRisks, setClientSetting, navigation } = this.props;
const {
balance,
backupDismissed,
rewardsNotInterested,
understandsRisks,
setClientSetting,
navigation
} = this.props;
if (!understandsRisks) {
return (
@ -41,17 +54,20 @@ class WalletPage extends React.PureComponent {
return (
<View style={walletStyle.container}>
<UriBar navigation={navigation} />
<ScrollView keyboardShouldPersistTaps={'handled'}>
<ScrollView style={walletStyle.scrollContainer} keyboardShouldPersistTaps={'handled'}>
{!backupDismissed &&
<View style={walletStyle.warningCard}>
<Text style={walletStyle.warningText}>
Please backup your wallet file using the instructions at <Link style={walletStyle.warningText} text="https://lbry.com/faq/how-to-backup-wallet#android" href="https://lbry.com/faq/how-to-backup-wallet#android" />.
</Text>
</View>
<Button text={'Dismiss'} style={walletStyle.button} onPress={this.onDismissBackupPressed} />
</View>}
{(!rewardsNotInterested) && (!balance || balance === 0) && <WalletRewardsDriver navigation={navigation} />}
<WalletBalance />
<WalletAddress />
<WalletSend />
<TransactionListRecent navigation={this.props.navigation} />
<TransactionListRecent navigation={navigation} />
</ScrollView>
</View>
);

View file

@ -5,6 +5,9 @@ const walletStyle = StyleSheet.create({
container: {
backgroundColor: Colors.PageBackground
},
scrollContainer: {
marginTop: 60
},
row: {
flexDirection: 'row',
justifyContent: 'space-between',
@ -40,7 +43,7 @@ const walletStyle = StyleSheet.create({
backgroundColor: Colors.Orange,
padding: 16,
marginLeft: 16,
marginTop: 76,
marginTop: 16,
marginRight: 16
},
transactionsCard: {
@ -142,7 +145,8 @@ const walletStyle = StyleSheet.create({
color: Colors.White,
fontFamily: 'Inter-UI-Regular',
fontSize: 16,
lineHeight: 24
lineHeight: 24,
marginBottom: 8
},
understand: {
marginLeft: 16,
@ -168,6 +172,19 @@ const walletStyle = StyleSheet.create({
},
transactionHistoryScroll: {
marginTop: 60
},
rewardDriverCard: {
padding: 16,
backgroundColor: Colors.LbryGreen,
marginLeft: 16,
marginTop: 16,
marginRight: 16
},
rewardDriverText: {
color: Colors.White,
fontFamily: 'Inter-UI-Regular',
fontSize: 14,
lineHeight: 16
}
});