fix merge conflicts

This commit is contained in:
Akinwale Ariwodola 2019-07-09 01:41:20 +01:00
commit 602fdb3b94
16 changed files with 293 additions and 66 deletions

View file

@ -1,6 +1,5 @@
import React from 'react';
import { Text, TouchableOpacity } from 'react-native';
import Colors from 'styles/colors';
import Icon from 'react-native-vector-icons/FontAwesome5';
import filePageStyle from 'styles/filePage';

View file

@ -1,5 +1,6 @@
import React from 'react';
import { Text, TouchableOpacity } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome5';
import walletStyle from 'styles/wallet';
class WalletRewardsDriver extends React.PureComponent<Props> {
@ -8,7 +9,8 @@ class WalletRewardsDriver extends React.PureComponent<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>
<Icon name="award" size={16} style={walletStyle.rewardIcon} />
<Text style={walletStyle.rewardDriverText}>Earn credits while using the LBRY app.</Text>
</TouchableOpacity>
);
}

View file

@ -1,13 +1,22 @@
import { connect } from 'react-redux';
import { doSetClientSetting } from 'redux/actions/settings';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { doToast } from 'lbry-redux';
import { selectUserEmail } from 'lbryinc';
import Constants from 'constants';
import WalletSyncDriver from './view';
const select = state => ({
deviceWalletSynced: makeSelectClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED)(state),
userEmail: selectUserEmail(state),
});
const perform = dispatch => ({
notify: data => dispatch(doToast(data)),
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
});
export default connect(
select,
null
perform
)(WalletSyncDriver);

View file

@ -1,45 +1,89 @@
import React from 'react';
import { Text, View } from 'react-native';
import { Alert, NativeModules, Switch, Text, View } from 'react-native';
import Button from 'component/button';
import Constants from 'constants';
import Link from 'component/link';
import walletStyle from 'styles/wallet';
class WalletSyncDriver extends React.PureComponent<Props> {
onEnableSyncPressed = () => {
const { navigation } = this.props;
navigation.navigate({ routeName: 'Verification', key: 'verification', params: { syncFlow: true } });
handleSyncStatusChange = value => {
const { navigation, notify, setClientSetting } = this.props;
if (value) {
// enabling
navigation.navigate({ routeName: 'Verification', key: 'verification', params: { syncFlow: true } });
} else {
// turning off
// set deviceWalletSynced to false (if confirmed)
Alert.alert(
'Disable wallet sync',
'Are you sure you want to turn off wallet sync?',
[
{ text: 'No' },
{
text: 'Yes',
onPress: () => {
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, false);
notify({ message: 'Wallet sync was successfully disabled.' });
},
},
],
{ cancelable: true }
);
}
};
render() {
const { deviceWalletSynced } = this.props;
const { deviceWalletSynced, userEmail } = this.props;
return (
<View style={walletStyle.syncDriverCard}>
<View style={walletStyle.syncDriverRow}>
<Text style={walletStyle.syncDriverTitle}>Wallet sync is {deviceWalletSynced ? 'on' : 'off'}.</Text>
{!deviceWalletSynced && (
<Link
text="Sync FAQ"
href="https://lbry.com/faq/how-to-backup-wallet#sync"
style={walletStyle.syncDriverText}
<Text style={walletStyle.syncDriverTitle}>Wallet Sync</Text>
<View style={walletStyle.switchRow}>
<View style={walletStyle.tableCol}>
<Text style={walletStyle.labelText}>Sync status</Text>
</View>
<View style={walletStyle.tableColRow}>
<Text selectable={true} style={walletStyle.valueText}>
{deviceWalletSynced ? 'On' : 'Off'}
</Text>
<Switch
style={walletStyle.syncSwitch}
value={deviceWalletSynced}
onValueChange={this.handleSyncStatusChange}
/>
)}
</View>
</View>
{!deviceWalletSynced && (
<View style={walletStyle.actionRow}>
<Button
style={walletStyle.enrollButton}
theme={'light'}
text={'Enable'}
onPress={this.onEnableSyncPressed}
/>
{deviceWalletSynced && (
<View style={walletStyle.tableRow}>
<View style={walletStyle.tableCol}>
<Text style={walletStyle.labelText}>Connected email</Text>
</View>
<View style={walletStyle.tableCol}>
<Text selectable={true} style={walletStyle.valueText}>
{userEmail ? userEmail : 'No connected email'}
</Text>
</View>
</View>
)}
<View style={walletStyle.linkRow}>
<View style={walletStyle.tableCol}>
<Link
text="Manual backup"
href="https://lbry.com/faq/how-to-backup-wallet#android"
style={walletStyle.syncDriverText}
style={walletStyle.syncDriverLink}
/>
</View>
)}
<View style={walletStyle.rightTableCol}>
{!deviceWalletSynced && (
<Link
text="Sync FAQ"
href="https://lbry.com/faq/how-to-backup-wallet#sync"
style={[walletStyle.syncDriverLink, walletStyle.rightLink]}
/>
)}
</View>
</View>
</View>
);
}

View file

@ -42,6 +42,7 @@ import thunk from 'redux-thunk';
const globalExceptionHandler = (error, isFatal) => {
if (error && NativeModules.Firebase) {
console.log(error);
NativeModules.Firebase.logException(isFatal, error.message ? error.message : 'No message', JSON.stringify(error));
}
};

View file

@ -102,7 +102,7 @@ class AboutPage extends React.PureComponent {
<View style={aboutStyle.verticalRow}>
<View style={aboutStyle.innerRow}>
<View style={aboutStyle.col}>
<Text style={aboutStyle.text}>Connected Email</Text>
<Text style={aboutStyle.text}>Connected email</Text>
</View>
<View style={aboutStyle.col}>
<Text selectable={true} style={aboutStyle.valueText}>

View file

@ -115,6 +115,15 @@ class WalletPage extends React.PureComponent {
<Icon name={this.state.revealPassword ? 'eye-slash' : 'eye'} size={16} style={firstRunStyle.revealIcon} />
</TouchableOpacity>
</View>
{(!this.state.password || this.state.password.trim().length === 0) && (
<View style={firstRunStyle.passwordWarning}>
<Text style={firstRunStyle.passwordWarningText}>
{hasSyncedWallet
? 'If you did not provide a password, please press Use LBRY to continue.'
: 'You can proceed without a password, but this is not recommended.'}
</Text>
</View>
)}
{(!hasSyncedWallet && this.state.password && this.state.password.trim().length) > 0 && (
<View style={firstRunStyle.passwordStrength}>

View file

@ -6,6 +6,7 @@ import { decode as atob } from 'base-64';
import { navigateToUri } from 'utils/helper';
import moment from 'moment';
import AsyncStorage from '@react-native-community/async-storage';
import Button from 'component/button';
import ProgressBar from 'component/progressBar';
import PropTypes from 'prop-types';
import Colors from 'styles/colors';
@ -14,25 +15,29 @@ import splashStyle from 'styles/splash';
const BLOCK_HEIGHT_INTERVAL = 1000 * 60 * 2.5; // every 2.5 minutes
const testingNetwork = 'Testing network';
const waitingForResolution = 'Waiting for name resolution';
class SplashScreen extends React.PureComponent {
static navigationOptions = {
title: 'Splash',
};
componentWillMount() {
this.setState({
daemonReady: false,
details: 'Starting up...',
message: 'Connecting',
isRunning: false,
isLagging: false,
launchUrl: null,
isDownloadingHeaders: false,
headersDownloadProgress: 0,
shouldAuthenticate: false,
subscriptionsFetched: false,
});
state = {
accountUnlockFailed: false,
daemonReady: false,
details: 'Starting up',
message: 'Connecting',
isRunning: false,
isLagging: false,
launchUrl: null,
isDownloadingHeaders: false,
headersDownloadProgress: 0,
shouldAuthenticate: false,
subscriptionsFetched: false,
};
componentWillMount() {
if (NativeModules.DaemonServiceControl) {
NativeModules.DaemonServiceControl.startService();
}
@ -143,6 +148,10 @@ class SplashScreen extends React.PureComponent {
});
};
handleAccountUnlockFailed() {
this.setState({ accountUnlockFailed: true });
}
_updateStatusCallback(status) {
const { fetchSubscriptions, getSync, setClientSetting } = this.props;
const startupStatus = status.startup_status;
@ -155,8 +164,6 @@ class SplashScreen extends React.PureComponent {
// to give us a better sense of when we are actually started
this.setState({
daemonReady: true,
message: 'Testing Network',
details: 'Waiting for name resolution',
isLagging: false,
isRunning: true,
});
@ -164,14 +171,29 @@ class SplashScreen extends React.PureComponent {
// For now, automatically unlock the wallet if a password is set so that downloads work
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => {
if (password && password.trim().length > 0) {
this.setState({
message: 'Unlocking account',
details: 'Decrypting wallet',
});
// unlock the wallet and then finish the splash screen
Lbry.account_unlock({ password })
.then(() => this.finishSplashScreen())
.catch(() => this.finishSplashScreen());
.then(() => {
this.setState({
message: testingNetwork,
details: waitingForResolution,
});
this.finishSplashScreen();
})
.catch(() => this.handleAccountUnlockFailed());
return;
} else {
this.setState({
message: testingNetwork,
details: waitingForResolution,
});
this.finishSplashScreen();
}
this.finishSplashScreen();
});
return;
@ -208,7 +230,7 @@ class SplashScreen extends React.PureComponent {
} else {
this.setState({
message: 'Network Loading',
details: 'Initializing LBRY service...',
details: 'Initializing LBRY service',
});
}
@ -253,8 +275,41 @@ class SplashScreen extends React.PureComponent {
});
}
handleContinueAnywayPressed = () => {
this.setState(
{
accountUnlockFailed: false,
message: testingNetwork,
details: waitingForResolution,
},
() => this.finishSplashScreen()
);
};
render() {
const { message, details, isLagging, isRunning } = this.state;
const { accountUnlockFailed, message, details, isLagging, isRunning } = this.state;
if (accountUnlockFailed) {
return (
<View style={splashStyle.container}>
<Text style={splashStyle.errorTitle}>Oops! Something went wrong.</Text>
<Text style={splashStyle.paragraph}>
Your wallet failed to unlock, which means you may not be able to play any videos or access your funds.
</Text>
<Text style={splashStyle.paragraph}>
You can try to fix this by tapping Stop on the LBRY service notification and starting the app again. If the
problem continues, you may have to reinstall the app and restore your account.
</Text>
<Button
style={splashStyle.continueButton}
theme={'light'}
text={'Continue anyway'}
onPress={this.handleContinueAnywayPressed}
/>
</View>
);
}
return (
<View style={splashStyle.container}>

View file

@ -134,6 +134,17 @@ class SyncVerifyPage extends React.PureComponent {
<Icon name={this.state.revealPassword ? 'eye-slash' : 'eye'} size={16} style={firstRunStyle.revealIcon} />
</TouchableOpacity>
</View>
{(!this.state.password || this.state.password.trim().length === 0) && (
<View style={firstRunStyle.passwordWarning}>
<Text style={firstRunStyle.passwordWarningText}>
{hasSyncedWallet
? 'If you did not provide a password, please press Use LBRY to continue.'
: 'You can proceed without a password, but this is not recommended.'}
</Text>
</View>
)}
{(!hasSyncedWallet && this.state.password && this.state.password.trim().length) > 0 && (
<View style={firstRunStyle.passwordStrength}>
<BarPasswordStrengthDisplay

View file

@ -12,6 +12,7 @@ const select = state => ({
currentRoute: selectCurrentRoute(state),
backupDismissed: makeSelectClientSetting(Constants.SETTING_BACKUP_DISMISSED)(state),
balance: selectBalance(state),
deviceWalletSynced: makeSelectClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED)(state),
hasSyncedWallet: selectHasSyncedWallet(state),
rewardsNotInterested: makeSelectClientSetting(Constants.SETTING_REWARDS_NOT_INTERESTED)(state),
understandsRisks: makeSelectClientSetting(Constants.SETTING_ALPHA_UNDERSTANDS_RISKS)(state),

View file

@ -43,8 +43,8 @@ class WalletPage extends React.PureComponent {
pushDrawerStack();
setPlayerVisible();
const { getSync, user } = this.props;
if (user && user.has_verified_email) {
const { deviceWalletSynced, getSync, user } = this.props;
if (deviceWalletSynced && user && user.has_verified_email) {
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
if (walletPassword && walletPassword.trim().length > 0) {
getSync(walletPassword);
@ -106,12 +106,12 @@ class WalletPage extends React.PureComponent {
keyboardShouldPersistTaps={'handled'}
removeClippedSubviews={false}
>
<WalletSyncDriver navigation={navigation} />
{!rewardsNotInterested && (!balance || balance === 0) && <WalletRewardsDriver navigation={navigation} />}
<WalletBalance />
<WalletAddress />
<WalletSend />
<TransactionListRecent navigation={navigation} />
<WalletSyncDriver navigation={navigation} />
</ScrollView>
</View>
);

View file

@ -14,6 +14,7 @@ const Colors = {
LighterGrey: '#e5e5e5',
Orange: '#ffbb00',
Red: '#ff0000',
BrightRed: '#e35454',
VeryLightGrey: '#f1f1f1',
White: '#ffffff',
UriDescBlue: '#3971db',

View file

@ -172,6 +172,16 @@ const firstRunStyle = StyleSheet.create({
marginRight: 32,
marginBottom: 48,
},
passwordWarning: {
marginLeft: 32,
marginRight: 32,
marginBottom: 24,
},
passwordWarningText: {
color: Colors.BrightRed,
fontFamily: 'Inter-UI-Regular',
fontSize: 16,
},
centered: {
alignItems: 'center',
},

View file

@ -14,6 +14,31 @@ const splashStyle = StyleSheet.create({
marginBottom: 48,
color: Colors.White,
},
errorTitle: {
fontFamily: 'Inter-UI-Regular',
fontSize: 28,
marginBottom: 24,
marginLeft: 24,
marginRight: 24,
color: Colors.White,
},
paragraph: {
fontFamily: 'Inter-UI-Regular',
fontSize: 16,
lineHeight: 24,
marginBottom: 20,
marginLeft: 24,
marginRight: 24,
color: Colors.White,
},
continueButton: {
fontSize: 16,
backgroundColor: Colors.White,
marginTop: 24,
marginLeft: 24,
marginRight: 24,
alignSelf: 'flex-end',
},
loading: {
marginBottom: 36,
},

View file

@ -13,6 +13,14 @@ const walletStyle = StyleSheet.create({
justifyContent: 'space-between',
alignItems: 'center',
},
linkRow: {
flexDirection: 'row',
alignItems: 'center',
paddingTop: 12,
paddingBottom: 12,
paddingLeft: 16,
paddingRight: 16,
},
amountRow: {
flexDirection: 'row',
},
@ -30,14 +38,14 @@ const walletStyle = StyleSheet.create({
alignSelf: 'flex-start',
},
enrollButton: {
backgroundColor: Colors.White,
alignSelf: 'flex-start',
backgroundColor: Colors.LbryGreen,
marginLeft: 12,
},
historyList: {
backgroundColor: '#ffffff',
backgroundColor: Colors.White,
},
card: {
backgroundColor: '#ffffff',
backgroundColor: Colors.White,
marginTop: 16,
marginLeft: 16,
marginRight: 16,
@ -51,7 +59,7 @@ const walletStyle = StyleSheet.create({
marginRight: 16,
},
transactionsCard: {
backgroundColor: '#ffffff',
backgroundColor: Colors.White,
margin: 16,
},
title: {
@ -96,7 +104,7 @@ const walletStyle = StyleSheet.create({
height: '100%',
},
balanceTitle: {
color: '#ffffff',
color: Colors.White,
fontFamily: 'Inter-UI-SemiBold',
fontSize: 20,
marginLeft: 16,
@ -111,7 +119,7 @@ const walletStyle = StyleSheet.create({
marginBottom: 96,
},
balance: {
color: '#ffffff',
color: Colors.White,
fontFamily: 'Inter-UI-Bold',
fontSize: 36,
marginLeft: 16,
@ -188,8 +196,10 @@ const walletStyle = StyleSheet.create({
marginTop: 60,
},
rewardDriverCard: {
alignItems: 'center',
backgroundColor: Colors.BrighterLbryGreen,
flexDirection: 'row',
padding: 16,
backgroundColor: Colors.LbryGreen,
marginLeft: 16,
marginTop: 16,
marginRight: 16,
@ -200,20 +210,27 @@ const walletStyle = StyleSheet.create({
fontSize: 14,
lineHeight: 16,
},
rewardIcon: {
color: Colors.White,
marginRight: 8,
},
syncDriverCard: {
padding: 16,
backgroundColor: Colors.LbryGreen,
backgroundColor: Colors.White,
marginLeft: 16,
marginTop: 16,
marginBottom: 16,
marginRight: 16,
},
syncDriverTitle: {
color: Colors.White,
fontFamily: 'Inter-UI-SemiBold',
fontSize: 20,
paddingLeft: 16,
marginTop: 16,
paddingBottom: 14,
borderBottomWidth: 1,
borderBottomColor: Colors.PageBackground
},
syncDriverText: {
color: Colors.White,
syncDriverLink: {
color: Colors.LbryGreen,
fontFamily: 'Inter-UI-Regular',
fontSize: 14,
},
@ -228,6 +245,49 @@ const walletStyle = StyleSheet.create({
alignItems: 'center',
justifyContent: 'space-between',
},
switchRow: {
paddingLeft: 16,
paddingRight: 16,
paddingTop: 14,
paddingBottom: 14,
flexDirection: 'row',
alignItems: 'center',
borderBottomWidth: 1,
borderBottomColor: Colors.PageBackground,
},
tableRow: {
padding: 16,
flexDirection: 'row',
alignItems: 'center',
borderBottomWidth: 1,
borderBottomColor: Colors.PageBackground,
},
tableCol: {
flex: 0.5,
},
tableColRow: {
flex: 0.5,
alignItems: 'center',
flexDirection: 'row',
},
rightTableCol: {
flex: 0.5,
justifyContent: 'flex-end',
},
labelText: {
fontFamily: 'Inter-UI-SemiBold',
fontSize: 16,
},
valueText: {
fontFamily: 'Inter-UI-Regular',
fontSize: 16,
},
rightLink: {
alignSelf: 'flex-end',
},
syncSwitch: {
marginLeft: 8,
},
});
export default walletStyle;

View file

@ -36,7 +36,7 @@ version.filename = %(source.dir)s/main.py
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, git+https://github.com/lbryio/lbry.git@v0.37.4#egg=lbrynet, git+https://github.com/lbryio/aioupnp.git@a404269d91cff5358bcffb8067b0fd1d9c6842d3#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, git+https://github.com/lbryio/torba@v0.5.4a0#egg=torba, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir
requirements = python3crystax, openssl, sqlite3, hostpython3crystax, android, distro==1.4.0, pyjnius, certifi==2018.11.29, appdirs==1.4.3, docopt==0.6.2, base58==1.0.0, colorama==0.3.7, ecdsa==0.13, jsonschema==2.6.0, pbkdf2==1.3, pyyaml, protobuf==3.6.1, keyring==10.4.0, git+https://github.com/lbryio/aioupnp.git@a404269d91cff5358bcffb8067b0fd1d9c6842d3#egg=aioupnp, asn1crypto, mock, netifaces, cryptography, aiohttp==3.5.4, multidict==4.5.2, yarl==1.3.0, chardet==3.0.4, async_timeout==3.0.1, coincurve, msgpack==0.6.1, six, attrs==18.2.0, pylru, hachoir, "git+https://github.com/lbryio/lbry-sdk@v0.38.0#egg=lbry&subdirectory=lbry", "git+https://github.com/lbryio/lbry-sdk@v0.38.0#egg=torba&subdirectory=torba"
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes