Compare commits
42
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e142f5429 | ||
|
|
065e91bfb4 | ||
|
|
69a760f011 | ||
|
|
22cd556e13 | ||
|
|
68bee32dde | ||
|
|
cc2b3b845d | ||
|
|
b6df5ee97c | ||
|
|
ddd8d49a62 | ||
|
|
e6ee26f94c | ||
|
|
2bf67d31e8 | ||
|
|
9ec5ac5d60 | ||
|
|
9080913811 | ||
|
|
eca6af122b | ||
|
|
b258654d60 | ||
|
|
342e022594 | ||
|
|
d16e4b7f69 | ||
|
|
648206b6a5 | ||
|
|
14994d2a30 | ||
|
|
ab97be6a4d | ||
|
|
e39f5907a8 | ||
|
|
c203aa914c | ||
|
|
f0a3eec80b | ||
|
|
47bb996342 | ||
|
|
aba0b860e8 | ||
|
|
b135ca36a3 | ||
|
|
46b99e769f | ||
|
|
b5dad6b5fb | ||
|
|
31d4d46742 | ||
|
|
5d86b68a3e | ||
|
|
62ac844084 | ||
|
|
eebb25dba0 | ||
|
|
88e450eb08 | ||
|
|
ca8670e23c | ||
|
|
1b4c023c92 | ||
|
|
9aabad56a2 | ||
|
|
3051deb7c7 | ||
|
|
f2f5cd9ad5 | ||
|
|
f800f22277 | ||
|
|
2558f0c392 | ||
|
|
02d8107b50 | ||
|
|
5943a796e4 | ||
|
|
ffc4d828a7 |
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2017-2018 LBRY Inc
|
Copyright (c) 2017-2019 LBRY Inc
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
|||||||
Generated
+10
-7
@@ -5640,8 +5640,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lbry-redux": {
|
"lbry-redux": {
|
||||||
"version": "github:lbryio/lbry-redux#123efacf4d45289ebda9dc291976d475de227a55",
|
"version": "github:lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
|
||||||
"from": "github:lbryio/lbry-redux#123efacf4d45289ebda9dc291976d475de227a55",
|
"from": "github:lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
|
||||||
"requires": {
|
"requires": {
|
||||||
"proxy-polyfill": "0.1.6",
|
"proxy-polyfill": "0.1.6",
|
||||||
"reselect": "^3.0.0",
|
"reselect": "^3.0.0",
|
||||||
@@ -5649,8 +5649,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lbryinc": {
|
"lbryinc": {
|
||||||
"version": "github:lbryio/lbryinc#b9f354ae50bd57691765a7d042c5054167878bf4",
|
"version": "github:lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
|
||||||
"from": "github:lbryio/lbryinc#b9f354ae50bd57691765a7d042c5054167878bf4",
|
"from": "github:lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
|
||||||
"requires": {
|
"requires": {
|
||||||
"reselect": "^3.0.0"
|
"reselect": "^3.0.0"
|
||||||
}
|
}
|
||||||
@@ -8402,9 +8402,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-navigation-drawer": {
|
"react-navigation-drawer": {
|
||||||
"version": "2.2.2",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-navigation-drawer/-/react-navigation-drawer-2.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-navigation-drawer/-/react-navigation-drawer-1.4.0.tgz",
|
||||||
"integrity": "sha512-KcFH7RRzT1XuREkTbNMCqfy7nK7yenzpGKvqp1dTvAE+DIyHHpf+Po959lsmITlt/njQBn+QxvdX1FZ9we3lNA=="
|
"integrity": "sha512-ZyWBozcjB2aZ7vwCALv90cYA2NpDjM+WALaiYRshvPvue8l7cqynePbHK8GhlMGyJDwZqp4MxQmu8u1XAKp3Bw==",
|
||||||
|
"requires": {
|
||||||
|
"react-native-tab-view": "^1.2.0"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"react-navigation-redux-helpers": {
|
"react-navigation-redux-helpers": {
|
||||||
"version": "3.0.2",
|
"version": "3.0.2",
|
||||||
|
|||||||
+3
-3
@@ -12,8 +12,8 @@
|
|||||||
"base-64": "^0.1.0",
|
"base-64": "^0.1.0",
|
||||||
"@expo/vector-icons": "^8.1.0",
|
"@expo/vector-icons": "^8.1.0",
|
||||||
"gfycat-style-urls": "^1.0.3",
|
"gfycat-style-urls": "^1.0.3",
|
||||||
"lbry-redux": "lbryio/lbry-redux#123efacf4d45289ebda9dc291976d475de227a55",
|
"lbry-redux": "lbryio/lbry-redux#8ac92e3abfa0a9aacdb2fa4a144c3fadc4da6b11",
|
||||||
"lbryinc": "lbryio/lbryinc#b9f354ae50bd57691765a7d042c5054167878bf4",
|
"lbryinc": "lbryio/lbryinc#aebad10a9c5d725c3fedae4236d56f239a0bc1de",
|
||||||
"lodash": ">=4.17.11",
|
"lodash": ">=4.17.11",
|
||||||
"merge": ">=1.2.1",
|
"merge": ">=1.2.1",
|
||||||
"moment": "^2.22.1",
|
"moment": "^2.22.1",
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
"react-native-vector-icons": "^6.6.0",
|
"react-native-vector-icons": "^6.6.0",
|
||||||
"react-native-video": "lbryio/react-native-video#exoplayer-lbry-android",
|
"react-native-video": "lbryio/react-native-video#exoplayer-lbry-android",
|
||||||
"react-navigation": "^3.11.0",
|
"react-navigation": "^3.11.0",
|
||||||
"react-navigation-drawer": "^2.2.2",
|
"react-navigation-drawer": "^1.4.0",
|
||||||
"react-navigation-redux-helpers": "^3.0.2",
|
"react-navigation-redux-helpers": "^3.0.2",
|
||||||
"react-navigation-stack": "^1.8.1",
|
"react-navigation-stack": "^1.8.1",
|
||||||
"react-redux": "^5.0.3",
|
"react-redux": "^5.0.3",
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 265 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 278 KiB |
@@ -29,8 +29,9 @@ import {
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { AppState, BackHandler, Linking, NativeModules, TextInput, ToastAndroid } from 'react-native';
|
import { AppState, BackHandler, Linking, NativeModules, TextInput, ToastAndroid } from 'react-native';
|
||||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||||
import { SETTINGS, doDismissToast, doToast, selectToast } from 'lbry-redux';
|
import { SETTINGS, doDismissToast, doPopulateSharedUserState, doPreferenceGet, doToast, selectToast } from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
|
Lbryio,
|
||||||
doGetSync,
|
doGetSync,
|
||||||
doUserCheckEmailVerified,
|
doUserCheckEmailVerified,
|
||||||
doUserEmailVerify,
|
doUserEmailVerify,
|
||||||
@@ -38,6 +39,7 @@ import {
|
|||||||
selectEmailToVerify,
|
selectEmailToVerify,
|
||||||
selectEmailVerifyIsPending,
|
selectEmailVerifyIsPending,
|
||||||
selectEmailVerifyErrorMessage,
|
selectEmailVerifyErrorMessage,
|
||||||
|
selectHashChanged,
|
||||||
selectUser,
|
selectUser,
|
||||||
} from 'lbryinc';
|
} from 'lbryinc';
|
||||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
@@ -52,6 +54,8 @@ import discoverStyle from 'styles/discover';
|
|||||||
import searchStyle from 'styles/search';
|
import searchStyle from 'styles/search';
|
||||||
import SearchRightHeaderIcon from 'component/searchRightHeaderIcon';
|
import SearchRightHeaderIcon from 'component/searchRightHeaderIcon';
|
||||||
|
|
||||||
|
const SYNC_GET_INTERVAL = 1000 * 60 * 5; // every 5 minutes
|
||||||
|
|
||||||
const menuNavigationButton = navigation => (
|
const menuNavigationButton = navigation => (
|
||||||
<NavigationButton
|
<NavigationButton
|
||||||
name="bars"
|
name="bars"
|
||||||
@@ -210,7 +214,7 @@ const drawer = createDrawerNavigator(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
drawerWidth: 300,
|
drawerWidth: 280,
|
||||||
drawerBackgroundColor: 'transparent',
|
drawerBackgroundColor: 'transparent',
|
||||||
headerMode: 'none',
|
headerMode: 'none',
|
||||||
backBehavior: 'none',
|
backBehavior: 'none',
|
||||||
@@ -268,9 +272,11 @@ class AppWithNavigationState extends React.Component {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.emailVerifyCheckInterval = null;
|
this.emailVerifyCheckInterval = null;
|
||||||
|
this.syncGetInterval = null;
|
||||||
this.state = {
|
this.state = {
|
||||||
emailVerifyDone: false,
|
emailVerifyDone: false,
|
||||||
verifyPending: false,
|
verifyPending: false,
|
||||||
|
syncHashChanged: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,8 +297,17 @@ class AppWithNavigationState extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const { dispatch } = this.props;
|
||||||
this.emailVerifyCheckInterval = setInterval(() => this.checkEmailVerification(), 5000);
|
this.emailVerifyCheckInterval = setInterval(() => this.checkEmailVerification(), 5000);
|
||||||
Linking.addEventListener('url', this._handleUrl);
|
Linking.addEventListener('url', this._handleUrl);
|
||||||
|
|
||||||
|
// call /sync/get with interval
|
||||||
|
this.syncGetInterval = setInterval(() => {
|
||||||
|
this.setState({ syncHashChanged: false }); // reset local state
|
||||||
|
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||||
|
dispatch(doGetSync(walletPassword, () => this.getUserSettings()));
|
||||||
|
});
|
||||||
|
}, SYNC_GET_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEmailVerification = () => {
|
checkEmailVerification = () => {
|
||||||
@@ -305,14 +320,33 @@ class AppWithNavigationState extends React.Component {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getUserSettings = () => {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
doPreferenceGet(
|
||||||
|
'shared',
|
||||||
|
preference => {
|
||||||
|
dispatch(doPopulateSharedUserState(preference));
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
/* failed */
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
AppState.removeEventListener('change', this._handleAppStateChange);
|
AppState.removeEventListener('change', this._handleAppStateChange);
|
||||||
BackHandler.removeEventListener('hardwareBackPress');
|
BackHandler.removeEventListener('hardwareBackPress');
|
||||||
Linking.removeEventListener('url', this._handleUrl);
|
Linking.removeEventListener('url', this._handleUrl);
|
||||||
|
if (this.emailVerifyCheckInterval > -1) {
|
||||||
|
clearInterval(this.emailVerifyCheckInterval);
|
||||||
|
}
|
||||||
|
if (this.syncGetInterval > -1) {
|
||||||
|
clearInterval(this.syncGetInterval);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
const { dispatch, user } = this.props;
|
const { dispatch, user, hashChanged } = this.props;
|
||||||
if (this.state.verifyPending && this.emailVerifyCheckInterval > 0 && user && user.has_verified_email) {
|
if (this.state.verifyPending && this.emailVerifyCheckInterval > 0 && user && user.has_verified_email) {
|
||||||
clearInterval(this.emailVerifyCheckInterval);
|
clearInterval(this.emailVerifyCheckInterval);
|
||||||
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'false');
|
AsyncStorage.setItem(Constants.KEY_EMAIL_VERIFY_PENDING, 'false');
|
||||||
@@ -321,12 +355,13 @@ class AppWithNavigationState extends React.Component {
|
|||||||
NativeModules.Firebase.track('email_verified', { email: user.primary_email });
|
NativeModules.Firebase.track('email_verified', { email: user.primary_email });
|
||||||
ToastAndroid.show('Your email address was successfully verified.', ToastAndroid.LONG);
|
ToastAndroid.show('Your email address was successfully verified.', ToastAndroid.LONG);
|
||||||
|
|
||||||
// upon successful email verification, do wallet sync (if password has been set)
|
// get user settings after email verification
|
||||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
this.getUserSettings();
|
||||||
if (walletPassword && walletPassword.trim().length > 0) {
|
}
|
||||||
dispatch(doGetSync(walletPassword));
|
|
||||||
}
|
if (hashChanged && !this.state.syncHashChanged) {
|
||||||
});
|
this.setState({ syncHashChanged: true });
|
||||||
|
this.getUserSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,6 +469,7 @@ class AppWithNavigationState extends React.Component {
|
|||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state),
|
backgroundPlayEnabled: makeSelectClientSetting(SETTINGS.BACKGROUND_PLAY_ENABLED)(state),
|
||||||
|
hashChanged: selectHashChanged(state),
|
||||||
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
||||||
nav: state.nav,
|
nav: state.nav,
|
||||||
toast: selectToast(state),
|
toast: selectToast(state),
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { connect } from 'react-redux';
|
||||||
|
import ChannelRewardsDriver from './view';
|
||||||
|
|
||||||
|
export default connect()(ChannelRewardsDriver);
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Text, TouchableOpacity } from 'react-native';
|
||||||
|
import Colors from 'styles/colors';
|
||||||
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
|
import publishStyle from 'styles/publish';
|
||||||
|
|
||||||
|
class ChannelRewardsDriver extends React.PureComponent<Props> {
|
||||||
|
render() {
|
||||||
|
const { navigation } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TouchableOpacity style={publishStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||||
|
<Icon name="award" size={16} style={publishStyle.rewardIcon} />
|
||||||
|
<Text style={publishStyle.rewardDriverText}>Earn some credits to be able to create your channel.</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ChannelRewardsDriver;
|
||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
doCreateChannel,
|
doCreateChannel,
|
||||||
doToast,
|
doToast,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
|
import { doGetSync } from 'lbryinc';
|
||||||
import ChannelSelector from './view';
|
import ChannelSelector from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
@@ -19,6 +20,7 @@ const perform = dispatch => ({
|
|||||||
notify: data => dispatch(doToast(data)),
|
notify: data => dispatch(doToast(data)),
|
||||||
createChannel: (name, amount) => dispatch(doCreateChannel(name, amount)),
|
createChannel: (name, amount) => dispatch(doCreateChannel(name, amount)),
|
||||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||||
|
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(
|
export default connect(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { CLAIM_VALUES, isURIValid } from 'lbry-redux';
|
import { CLAIM_VALUES, isNameValid } from 'lbry-redux';
|
||||||
import { ActivityIndicator, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
import { ActivityIndicator, NativeModules, Picker, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||||
|
import { logPublish } from 'utils/helper';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
@@ -26,8 +27,8 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { channels, channelName, fetchChannelListMine, fetchingChannels } = this.props;
|
const { channels = [], channelName, fetchChannelListMine, fetchingChannels } = this.props;
|
||||||
if (!channels.length && !fetchingChannels) {
|
if ((!channels || channels.length === 0) && !fetchingChannels) {
|
||||||
fetchChannelListMine();
|
fetchChannelListMine();
|
||||||
}
|
}
|
||||||
this.setState({ currentSelectedValue: channelName });
|
this.setState({ currentSelectedValue: channelName });
|
||||||
@@ -37,7 +38,7 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
const { channels: prevChannels = [], channelName } = this.props;
|
const { channels: prevChannels = [], channelName } = this.props;
|
||||||
const { channels = [] } = nextProps;
|
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 });
|
this.setState({ currentSelectedValue: channelName });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,7 +86,7 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
newChannelName = newChannelName.slice(1);
|
newChannelName = newChannelName.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newChannelName.trim().length > 0 && !isURIValid(newChannelName)) {
|
if (newChannelName.trim().length > 0 && !isNameValid(newChannelName)) {
|
||||||
newChannelNameError = 'Your channel name contains invalid characters.';
|
newChannelNameError = 'Your channel name contains invalid characters.';
|
||||||
} else if (this.channelExists(newChannelName)) {
|
} else if (this.channelExists(newChannelName)) {
|
||||||
newChannelNameError = 'You have already created a channel with the same name.';
|
newChannelNameError = 'You have already created a channel with the same name.';
|
||||||
@@ -117,10 +118,10 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handleCreateChannelClick = () => {
|
handleCreateChannelClick = () => {
|
||||||
const { balance, createChannel, onChannelChange, notify } = this.props;
|
const { balance, createChannel, getSync, onChannelChange, notify } = this.props;
|
||||||
const { newChannelBid, newChannelName } = this.state;
|
const { newChannelBid, newChannelName } = this.state;
|
||||||
|
|
||||||
if (newChannelName.trim().length === 0 || !isURIValid(newChannelName.substr(1), false)) {
|
if (newChannelName.trim().length === 0 || !isNameValid(newChannelName.substr(1), false)) {
|
||||||
notify({ message: 'Your channel name contains invalid characters.' });
|
notify({ message: 'Your channel name contains invalid characters.' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -142,17 +143,21 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
createChannelError: undefined,
|
createChannelError: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const success = () => {
|
const success = channelClaim => {
|
||||||
this.setState({
|
this.setState({
|
||||||
creatingChannel: false,
|
creatingChannel: false,
|
||||||
addingChannel: false,
|
addingChannel: false,
|
||||||
currentSelectedValue: channelName,
|
currentSelectedValue: channelName,
|
||||||
showCreateChannel: false,
|
showCreateChannel: false,
|
||||||
});
|
});
|
||||||
|
logPublish(channelClaim);
|
||||||
|
|
||||||
if (onChannelChange) {
|
if (onChannelChange) {
|
||||||
onChannelChange(channelName);
|
onChannelChange(channelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sync wallet
|
||||||
|
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => getSync(password));
|
||||||
};
|
};
|
||||||
|
|
||||||
const failure = () => {
|
const failure = () => {
|
||||||
@@ -167,12 +172,14 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
|
|
||||||
channelExists = name => {
|
channelExists = name => {
|
||||||
const { channels = [] } = this.props;
|
const { channels = [] } = this.props;
|
||||||
for (let channel of channels) {
|
if (channels) {
|
||||||
if (
|
for (let channel of channels) {
|
||||||
name.toLowerCase() === channel.name.toLowerCase() ||
|
if (
|
||||||
`@${name}`.toLowerCase() === channel.name.toLowerCase()
|
name.toLowerCase() === channel.name.toLowerCase() ||
|
||||||
) {
|
`@${name}`.toLowerCase() === channel.name.toLowerCase()
|
||||||
return true;
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +189,9 @@ export default class ChannelSelector extends React.PureComponent {
|
|||||||
render() {
|
render() {
|
||||||
const channel = this.state.addingChannel ? 'new' : this.props.channel;
|
const channel = this.state.addingChannel ? 'new' : this.props.channel;
|
||||||
const { enabled, fetchingChannels, channels = [] } = this.props;
|
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 {
|
const {
|
||||||
newChannelName,
|
newChannelName,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import claimListStyle from 'styles/claimList';
|
|||||||
import discoverStyle from 'styles/discover';
|
import discoverStyle from 'styles/discover';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
|
||||||
const horizontalLimit = 7;
|
const horizontalLimit = 10;
|
||||||
const softLimit = 500;
|
const softLimit = 500;
|
||||||
|
|
||||||
class ClaimList extends React.PureComponent {
|
class ClaimList extends React.PureComponent {
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { connect } from 'react-redux';
|
||||||
|
import EmptyStateView from './view';
|
||||||
|
|
||||||
|
export default connect()(EmptyStateView);
|
||||||
@@ -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 (
|
||||||
|
<View
|
||||||
|
style={[emptyStateStyle.container, inner ? emptyStateStyle.innerContainer : emptyStateStyle.outerContainer]}
|
||||||
|
>
|
||||||
|
<Image style={emptyStateStyle.image} resizeMode={'stretch'} source={require('../../assets/gerbil-happy.png')} />
|
||||||
|
<Text style={emptyStateStyle.message}>{message}</Text>
|
||||||
|
{buttonText && (
|
||||||
|
<View style={emptyStateStyle.buttonContainer}>
|
||||||
|
<Button style={emptyStateStyle.button} text={buttonText} onPress={onButtonPress} />
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default EmptyStateView;
|
||||||
@@ -10,13 +10,15 @@ import {
|
|||||||
makeSelectClaimIsNsfw,
|
makeSelectClaimIsNsfw,
|
||||||
makeSelectShortUrlForUri,
|
makeSelectShortUrlForUri,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { selectRewardContentClaimIds } from 'lbryinc';
|
import { selectBlackListedOutpoints, selectFilteredOutpoints, selectRewardContentClaimIds } from 'lbryinc';
|
||||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||||
import FileItem from './view';
|
import FileItem from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||||
|
filteredOutpoints: selectFilteredOutpoints(state),
|
||||||
metadata: makeSelectMetadataForUri(props.uri)(state),
|
metadata: makeSelectMetadataForUri(props.uri)(state),
|
||||||
rewardedContentClaimIds: selectRewardContentClaimIds(state),
|
rewardedContentClaimIds: selectRewardContentClaimIds(state),
|
||||||
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||||
|
|||||||
@@ -40,10 +40,12 @@ class FileItem extends React.PureComponent {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
|
blackListedOutpoints,
|
||||||
claim,
|
claim,
|
||||||
title,
|
title,
|
||||||
thumbnail,
|
thumbnail,
|
||||||
fileInfo,
|
fileInfo,
|
||||||
|
filteredOutpoints,
|
||||||
metadata,
|
metadata,
|
||||||
isResolvingUri,
|
isResolvingUri,
|
||||||
rewardedContentClaimIds,
|
rewardedContentClaimIds,
|
||||||
@@ -58,7 +60,17 @@ class FileItem extends React.PureComponent {
|
|||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (claim && claim.value_type === 'channel') {
|
if (claim && claim.value_type === 'channel') {
|
||||||
// don't display channels in the lists on the Explore page
|
// don't display channels in the lists on the Your tags page
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
let shouldHide = false;
|
||||||
|
if (blackListedOutpoints || filteredOutpoints) {
|
||||||
|
const outpointsToHide = blackListedOutpoints.concat(filteredOutpoints);
|
||||||
|
shouldHide = outpointsToHide.some(outpoint => outpoint.txid === claim.txid && outpoint.nout === claim.nout);
|
||||||
|
}
|
||||||
|
if (shouldHide) {
|
||||||
|
// don't display blacklisted or filtered outpoints on the Your tags page
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class FileRewardsDriver extends React.PureComponent<Props> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={filePageStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
<TouchableOpacity style={filePageStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||||
<Icon name="award" size={16} style={filePageStyle.rewardIcon} />
|
<Icon name="award" size={16} style={filePageStyle.rewardDriverIcon} />
|
||||||
<Text style={filePageStyle.rewardDriverText}>Earn some credits to access this content.</Text>
|
<Text style={filePageStyle.rewardDriverText}>Earn some credits to access this content.</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class FloatingWalletBalance extends React.PureComponent<Props> {
|
|||||||
<Icon name="coins" size={12} style={floatingButtonStyle.balanceIcon} />
|
<Icon name="coins" size={12} style={floatingButtonStyle.balanceIcon} />
|
||||||
{isNaN(balance) && <ActivityIndicator size="small" color={Colors.White} />}
|
{isNaN(balance) && <ActivityIndicator size="small" color={Colors.White} />}
|
||||||
{(!isNaN(balance) || balance === 0) && (
|
{(!isNaN(balance) || balance === 0) && (
|
||||||
<Text style={floatingButtonStyle.text}>{formatCredits(parseFloat(balance), 0, true)}</Text>
|
<Text style={floatingButtonStyle.text}>{formatCredits(parseFloat(balance), 1, true)}</Text>
|
||||||
)}
|
)}
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { connect } from 'react-redux';
|
||||||
|
import ModalSuggestedSubscriptions from './view';
|
||||||
|
|
||||||
|
export default connect()(ModalSuggestedSubscriptions);
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
||||||
|
import modalStyle from 'styles/modal';
|
||||||
|
import subscriptionsStyle from 'styles/subscriptions';
|
||||||
|
import Button from 'component/button';
|
||||||
|
import Colors from 'styles/colors';
|
||||||
|
import SuggestedSubscriptions from 'component/suggestedSubscriptions';
|
||||||
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
|
|
||||||
|
export default class ModalSuggestedSubcriptions extends React.PureComponent {
|
||||||
|
render() {
|
||||||
|
const { navigation, onDonePress, onOverlayPress } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TouchableOpacity style={modalStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
|
||||||
|
<TouchableOpacity style={[modalStyle.container, subscriptionsStyle.modalContainer]} activeOpacity={1}>
|
||||||
|
<SuggestedSubscriptions inModal navigation={navigation} />
|
||||||
|
<View style={modalStyle.buttons}>
|
||||||
|
<Button style={modalStyle.doneButton} text={'Done'} onPress={onDonePress} />
|
||||||
|
</View>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</TouchableOpacity>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -55,7 +55,7 @@ export default class ModalTagSelector extends React.PureComponent {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={modalTagSelectorStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
|
<TouchableOpacity style={modalTagSelectorStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
|
||||||
<View style={modalTagSelectorStyle.container}>
|
<TouchableOpacity style={modalTagSelectorStyle.container} activeOpacity={1}>
|
||||||
<View style={modalTagSelectorStyle.titleRow}>
|
<View style={modalTagSelectorStyle.titleRow}>
|
||||||
<Text style={modalTagSelectorStyle.title}>Customize your tags</Text>
|
<Text style={modalTagSelectorStyle.title}>Customize your tags</Text>
|
||||||
</View>
|
</View>
|
||||||
@@ -75,7 +75,7 @@ export default class ModalTagSelector extends React.PureComponent {
|
|||||||
<View style={modalTagSelectorStyle.buttons}>
|
<View style={modalTagSelectorStyle.buttons}>
|
||||||
<Button style={modalTagSelectorStyle.doneButton} text={'Done'} onPress={onDonePress} />
|
<Button style={modalTagSelectorStyle.doneButton} text={'Done'} onPress={onDonePress} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</TouchableOpacity>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import Colors from 'styles/colors';
|
|||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import publishStyle from 'styles/publish';
|
import publishStyle from 'styles/publish';
|
||||||
|
|
||||||
class PublishRewadsDriver extends React.PureComponent<Props> {
|
class PublishRewardsDriver extends React.PureComponent<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
|
|
||||||
@@ -17,4 +17,4 @@ class PublishRewadsDriver extends React.PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PublishRewadsDriver;
|
export default PublishRewardsDriver;
|
||||||
@@ -59,7 +59,8 @@ class RewardCard extends React.PureComponent<Props> {
|
|||||||
getDisplayAmount = () => {
|
getDisplayAmount = () => {
|
||||||
const { reward } = this.props;
|
const { reward } = this.props;
|
||||||
if (reward) {
|
if (reward) {
|
||||||
if (reward.reward_range && reward.reward_range.includes('-')) {
|
const claimed = !!reward.transaction_id;
|
||||||
|
if (!claimed && reward.reward_range && reward.reward_range.includes('-')) {
|
||||||
return reward.reward_range.split('-')[0] + '+'; // ex: 5+
|
return reward.reward_range.split('-')[0] + '+'; // ex: 5+
|
||||||
} else if (reward.reward_amount > 0) {
|
} else if (reward.reward_amount > 0) {
|
||||||
return reward.reward_amount;
|
return reward.reward_amount;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doClaimSearch, selectFetchingClaimSearch, selectClaimSearchByQuery, selectFollowedTags } from 'lbry-redux';
|
import { doClaimSearch, selectFetchingClaimSearch, selectClaimSearchByQuery, selectFollowedTags } from 'lbry-redux';
|
||||||
import { selectSuggestedChannels, selectIsFetchingSuggested } from 'lbryinc';
|
import { selectSuggestedChannels, selectIsFetchingSuggested } from 'lbryinc';
|
||||||
|
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||||
import SuggestedSubscriptions from './view';
|
import SuggestedSubscriptions from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
@@ -8,6 +9,7 @@ const select = state => ({
|
|||||||
suggested: selectSuggestedChannels(state),
|
suggested: selectSuggestedChannels(state),
|
||||||
loading: selectIsFetchingSuggested(state) || selectFetchingClaimSearch(state),
|
loading: selectIsFetchingSuggested(state) || selectFetchingClaimSearch(state),
|
||||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||||
|
showNsfwContent: selectShowNsfw(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ActivityIndicator, FlatList, SectionList, Text, View } from 'react-native';
|
import { ActivityIndicator, SectionList, Text, View } from 'react-native';
|
||||||
import { createNormalizedClaimSearchKey, normalizeURI } from 'lbry-redux';
|
import { MATURE_TAGS, createNormalizedClaimSearchKey, normalizeURI } from 'lbry-redux';
|
||||||
import { __, navigateToUri } from 'utils/helper';
|
import { __, navigateToUri } from 'utils/helper';
|
||||||
import SubscribeButton from 'component/subscribeButton';
|
import SubscribeButton from 'component/subscribeButton';
|
||||||
import SuggestedSubscriptionItem from 'component/suggestedSubscriptionItem';
|
import SuggestedSubscriptionItem from 'component/suggestedSubscriptionItem';
|
||||||
@@ -16,13 +16,16 @@ class SuggestedSubscriptions extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { claimSearch, followedTags } = this.props;
|
const { claimSearch, followedTags, showNsfwContent } = this.props;
|
||||||
const options = {
|
const options = {
|
||||||
any_tags: _.shuffle(followedTags.map(tag => tag.name)).slice(0, 3),
|
any_tags: _.shuffle(followedTags.map(tag => tag.name)).slice(0, 3),
|
||||||
page: 1,
|
page: 1,
|
||||||
no_totals: true,
|
no_totals: true,
|
||||||
claim_type: 'channel',
|
claim_type: 'channel',
|
||||||
};
|
};
|
||||||
|
if (!showNsfwContent) {
|
||||||
|
options.not_tags = MATURE_TAGS;
|
||||||
|
}
|
||||||
this.setState({ options });
|
this.setState({ options });
|
||||||
claimSearch(options);
|
claimSearch(options);
|
||||||
}
|
}
|
||||||
@@ -35,7 +38,7 @@ class SuggestedSubscriptions extends React.PureComponent {
|
|||||||
const suggestedUris = suggested ? suggested.map(suggested => suggested.uri) : [];
|
const suggestedUris = suggested ? suggested.map(suggested => suggested.uri) : [];
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
title: __('Tags you follow'),
|
title: __('Suggested channels'),
|
||||||
data: claimSearchUris ? claimSearchUris.filter(uri => !suggestedUris.includes(uri)) : [],
|
data: claimSearchUris ? claimSearchUris.filter(uri => !suggestedUris.includes(uri)) : [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -46,7 +49,7 @@ class SuggestedSubscriptions extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { suggested, loading, navigation } = this.props;
|
const { suggested, inModal, loading, navigation } = this.props;
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
@@ -58,8 +61,10 @@ class SuggestedSubscriptions extends React.PureComponent {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<SectionList
|
<SectionList
|
||||||
style={subscriptionsStyle.scrollContainer}
|
style={inModal ? subscriptionsStyle.modalScrollContainer : subscriptionsStyle.scrollContainer}
|
||||||
contentContainerStyle={subscriptionsStyle.suggestedScrollPadding}
|
contentContainerStyle={
|
||||||
|
inModal ? subscriptionsStyle.modalSuggestedScrollContent : subscriptionsStyle.suggestedScrollContent
|
||||||
|
}
|
||||||
renderItem={({ item, index, section }) => (
|
renderItem={({ item, index, section }) => (
|
||||||
<SuggestedSubscriptionItem key={item} uri={normalizeURI(item)} navigation={navigation} />
|
<SuggestedSubscriptionItem key={item} uri={normalizeURI(item)} navigation={navigation} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import {
|
|||||||
selectSearchState as selectSearch,
|
selectSearchState as selectSearch,
|
||||||
selectSearchValue,
|
selectSearchValue,
|
||||||
selectSearchSuggestions,
|
selectSearchSuggestions,
|
||||||
|
SETTINGS,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { selectCurrentRoute } from 'redux/selectors/drawer';
|
import { selectCurrentRoute } from 'redux/selectors/drawer';
|
||||||
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import UriBar from './view';
|
import UriBar from './view';
|
||||||
|
|
||||||
const select = state => {
|
const select = state => {
|
||||||
@@ -16,6 +18,7 @@ const select = state => {
|
|||||||
query: selectSearchValue(state),
|
query: selectSearchValue(state),
|
||||||
currentRoute: selectCurrentRoute(state),
|
currentRoute: selectCurrentRoute(state),
|
||||||
suggestions: selectSearchSuggestions(state),
|
suggestions: selectSearchSuggestions(state),
|
||||||
|
showUriBarSuggestions: makeSelectClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS)(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ class UriBarItem extends React.PureComponent {
|
|||||||
icon = <Icon name="search" size={18} />;
|
icon = <Icon name="search" size={18} />;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SEARCH_TYPES.TAG:
|
||||||
|
icon = <Icon name="hashtag" size={18} />;
|
||||||
|
break;
|
||||||
|
|
||||||
case SEARCH_TYPES.FILE:
|
case SEARCH_TYPES.FILE:
|
||||||
default:
|
default:
|
||||||
icon = <Icon name="file" size={18} />;
|
icon = <Icon name="file" size={18} />;
|
||||||
@@ -37,6 +41,7 @@ class UriBarItem extends React.PureComponent {
|
|||||||
{type === SEARCH_TYPES.SEARCH && `Search for '${value}'`}
|
{type === SEARCH_TYPES.SEARCH && `Search for '${value}'`}
|
||||||
{type === SEARCH_TYPES.CHANNEL && `View the @${shorthand} channel`}
|
{type === SEARCH_TYPES.CHANNEL && `View the @${shorthand} channel`}
|
||||||
{type === SEARCH_TYPES.FILE && `View content at ${value}`}
|
{type === SEARCH_TYPES.FILE && `View content at ${value}`}
|
||||||
|
{type === SEARCH_TYPES.TAG && `Explore the '${value}' tag`}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { SEARCH_TYPES, isNameValid, isURIValid, normalizeURI } from 'lbry-redux';
|
import { SEARCH_TYPES, isNameValid, isURIValid, normalizeURI } from 'lbry-redux';
|
||||||
import { FlatList, Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
import { Dimensions, FlatList, Keyboard, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
||||||
import { navigateToUri, transformUrl } from 'utils/helper';
|
import { navigateToUri, transformUrl } from 'utils/helper';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import UriBarItem from './internal/uri-bar-item';
|
import UriBarItem from './internal/uri-bar-item';
|
||||||
@@ -14,6 +14,8 @@ class UriBar extends React.PureComponent {
|
|||||||
|
|
||||||
textInput = null;
|
textInput = null;
|
||||||
|
|
||||||
|
keyboardDidShowListener = null;
|
||||||
|
|
||||||
keyboardDidHideListener = null;
|
keyboardDidHideListener = null;
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
@@ -21,17 +23,19 @@ class UriBar extends React.PureComponent {
|
|||||||
currentValue: null,
|
currentValue: null,
|
||||||
inputText: null,
|
inputText: null,
|
||||||
focused: false,
|
focused: false,
|
||||||
|
keyboardHeight: 0,
|
||||||
// TODO: Add a setting to enable / disable direct search?
|
|
||||||
directSearch: true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
|
||||||
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
|
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
|
||||||
this.setSelection();
|
this.setSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
if (this.keyboardDidShowListener) {
|
||||||
|
this.keyboardDidShowListener.remove();
|
||||||
|
}
|
||||||
if (this.keyboardDidHideListener) {
|
if (this.keyboardDidHideListener) {
|
||||||
this.keyboardDidHideListener.remove();
|
this.keyboardDidHideListener.remove();
|
||||||
}
|
}
|
||||||
@@ -49,25 +53,28 @@ class UriBar extends React.PureComponent {
|
|||||||
handleChangeText = text => {
|
handleChangeText = text => {
|
||||||
const newValue = text || '';
|
const newValue = text || '';
|
||||||
clearTimeout(this.state.changeTextTimeout);
|
clearTimeout(this.state.changeTextTimeout);
|
||||||
const { updateSearchQuery, onSearchSubmitted, navigation } = this.props;
|
const { updateSearchQuery, onSearchSubmitted, showUriBarSuggestions, navigation } = this.props;
|
||||||
|
|
||||||
let timeout = setTimeout(() => {
|
updateSearchQuery(text);
|
||||||
if (text.trim().length === 0) {
|
|
||||||
// don't do anything if the text is empty
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateSearchQuery(text);
|
let timeout = -1;
|
||||||
|
if (!showUriBarSuggestions) {
|
||||||
if (!text.startsWith('lbry://')) {
|
timeout = setTimeout(() => {
|
||||||
// not a URI input, so this is a search, perform a direct search
|
if (text.trim().length === 0) {
|
||||||
if (onSearchSubmitted) {
|
// don't do anything if the text is empty
|
||||||
onSearchSubmitted(text);
|
return;
|
||||||
} else {
|
|
||||||
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: text } });
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}, UriBar.INPUT_TIMEOUT);
|
if (!text.startsWith('lbry://')) {
|
||||||
|
// not a URI input, so this is a search, perform a direct search
|
||||||
|
if (onSearchSubmitted) {
|
||||||
|
onSearchSubmitted(text);
|
||||||
|
} else {
|
||||||
|
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: text } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, UriBar.INPUT_TIMEOUT);
|
||||||
|
}
|
||||||
this.setState({ inputText: newValue, currentValue: newValue, changeTextTimeout: timeout });
|
this.setState({ inputText: newValue, currentValue: newValue, changeTextTimeout: timeout });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -86,18 +93,34 @@ class UriBar extends React.PureComponent {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
navigation.navigate({ routeName: 'Search', key: 'searchPage', params: { searchQuery: value } });
|
navigation.navigate({
|
||||||
|
routeName: Constants.DRAWER_ROUTE_SEARCH,
|
||||||
|
key: 'searchPage',
|
||||||
|
params: { searchQuery: value },
|
||||||
|
});
|
||||||
|
} else if (SEARCH_TYPES.TAG === type) {
|
||||||
|
navigation.navigate({
|
||||||
|
routeName: Constants.DRAWER_ROUTE_TAG,
|
||||||
|
key: 'tagPage',
|
||||||
|
params: {
|
||||||
|
tag: value.toLowerCase(),
|
||||||
|
},
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
const uri = normalizeURI(value);
|
const uri = normalizeURI(value);
|
||||||
navigateToUri(navigation, uri);
|
navigateToUri(navigation, uri);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_keyboardDidShow = evt => {
|
||||||
|
this.setState({ keyboardHeight: evt.endCoordinates.height });
|
||||||
|
};
|
||||||
|
|
||||||
_keyboardDidHide = () => {
|
_keyboardDidHide = () => {
|
||||||
if (this.textInput) {
|
if (this.textInput) {
|
||||||
this.textInput.blur();
|
this.textInput.blur();
|
||||||
}
|
}
|
||||||
this.setState({ focused: false });
|
this.setState({ focused: false, keyboardHeight: 0 });
|
||||||
};
|
};
|
||||||
|
|
||||||
setSelection() {
|
setSelection() {
|
||||||
@@ -152,16 +175,18 @@ class UriBar extends React.PureComponent {
|
|||||||
selectedItemCount,
|
selectedItemCount,
|
||||||
selectionMode,
|
selectionMode,
|
||||||
suggestions,
|
suggestions,
|
||||||
|
showUriBarSuggestions,
|
||||||
value,
|
value,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
if (this.state.currentValue === null) {
|
if (this.state.currentValue === null) {
|
||||||
this.setState({ currentValue: value });
|
this.setState({ currentValue: value });
|
||||||
}
|
}
|
||||||
|
|
||||||
let style = [uriBarStyle.overlay, belowOverlay ? null : uriBarStyle.overlayElevated];
|
let style = [
|
||||||
|
uriBarStyle.overlay,
|
||||||
// TODO: Add optional setting to enable URI / search bar suggestions
|
belowOverlay ? null : uriBarStyle.overlayElevated,
|
||||||
/* if (this.state.focused) { style.push(uriBarStyle.inFocus); } */
|
this.state.focused && showUriBarSuggestions ? uriBarStyle.inFocus : null,
|
||||||
|
];
|
||||||
|
|
||||||
// TODO: selectionModeActions should be dynamically created / specified
|
// TODO: selectionModeActions should be dynamically created / specified
|
||||||
return (
|
return (
|
||||||
@@ -248,20 +273,21 @@ class UriBar extends React.PureComponent {
|
|||||||
onSubmitEditing={this.handleSubmitEditing}
|
onSubmitEditing={this.handleSubmitEditing}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{this.state.focused && !this.state.directSearch && (
|
|
||||||
<View style={uriBarStyle.suggestions}>
|
|
||||||
<FlatList
|
|
||||||
style={uriBarStyle.suggestionList}
|
|
||||||
data={suggestions}
|
|
||||||
keyboardShouldPersistTaps={'handled'}
|
|
||||||
keyExtractor={(item, value) => item.value}
|
|
||||||
renderItem={({ item }) => (
|
|
||||||
<UriBarItem item={item} navigation={navigation} onPress={() => this.handleItemPress(item)} />
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
|
{this.state.focused && showUriBarSuggestions && (
|
||||||
|
<FlatList
|
||||||
|
style={[
|
||||||
|
uriBarStyle.suggestions,
|
||||||
|
{ height: Dimensions.get('window').height - this.state.keyboardHeight - 60 },
|
||||||
|
]}
|
||||||
|
data={suggestions}
|
||||||
|
keyboardShouldPersistTaps={'handled'}
|
||||||
|
keyExtractor={(item, value) => `${item.value}-${item.type}`}
|
||||||
|
renderItem={({ item }) => (
|
||||||
|
<UriBarItem item={item} navigation={navigation} onPress={() => this.handleItemPress(item)} />
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -32,7 +32,7 @@ const Constants = {
|
|||||||
ABOUT_TAB: 'about',
|
ABOUT_TAB: 'about',
|
||||||
|
|
||||||
KEY_FIRST_RUN_EMAIL: 'firstRunEmail',
|
KEY_FIRST_RUN_EMAIL: 'firstRunEmail',
|
||||||
KEY_FIRST_RUN_PASSWORD: 'firstRunPassword',
|
KEY_WALLET_PASSWORD: 'firstRunPassword',
|
||||||
KEY_FIRST_USER_AUTH: 'firstUserAuth',
|
KEY_FIRST_USER_AUTH: 'firstUserAuth',
|
||||||
KEY_SHOULD_VERIFY_EMAIL: 'shouldVerifyEmail',
|
KEY_SHOULD_VERIFY_EMAIL: 'shouldVerifyEmail',
|
||||||
KEY_EMAIL_VERIFY_PENDING: 'emailVerifyPending',
|
KEY_EMAIL_VERIFY_PENDING: 'emailVerifyPending',
|
||||||
@@ -138,6 +138,8 @@ const Constants = {
|
|||||||
MORE_PLACEHOLDER: '_more',
|
MORE_PLACEHOLDER: '_more',
|
||||||
|
|
||||||
TRUE_STRING: 'true',
|
TRUE_STRING: 'true',
|
||||||
|
|
||||||
|
MINIMUM_TRANSACTION_BALANCE: 0.1,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Constants;
|
export default Constants;
|
||||||
|
|||||||
+60
-21
@@ -4,6 +4,8 @@ import { Provider, connect } from 'react-redux';
|
|||||||
import { AppRegistry, Text, View, NativeModules } from 'react-native';
|
import { AppRegistry, Text, View, NativeModules } from 'react-native';
|
||||||
import {
|
import {
|
||||||
Lbry,
|
Lbry,
|
||||||
|
buildSharedStateMiddleware,
|
||||||
|
blockedReducer,
|
||||||
claimsReducer,
|
claimsReducer,
|
||||||
contentReducer,
|
contentReducer,
|
||||||
fileReducer,
|
fileReducer,
|
||||||
@@ -13,18 +15,24 @@ import {
|
|||||||
searchReducer,
|
searchReducer,
|
||||||
tagsReducer,
|
tagsReducer,
|
||||||
walletReducer,
|
walletReducer,
|
||||||
|
ACTIONS as LBRY_REDUX_ACTIONS,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
|
Lbryio,
|
||||||
authReducer,
|
authReducer,
|
||||||
blacklistReducer,
|
blacklistReducer,
|
||||||
costInfoReducer,
|
costInfoReducer,
|
||||||
|
doGetSync,
|
||||||
filteredReducer,
|
filteredReducer,
|
||||||
homepageReducer,
|
homepageReducer,
|
||||||
rewardsReducer,
|
rewardsReducer,
|
||||||
|
selectUserVerifiedEmail,
|
||||||
subscriptionsReducer,
|
subscriptionsReducer,
|
||||||
syncReducer,
|
syncReducer,
|
||||||
userReducer,
|
userReducer,
|
||||||
|
LBRYINC_ACTIONS,
|
||||||
} from 'lbryinc';
|
} from 'lbryinc';
|
||||||
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import { createStore, applyMiddleware, compose } from 'redux';
|
import { createStore, applyMiddleware, compose } from 'redux';
|
||||||
import AppWithNavigationState, {
|
import AppWithNavigationState, {
|
||||||
AppNavigator,
|
AppNavigator,
|
||||||
@@ -32,6 +40,7 @@ import AppWithNavigationState, {
|
|||||||
reactNavigationMiddleware,
|
reactNavigationMiddleware,
|
||||||
} from 'component/AppNavigator';
|
} from 'component/AppNavigator';
|
||||||
import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist';
|
import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist';
|
||||||
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
|
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
|
||||||
import FilesystemStorage from 'redux-persist-filesystem-storage';
|
import FilesystemStorage from 'redux-persist-filesystem-storage';
|
||||||
import createCompressor from 'redux-persist-transform-compress';
|
import createCompressor from 'redux-persist-transform-compress';
|
||||||
@@ -79,18 +88,27 @@ function enableBatching(reducer) {
|
|||||||
|
|
||||||
const compressor = createCompressor();
|
const compressor = createCompressor();
|
||||||
const authFilter = createFilter('auth', ['authToken']);
|
const authFilter = createFilter('auth', ['authToken']);
|
||||||
|
const blockedFilter = createFilter('blocked', ['blockedChannels']);
|
||||||
const contentFilter = createFilter('content', ['positions']);
|
const contentFilter = createFilter('content', ['positions']);
|
||||||
const saveClaimsFilter = createFilter('claims', ['claimsByUri']);
|
const saveClaimsFilter = createFilter('claims', ['claimsByUri']);
|
||||||
const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions']);
|
const subscriptionsFilter = createFilter('subscriptions', ['enabledChannelNotifications', 'subscriptions', 'latest']);
|
||||||
const settingsFilter = createFilter('settings', ['clientSettings']);
|
const settingsFilter = createFilter('settings', ['clientSettings']);
|
||||||
const tagsFilter = createFilter('tags', ['followedTags']);
|
const tagsFilter = createFilter('tags', ['followedTags']);
|
||||||
const walletFilter = createFilter('wallet', ['receiveAddress']);
|
const walletFilter = createFilter('wallet', ['receiveAddress']);
|
||||||
|
|
||||||
const v4PersistOptions = {
|
const v4PersistOptions = {
|
||||||
whitelist: ['auth', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
|
whitelist: ['auth', 'blocked', 'claims', 'content', 'subscriptions', 'settings', 'tags', 'wallet'],
|
||||||
// Order is important. Needs to be compressed last or other transforms can't
|
// Order is important. Needs to be compressed last or other transforms can't
|
||||||
// read the data
|
// read the data
|
||||||
transforms: [authFilter, saveClaimsFilter, subscriptionsFilter, settingsFilter, walletFilter, compressor],
|
transforms: [
|
||||||
|
authFilter,
|
||||||
|
blockedFilter,
|
||||||
|
saveClaimsFilter,
|
||||||
|
subscriptionsFilter,
|
||||||
|
settingsFilter,
|
||||||
|
walletFilter,
|
||||||
|
compressor,
|
||||||
|
],
|
||||||
debounce: 10000,
|
debounce: 10000,
|
||||||
storage: FilesystemStorage,
|
storage: FilesystemStorage,
|
||||||
};
|
};
|
||||||
@@ -103,6 +121,7 @@ const persistOptions = Object.assign({}, v4PersistOptions, {
|
|||||||
const reducers = persistCombineReducers(persistOptions, {
|
const reducers = persistCombineReducers(persistOptions, {
|
||||||
auth: authReducer,
|
auth: authReducer,
|
||||||
blacklist: blacklistReducer,
|
blacklist: blacklistReducer,
|
||||||
|
blocked: blockedReducer,
|
||||||
claims: claimsReducer,
|
claims: claimsReducer,
|
||||||
content: contentReducer,
|
content: contentReducer,
|
||||||
costInfo: costInfoReducer,
|
costInfo: costInfoReducer,
|
||||||
@@ -125,8 +144,45 @@ const reducers = persistCombineReducers(persistOptions, {
|
|||||||
wallet: walletReducer,
|
wallet: walletReducer,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* source: the reducer name
|
||||||
|
* property: the property in the reducer-specific state
|
||||||
|
* transform: optional method to modify the value to be stored
|
||||||
|
*/
|
||||||
|
const sharedStateActions = [
|
||||||
|
LBRYINC_ACTIONS.CHANNEL_SUBSCRIBE,
|
||||||
|
LBRYINC_ACTIONS.CHANNEL_UNSUBSCRIBE,
|
||||||
|
LBRY_REDUX_ACTIONS.CREATE_CHANNEL_COMPLETED,
|
||||||
|
LBRY_REDUX_ACTIONS.TOGGLE_TAG_FOLLOW,
|
||||||
|
LBRY_REDUX_ACTIONS.TOGGLE_BLOCK_CHANNEL,
|
||||||
|
];
|
||||||
|
const sharedStateFilters = {
|
||||||
|
tags: { source: 'tags', property: 'followedTags' },
|
||||||
|
subscriptions: {
|
||||||
|
source: 'subscriptions',
|
||||||
|
property: 'subscriptions',
|
||||||
|
transform: function(value) {
|
||||||
|
return value.map(({ uri }) => uri);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
blocked: { source: 'blocked', property: 'blockedChannels' },
|
||||||
|
};
|
||||||
|
|
||||||
|
const sharedStateCallback = ({ dispatch, getState }) => {
|
||||||
|
const state = getState();
|
||||||
|
const syncEnabled = makeSelectClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED)(state);
|
||||||
|
const emailVerified = selectUserVerifiedEmail(state);
|
||||||
|
if (syncEnabled && emailVerified) {
|
||||||
|
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password =>
|
||||||
|
dispatch(doGetSync(password))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const sharedStateMiddleware = buildSharedStateMiddleware(sharedStateActions, sharedStateFilters, sharedStateCallback);
|
||||||
|
|
||||||
const bulkThunk = createBulkThunkMiddleware();
|
const bulkThunk = createBulkThunkMiddleware();
|
||||||
const middleware = [thunk, bulkThunk, reactNavigationMiddleware];
|
const middleware = [sharedStateMiddleware, thunk, bulkThunk, reactNavigationMiddleware];
|
||||||
|
|
||||||
// eslint-disable-next-line no-underscore-dangle
|
// eslint-disable-next-line no-underscore-dangle
|
||||||
const composeEnhancers = compose;
|
const composeEnhancers = compose;
|
||||||
@@ -145,23 +201,6 @@ const persistor = persistStore(store, persistOptions, err => {
|
|||||||
});
|
});
|
||||||
window.persistor = persistor;
|
window.persistor = persistor;
|
||||||
|
|
||||||
/*
|
|
||||||
const persistFilter = {
|
|
||||||
'auth': ['authToken'],
|
|
||||||
'claims': ['byId', 'claimsByUri'],
|
|
||||||
'content': ['positions'],
|
|
||||||
'subscriptions': ['enabledChannelNotifications', 'subscriptions'],
|
|
||||||
'settings': ['clientSettings'],
|
|
||||||
'tags': ['followedTags'],
|
|
||||||
'wallet': ['receiveAddress']
|
|
||||||
};
|
|
||||||
|
|
||||||
store.subscribe(() => {
|
|
||||||
const state = (({ auth, claims, content, subscriptions, settings, tags, wallet }) =>
|
|
||||||
({ auth, claims, content, subscriptions, settings, tags, wallet }))(store.getState());
|
|
||||||
NativeModules.StatePersistor.update(state, persistFilter);
|
|
||||||
}); */
|
|
||||||
|
|
||||||
// TODO: Find i18n module that is compatible with react-native
|
// TODO: Find i18n module that is compatible with react-native
|
||||||
global.__ = str => str;
|
global.__ = str => str;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { makeSelectClaimForUri, selectMyChannelClaims } from 'lbry-redux';
|
import { doAbandonClaim, doFetchChannelListMine, makeSelectClaimForUri, selectMyChannelClaims } from 'lbry-redux';
|
||||||
import { doPopDrawerStack } from 'redux/actions/drawer';
|
import { doPopDrawerStack } from 'redux/actions/drawer';
|
||||||
import { doSetSortByItem, doSetTimeItem } from 'redux/actions/settings';
|
import { doSetSortByItem, doSetTimeItem } from 'redux/actions/settings';
|
||||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||||
@@ -15,6 +15,8 @@ const select = (state, props) => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
||||||
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||||
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
||||||
setSortByItem: item => dispatch(doSetSortByItem(item)),
|
setSortByItem: item => dispatch(doSetSortByItem(item)),
|
||||||
setTimeItem: item => dispatch(doSetTimeItem(item)),
|
setTimeItem: item => dispatch(doSetTimeItem(item)),
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import ClaimList from 'component/claimList';
|
|||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
import EmptyStateView from 'component/emptyStateView';
|
||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import Link from 'component/link';
|
import Link from 'component/link';
|
||||||
import ModalPicker from 'component/modalPicker';
|
import ModalPicker from 'component/modalPicker';
|
||||||
@@ -47,7 +48,9 @@ class ChannelPage extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const { fetchChannelListMine } = this.props;
|
||||||
NativeModules.Firebase.setCurrentScreen('Channel');
|
NativeModules.Firebase.setCurrentScreen('Channel');
|
||||||
|
fetchChannelListMine();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSortByItemSelected = item => {
|
handleSortByItemSelected = item => {
|
||||||
@@ -128,9 +131,7 @@ class ChannelPage extends React.PureComponent {
|
|||||||
return (
|
return (
|
||||||
<View style={channelPageStyle.aboutTab}>
|
<View style={channelPageStyle.aboutTab}>
|
||||||
{!websiteUrl && !email && !description && (
|
{!websiteUrl && !email && !description && (
|
||||||
<View style={channelPageStyle.busyContainer}>
|
<EmptyStateView message={"There's nothing here yet.\nPlease check back later."} />
|
||||||
<Text style={channelPageStyle.infoText}>Nothing here yet. Please check back later.</Text>
|
|
||||||
</View>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{(websiteUrl || email || description) && (
|
{(websiteUrl || email || description) && (
|
||||||
@@ -266,7 +267,7 @@ class ChannelPage extends React.PureComponent {
|
|||||||
)}
|
)}
|
||||||
{ownedChannel && (
|
{ownedChannel && (
|
||||||
<Button
|
<Button
|
||||||
style={channelPageStyle.deleteButton}
|
style={[channelPageStyle.actionButton, channelPageStyle.deleteButton]}
|
||||||
theme={'light'}
|
theme={'light'}
|
||||||
icon={'trash-alt'}
|
icon={'trash-alt'}
|
||||||
text={'Delete'}
|
text={'Delete'}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
doUpdateChannel,
|
doUpdateChannel,
|
||||||
doToast,
|
doToast,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
|
import { doGetSync } from 'lbryinc';
|
||||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
import { doUpdateChannelFormState, doClearChannelFormState } from 'redux/actions/form';
|
import { doUpdateChannelFormState, doClearChannelFormState } from 'redux/actions/form';
|
||||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||||
@@ -37,6 +38,7 @@ const perform = dispatch => ({
|
|||||||
clearChannelFormState: () => dispatch(doClearChannelFormState()),
|
clearChannelFormState: () => dispatch(doClearChannelFormState()),
|
||||||
createChannel: (name, amount, optionalParams) => dispatch(doCreateChannel(name, amount, optionalParams)),
|
createChannel: (name, amount, optionalParams) => dispatch(doCreateChannel(name, amount, optionalParams)),
|
||||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||||
|
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||||
updateChannel: params => dispatch(doUpdateChannel(params)),
|
updateChannel: params => dispatch(doUpdateChannel(params)),
|
||||||
updateChannelFormState: data => dispatch(doUpdateChannelFormState(data)),
|
updateChannelFormState: data => dispatch(doUpdateChannelFormState(data)),
|
||||||
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { CLAIM_VALUES, isURIValid, regexInvalidURI } from 'lbry-redux';
|
import { CLAIM_VALUES, isNameValid, regexInvalidURI } from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
Alert,
|
Alert,
|
||||||
@@ -14,11 +14,13 @@ import {
|
|||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { navigateToUri, uploadImageAsset } from 'utils/helper';
|
import { navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import ChannelIconItem from 'component/channelIconItem';
|
import ChannelIconItem from 'component/channelIconItem';
|
||||||
|
import ChannelRewardsDriver from 'component/channelRewardsDriver';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
import EmptyStateView from 'component/emptyStateView';
|
||||||
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import Link from 'component/link';
|
import Link from 'component/link';
|
||||||
@@ -30,9 +32,11 @@ import channelIconStyle from 'styles/channelIcon';
|
|||||||
import seedrandom from 'seedrandom';
|
import seedrandom from 'seedrandom';
|
||||||
|
|
||||||
export default class ChannelCreator extends React.PureComponent {
|
export default class ChannelCreator extends React.PureComponent {
|
||||||
|
scrollView = null;
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
autoStyle: null,
|
autoStyle: null,
|
||||||
canSave: false,
|
canSave: true,
|
||||||
claimId: null,
|
claimId: null,
|
||||||
currentSelectedValue: Constants.ITEM_ANONYMOUS,
|
currentSelectedValue: Constants.ITEM_ANONYMOUS,
|
||||||
currentPhase: null,
|
currentPhase: null,
|
||||||
@@ -100,11 +104,13 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
generateAutoStyles = size => {
|
generateAutoStyles = size => {
|
||||||
const { channels = [] } = this.props;
|
const { channels = [] } = this.props;
|
||||||
const autoStyles = [];
|
const autoStyles = [];
|
||||||
for (let i = 0; i < size && i < channels.length; i++) {
|
if (channels) {
|
||||||
// seed generator using the claim_id
|
for (let i = 0; i < size && i < channels.length; i++) {
|
||||||
const rng = seedrandom(channels[i].permanent_url); // is this efficient?
|
// seed generator using the claim_id
|
||||||
const index = Math.floor(rng.quick() * ChannelIconItem.AUTO_THUMB_STYLES.length);
|
const rng = seedrandom(channels[i].permanent_url); // is this efficient?
|
||||||
autoStyles.push(ChannelIconItem.AUTO_THUMB_STYLES[index]);
|
const index = Math.floor(rng.quick() * ChannelIconItem.AUTO_THUMB_STYLES.length);
|
||||||
|
autoStyles.push(ChannelIconItem.AUTO_THUMB_STYLES[index]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return autoStyles;
|
return autoStyles;
|
||||||
};
|
};
|
||||||
@@ -157,9 +163,6 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
if (!fetchingChannels) {
|
if (!fetchingChannels) {
|
||||||
fetchChannelListMine();
|
fetchChannelListMine();
|
||||||
}
|
}
|
||||||
if (balance > 0.1) {
|
|
||||||
this.setState({ canSave: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
DeviceEventEmitter.addListener('onDocumentPickerFilePicked', this.onFilePicked);
|
DeviceEventEmitter.addListener('onDocumentPickerFilePicked', this.onFilePicked);
|
||||||
DeviceEventEmitter.addListener('onDocumentPickerCanceled', this.onPickerCanceled);
|
DeviceEventEmitter.addListener('onDocumentPickerCanceled', this.onPickerCanceled);
|
||||||
@@ -175,10 +178,8 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
|
|
||||||
if (!isEditMode && hasFormState) {
|
if (!isEditMode && hasFormState) {
|
||||||
this.loadPendingFormState();
|
this.loadPendingFormState();
|
||||||
this.setState({ currentPhase: Constants.PHASE_CREATE });
|
|
||||||
} else {
|
|
||||||
this.setState({ currentPhase: Constants.PHASE_LIST });
|
|
||||||
}
|
}
|
||||||
|
this.setState({ currentPhase: isEditMode || hasFormState ? Constants.PHASE_CREATE : Constants.PHASE_LIST });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -240,7 +241,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
const { channels = [] } = this.props;
|
const { channels = [] } = this.props;
|
||||||
const { editChannelUrl } = this.state;
|
const { editChannelUrl } = this.state;
|
||||||
if (channels.length > 0) {
|
if (channels && channels.length > 0) {
|
||||||
if (this.state.autoStyles.length !== channels.length) {
|
if (this.state.autoStyles.length !== channels.length) {
|
||||||
this.setState({
|
this.setState({
|
||||||
autoStyles: this.generateAutoStyles(channels.length),
|
autoStyles: this.generateAutoStyles(channels.length),
|
||||||
@@ -337,7 +338,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
newChannelName = newChannelName.slice(1);
|
newChannelName = newChannelName.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newChannelName.trim().length > 0 && !isURIValid(newChannelName)) {
|
if (newChannelName.trim().length > 0 && !isNameValid(newChannelName)) {
|
||||||
newChannelNameError = 'Your channel name contains invalid characters.';
|
newChannelNameError = 'Your channel name contains invalid characters.';
|
||||||
} else if (this.channelExists(newChannelName)) {
|
} else if (this.channelExists(newChannelName)) {
|
||||||
newChannelNameError = 'You have already created a channel with the same name.';
|
newChannelNameError = 'You have already created a channel with the same name.';
|
||||||
@@ -374,7 +375,15 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handleCreateChannelClick = () => {
|
handleCreateChannelClick = () => {
|
||||||
const { balance, clearChannelFormState, createChannel, onChannelChange, notify, updateChannel } = this.props;
|
const {
|
||||||
|
balance,
|
||||||
|
clearChannelFormState,
|
||||||
|
createChannel,
|
||||||
|
onChannelChange,
|
||||||
|
getSync,
|
||||||
|
notify,
|
||||||
|
updateChannel,
|
||||||
|
} = this.props;
|
||||||
const {
|
const {
|
||||||
claimId,
|
claimId,
|
||||||
coverImageUrl,
|
coverImageUrl,
|
||||||
@@ -390,7 +399,17 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
website,
|
website,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
if (newChannelName.trim().length === 0 || !isURIValid(newChannelName.substr(1), false)) {
|
if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) {
|
||||||
|
notify({
|
||||||
|
message: 'Creating a channel requires credits. Press the blue bar to get some for free.',
|
||||||
|
});
|
||||||
|
if (this.scrollView) {
|
||||||
|
this.scrollView.scrollTo({ x: 0, y: 0, animated: true });
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newChannelName.trim().length === 0 || !isNameValid(newChannelName.substr(1), false)) {
|
||||||
notify({ message: 'Your channel name contains invalid characters.' });
|
notify({ message: 'Your channel name contains invalid characters.' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -421,7 +440,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
createChannelError: undefined,
|
createChannelError: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const success = () => {
|
const success = channelClaim => {
|
||||||
this.setState({
|
this.setState({
|
||||||
creatingChannel: false,
|
creatingChannel: false,
|
||||||
addingChannel: false,
|
addingChannel: false,
|
||||||
@@ -437,6 +456,8 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
clearChannelFormState();
|
clearChannelFormState();
|
||||||
notify({ message: 'The channel was successfully created.' });
|
notify({ message: 'The channel was successfully created.' });
|
||||||
this.showChannelList();
|
this.showChannelList();
|
||||||
|
|
||||||
|
logPublish(channelClaim);
|
||||||
};
|
};
|
||||||
|
|
||||||
const failure = () => {
|
const failure = () => {
|
||||||
@@ -454,8 +475,8 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
return { name: tag };
|
return { name: tag };
|
||||||
}),
|
}),
|
||||||
website,
|
website,
|
||||||
cover: coverImageUrl,
|
coverUrl: coverImageUrl,
|
||||||
thumbnail: thumbnailUrl,
|
thumbnailUrl: thumbnailUrl,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.state.editMode) {
|
if (this.state.editMode) {
|
||||||
@@ -479,12 +500,14 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
|
|
||||||
channelExists = name => {
|
channelExists = name => {
|
||||||
const { channels = [] } = this.props;
|
const { channels = [] } = this.props;
|
||||||
for (let channel of channels) {
|
if (channels) {
|
||||||
if (
|
for (let channel of channels) {
|
||||||
name.toLowerCase() === channel.name.toLowerCase() ||
|
if (
|
||||||
`@${name}`.toLowerCase() === channel.name.toLowerCase()
|
name.toLowerCase() === channel.name.toLowerCase() ||
|
||||||
) {
|
`@${name}`.toLowerCase() === channel.name.toLowerCase()
|
||||||
return true;
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,15 +557,17 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
showChannelList = () => {
|
showChannelList = () => {
|
||||||
const { popDrawerStack } = this.props;
|
const { drawerStack, popDrawerStack } = this.props;
|
||||||
popDrawerStack();
|
if (drawerStack[drawerStack.length - 1].route === Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM) {
|
||||||
this.resetChannelCreator();
|
popDrawerStack();
|
||||||
|
}
|
||||||
this.setState({ currentPhase: Constants.PHASE_LIST });
|
this.setState({ currentPhase: Constants.PHASE_LIST });
|
||||||
|
this.resetChannelCreator();
|
||||||
};
|
};
|
||||||
|
|
||||||
resetChannelCreator = () => {
|
resetChannelCreator = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
canSave: false,
|
canSave: true,
|
||||||
claimId: null,
|
claimId: null,
|
||||||
editMode: false,
|
editMode: false,
|
||||||
displayName: null,
|
displayName: null,
|
||||||
@@ -556,8 +581,8 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
newChannelBidError: '',
|
newChannelBidError: '',
|
||||||
createChannelError: undefined,
|
createChannelError: undefined,
|
||||||
showCreateChannel: false,
|
showCreateChannel: false,
|
||||||
thumbnailUrl: null,
|
thumbnailUrl: '',
|
||||||
coverImageUrl: null,
|
coverImageUrl: '',
|
||||||
avatarImagePickerOpen: false,
|
avatarImagePickerOpen: false,
|
||||||
coverImagePickerOpen: false,
|
coverImagePickerOpen: false,
|
||||||
|
|
||||||
@@ -599,15 +624,17 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
prepareEdit = channel => {
|
prepareEdit = channel => {
|
||||||
const { pushDrawerStack } = this.props;
|
const { balance, pushDrawerStack } = this.props;
|
||||||
const { value } = channel;
|
const { value } = channel;
|
||||||
|
|
||||||
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM);
|
pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM);
|
||||||
this.setState({
|
this.setState({
|
||||||
|
canSave: true,
|
||||||
claimId: channel.claim_id,
|
claimId: channel.claim_id,
|
||||||
currentPhase: Constants.PHASE_CREATE,
|
currentPhase: Constants.PHASE_CREATE,
|
||||||
|
displayName: value && value.title ? value.title : channel.name.substring(1),
|
||||||
editMode: true,
|
editMode: true,
|
||||||
coverImageUrl: value && value.cover ? value.cover.url : null,
|
coverImageUrl: value && value.cover ? value.cover.url : '',
|
||||||
currentChannelName: channel.name.substring(1),
|
currentChannelName: channel.name.substring(1),
|
||||||
newChannelName: channel.name.substring(1),
|
newChannelName: channel.name.substring(1),
|
||||||
newChannelTitle: value ? value.title : null,
|
newChannelTitle: value ? value.title : null,
|
||||||
@@ -616,7 +643,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
email: value ? value.email : null,
|
email: value ? value.email : null,
|
||||||
website: value ? value.website_url : null,
|
website: value ? value.website_url : null,
|
||||||
tags: value && value.tags ? value.tags : [],
|
tags: value && value.tags ? value.tags : [],
|
||||||
thumbnailUrl: value && value.thumbnail ? value.thumbnail.url : null,
|
thumbnailUrl: value && value.thumbnail ? value.thumbnail.url : '',
|
||||||
showOptionalFields: value && (value.description || value.email || value.website_url || value.tags),
|
showOptionalFields: value && (value.description || value.email || value.website_url || value.tags),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -722,7 +749,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { abandoningClaimIds, fetchingChannels, updatingChannel, channels = [], navigation } = this.props;
|
const { abandoningClaimIds, balance, fetchingChannels, updatingChannel, channels = [], navigation } = this.props;
|
||||||
const {
|
const {
|
||||||
autoStyle,
|
autoStyle,
|
||||||
autoStyles,
|
autoStyles,
|
||||||
@@ -744,6 +771,8 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
uploadingImage,
|
uploadingImage,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
|
const hasChannels = channels && channels.length > 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={channelCreatorStyle.container}>
|
<View style={channelCreatorStyle.container}>
|
||||||
<UriBar
|
<UriBar
|
||||||
@@ -756,34 +785,34 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
onExitSelectionMode={this.onExitSelectionMode}
|
onExitSelectionMode={this.onExitSelectionMode}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{fetchingChannels && (
|
||||||
|
<View style={channelCreatorStyle.loading}>
|
||||||
|
<ActivityIndicator size={'large'} color={Colors.NextLbryGreen} />
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{currentPhase === Constants.PHASE_LIST && !fetchingChannels && !hasChannels && (
|
||||||
|
<EmptyStateView
|
||||||
|
message={'You have not created a channel.\nStart now by creating a new channel!'}
|
||||||
|
buttonText={'Create a channel'}
|
||||||
|
onButtonPress={this.handleNewChannelPress}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{currentPhase === Constants.PHASE_LIST && (
|
{currentPhase === Constants.PHASE_LIST && (
|
||||||
<FlatList
|
<FlatList
|
||||||
extraData={this.state}
|
extraData={this.state}
|
||||||
ListHeaderComponent={
|
ListFooterComponent={
|
||||||
fetchingChannels ? (
|
!channels || channels.length === 0 ? null : (
|
||||||
<View style={channelCreatorStyle.listHeader}>
|
<View style={channelCreatorStyle.listFooter}>
|
||||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
<Button
|
||||||
</View>
|
style={channelCreatorStyle.createChannelButton}
|
||||||
) : null
|
text={'Create a channel'}
|
||||||
}
|
onPress={this.handleNewChannelPress}
|
||||||
ListEmptyComponent={
|
/>
|
||||||
fetchingChannels ? null : (
|
|
||||||
<View style={channelCreatorStyle.listEmpty}>
|
|
||||||
<Text style={channelCreatorStyle.listEmptyText}>
|
|
||||||
You have not created a channel. Start now by creating a new channel!
|
|
||||||
</Text>
|
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
ListFooterComponent={
|
|
||||||
<View style={channelCreatorStyle.listFooter}>
|
|
||||||
<Button
|
|
||||||
style={channelCreatorStyle.createChannelButton}
|
|
||||||
text={'Create a channel'}
|
|
||||||
onPress={this.handleNewChannelPress}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
}
|
|
||||||
style={channelCreatorStyle.scrollContainer}
|
style={channelCreatorStyle.scrollContainer}
|
||||||
contentContainerStyle={channelCreatorStyle.scrollPadding}
|
contentContainerStyle={channelCreatorStyle.scrollPadding}
|
||||||
initialNumToRender={10}
|
initialNumToRender={10}
|
||||||
@@ -825,13 +854,13 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
data={channels.filter(channel => !abandoningClaimIds.includes(channel.claim_id))}
|
data={channels ? channels.filter(channel => !abandoningClaimIds.includes(channel.claim_id)) : []}
|
||||||
keyExtractor={(item, index) => item.claim_id}
|
keyExtractor={(item, index) => item.claim_id}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{currentPhase === Constants.PHASE_CREATE && (
|
{currentPhase === Constants.PHASE_CREATE && (
|
||||||
<ScrollView style={channelCreatorStyle.createChannelContainer}>
|
<ScrollView ref={ref => (this.scrollView = ref)} style={channelCreatorStyle.createChannelContainer}>
|
||||||
<View style={channelCreatorStyle.imageSelectors}>
|
<View style={channelCreatorStyle.imageSelectors}>
|
||||||
<TouchableOpacity style={channelCreatorStyle.coverImageTouchArea} onPress={this.onCoverImagePress}>
|
<TouchableOpacity style={channelCreatorStyle.coverImageTouchArea} onPress={this.onCoverImagePress}>
|
||||||
<Image
|
<Image
|
||||||
@@ -864,7 +893,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
source={{ uri: thumbnailUrl }}
|
source={{ uri: thumbnailUrl }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{thumbnailUrl !== null && thumbnailUrl.trim().length === 0 && newChannelName.length > 1 && (
|
{(thumbnailUrl === null || thumbnailUrl.trim().length === 0) && newChannelName.length > 0 && (
|
||||||
<Text style={channelIconStyle.autothumbCharacter}>
|
<Text style={channelIconStyle.autothumbCharacter}>
|
||||||
{newChannelName.substring(0, 1).toUpperCase()}
|
{newChannelName.substring(0, 1).toUpperCase()}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -876,6 +905,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
{balance < Constants.MINIMUM_TRANSACTION_BALANCE && <ChannelRewardsDriver navigation={navigation} />}
|
||||||
|
|
||||||
<View style={channelCreatorStyle.card}>
|
<View style={channelCreatorStyle.card}>
|
||||||
<View style={channelCreatorStyle.textInputLayout}>
|
<View style={channelCreatorStyle.textInputLayout}>
|
||||||
@@ -903,7 +933,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
<View>
|
<View>
|
||||||
<Text style={channelCreatorStyle.channelAt}>@</Text>
|
<Text style={channelCreatorStyle.channelAt}>@</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
editable={canSave && !creatingChannel && !updatingChannel}
|
editable={canSave && !editMode && !creatingChannel && !updatingChannel}
|
||||||
style={channelCreatorStyle.channelNameInput}
|
style={channelCreatorStyle.channelNameInput}
|
||||||
value={this.state.newChannelName}
|
value={this.state.newChannelName}
|
||||||
onChangeText={value => this.handleNewChannelNameChange(value, true)}
|
onChangeText={value => this.handleNewChannelNameChange(value, true)}
|
||||||
@@ -917,6 +947,10 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
{newChannelNameError.length > 0 && (
|
{newChannelNameError.length > 0 && (
|
||||||
<Text style={channelCreatorStyle.inlineError}>{newChannelNameError}</Text>
|
<Text style={channelCreatorStyle.inlineError}>{newChannelNameError}</Text>
|
||||||
)}
|
)}
|
||||||
|
{editMode && (
|
||||||
|
<Text style={channelCreatorStyle.helpText}>The channel name cannot be changed while editing.</Text>
|
||||||
|
)}
|
||||||
|
|
||||||
<View style={channelCreatorStyle.bidRow}>
|
<View style={channelCreatorStyle.bidRow}>
|
||||||
<Text style={channelCreatorStyle.label}>Deposit</Text>
|
<Text style={channelCreatorStyle.label}>Deposit</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
@@ -1031,7 +1065,7 @@ export default class ChannelCreator extends React.PureComponent {
|
|||||||
<Link style={channelCreatorStyle.cancelLink} text="Cancel" onPress={this.handleCreateCancel} />
|
<Link style={channelCreatorStyle.cancelLink} text="Cancel" onPress={this.handleCreateCancel} />
|
||||||
<Button
|
<Button
|
||||||
style={channelCreatorStyle.createButton}
|
style={channelCreatorStyle.createButton}
|
||||||
disabled={!canSave || uploadingImage || !newChannelName || newChannelName.trim().length === 0}
|
disabled={!canSave || uploadingImage}
|
||||||
text={editMode ? 'Update' : 'Create'}
|
text={editMode ? 'Update' : 'Create'}
|
||||||
onPress={this.handleCreateChannelClick}
|
onPress={this.handleCreateChannelClick}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {
|
|||||||
selectSubscriptionClaims,
|
selectSubscriptionClaims,
|
||||||
selectUnreadSubscriptions,
|
selectUnreadSubscriptions,
|
||||||
} from 'lbryinc';
|
} from 'lbryinc';
|
||||||
|
import { doPushDrawerStack } from 'redux/actions/drawer';
|
||||||
import { doSetClientSetting, doSetSortByItem, doSetTimeItem } from 'redux/actions/settings';
|
import { doSetClientSetting, doSetSortByItem, doSetTimeItem } from 'redux/actions/settings';
|
||||||
import { makeSelectClientSetting, selectSortByItem, selectTimeItem } from 'redux/selectors/settings';
|
import { makeSelectClientSetting, selectSortByItem, selectTimeItem } from 'redux/selectors/settings';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
@@ -37,6 +38,7 @@ const perform = dispatch => ({
|
|||||||
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
||||||
fetchSubscriptions: () => dispatch(doFetchMySubscriptions()),
|
fetchSubscriptions: () => dispatch(doFetchMySubscriptions()),
|
||||||
fileList: () => dispatch(doFileList()),
|
fileList: () => dispatch(doFileList()),
|
||||||
|
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_DISCOVER)),
|
||||||
removeUnreadSubscriptions: () => dispatch(doRemoveUnreadSubscriptions()),
|
removeUnreadSubscriptions: () => dispatch(doRemoveUnreadSubscriptions()),
|
||||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||||
setSortByItem: item => dispatch(doSetSortByItem(item)),
|
setSortByItem: item => dispatch(doSetSortByItem(item)),
|
||||||
|
|||||||
+53
-46
@@ -38,8 +38,6 @@ class DiscoverPage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
NativeModules.Firebase.setCurrentScreen('Your tags');
|
|
||||||
|
|
||||||
// Track the total time taken if this is the first launch
|
// Track the total time taken if this is the first launch
|
||||||
AsyncStorage.getItem('firstLaunchTime').then(startTime => {
|
AsyncStorage.getItem('firstLaunchTime').then(startTime => {
|
||||||
if (startTime !== null && !isNaN(parseInt(startTime, 10))) {
|
if (startTime !== null && !isNaN(parseInt(startTime, 10))) {
|
||||||
@@ -63,17 +61,39 @@ class DiscoverPage extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const { sortByItem, fetchRewardedContent, fetchSubscriptions, fileList, followedTags } = this.props;
|
const { sortByItem, fetchRewardedContent, fileList, followedTags } = this.props;
|
||||||
|
|
||||||
this.buildTagCollection(followedTags);
|
this.buildTagCollection(followedTags);
|
||||||
fetchRewardedContent();
|
fetchRewardedContent();
|
||||||
fetchSubscriptions();
|
|
||||||
fileList();
|
fileList();
|
||||||
|
|
||||||
this.handleSortByItemSelected(sortByItem);
|
this.handleSortByItemSelected(sortByItem);
|
||||||
this.showRatingReminder();
|
this.showRatingReminder();
|
||||||
|
|
||||||
|
this.onComponentFocused();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
const { currentRoute: prevRoute, followedTags: prevFollowedTags } = this.props;
|
||||||
|
const { currentRoute, followedTags } = nextProps;
|
||||||
|
|
||||||
|
if (Constants.DRAWER_ROUTE_DISCOVER === currentRoute && currentRoute !== prevRoute) {
|
||||||
|
this.onComponentFocused();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_.isEqual(followedTags, prevFollowedTags)) {
|
||||||
|
this.buildTagCollection(followedTags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onComponentFocused = () => {
|
||||||
|
const { fetchSubscriptions, pushDrawerStack } = this.props;
|
||||||
|
// pushDrawerStack();
|
||||||
|
NativeModules.Firebase.setCurrentScreen('Your tags').then(result => {
|
||||||
|
fetchSubscriptions();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
handleSortByItemSelected = item => {
|
handleSortByItemSelected = item => {
|
||||||
const { setSortByItem } = this.props;
|
const { setSortByItem } = this.props;
|
||||||
setSortByItem(item);
|
setSortByItem(item);
|
||||||
@@ -104,56 +124,43 @@ class DiscoverPage extends React.PureComponent {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
|
||||||
const { followedTags: prevFollowedTags } = this.props;
|
|
||||||
const { followedTags } = nextProps;
|
|
||||||
if (!_.isEqual(followedTags, prevFollowedTags)) {
|
|
||||||
this.buildTagCollection(followedTags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
const { unreadSubscriptions, enabledChannelNotifications } = this.props;
|
const { unreadSubscriptions, enabledChannelNotifications } = this.props;
|
||||||
|
|
||||||
const utility = NativeModules.UtilityModule;
|
const utility = NativeModules.UtilityModule;
|
||||||
if (utility) {
|
const hasUnread =
|
||||||
const hasUnread =
|
prevProps.unreadSubscriptions &&
|
||||||
prevProps.unreadSubscriptions &&
|
prevProps.unreadSubscriptions.length !== unreadSubscriptions.length &&
|
||||||
prevProps.unreadSubscriptions.length !== unreadSubscriptions.length &&
|
unreadSubscriptions.length > 0;
|
||||||
unreadSubscriptions.length > 0;
|
|
||||||
|
|
||||||
if (hasUnread) {
|
if (hasUnread) {
|
||||||
unreadSubscriptions.map(({ channel, uris }) => {
|
unreadSubscriptions.map(({ channel, uris }) => {
|
||||||
const { claimName: channelName } = parseURI(channel);
|
const { claimName: channelName } = parseURI(channel);
|
||||||
|
|
||||||
// check if notifications are enabled for the channel
|
// check if notifications are enabled for the channel
|
||||||
if (enabledChannelNotifications.indexOf(channelName) > -1) {
|
if (enabledChannelNotifications.includes(channelName)) {
|
||||||
uris.forEach(uri => {
|
uris.forEach(uri => {
|
||||||
Lbry.resolve({ urls: uri }).then(result => {
|
Lbry.resolve({ urls: uri }).then(result => {
|
||||||
const sub = result[uri].claim;
|
const sub = result[uri];
|
||||||
if (sub && sub.value && sub.value.stream) {
|
|
||||||
let isPlayable = false;
|
if (sub && sub.value) {
|
||||||
const source = sub.value.stream.source;
|
const { source, title, thumbnail } = sub.value;
|
||||||
const metadata = sub.value.stream.metadata;
|
const isPlayable =
|
||||||
if (source) {
|
source && source.media_type && ['audio', 'video'].includes(source.media_type.substring(0, 5));
|
||||||
isPlayable =
|
if (title) {
|
||||||
source.contentType && ['audio', 'video'].indexOf(source.contentType.substring(0, 5)) > -1;
|
utility.showNotificationForContent(
|
||||||
}
|
uri,
|
||||||
if (metadata) {
|
title,
|
||||||
utility.showNotificationForContent(
|
channelName,
|
||||||
uri,
|
thumbnail ? thumbnail.url : null,
|
||||||
metadata.title,
|
isPlayable
|
||||||
channelName,
|
);
|
||||||
metadata.thumbnail,
|
|
||||||
isPlayable
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { __, navigateToUri, uriFromFileInfo } from 'utils/helper';
|
|||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import PageHeader from 'component/pageHeader';
|
import PageHeader from 'component/pageHeader';
|
||||||
|
import EmptyStateView from 'component/emptyStateView';
|
||||||
import FileListItem from 'component/fileListItem';
|
import FileListItem from 'component/fileListItem';
|
||||||
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
||||||
import StorageStatsCard from 'component/storageStatsCard';
|
import StorageStatsCard from 'component/storageStatsCard';
|
||||||
@@ -154,6 +155,10 @@ class DownloadsPage extends React.PureComponent {
|
|||||||
onDeleteActionPressed={this.onDeleteActionPressed}
|
onDeleteActionPressed={this.onDeleteActionPressed}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{!fetching && !hasDownloads && (
|
||||||
|
<EmptyStateView message={'You do not have any\ndownloaded content on this device.'} />
|
||||||
|
)}
|
||||||
|
|
||||||
<View style={downloadsStyle.subContainer}>
|
<View style={downloadsStyle.subContainer}>
|
||||||
{hasDownloads && <StorageStatsCard fileInfos={this.getFilteredFileInfos()} />}
|
{hasDownloads && <StorageStatsCard fileInfos={this.getFilteredFileInfos()} />}
|
||||||
{fetching && (
|
{fetching && (
|
||||||
@@ -161,11 +166,7 @@ class DownloadsPage extends React.PureComponent {
|
|||||||
<ActivityIndicator size="large" color={Colors.NextLbryGreen} style={downloadsStyle.loading} />
|
<ActivityIndicator size="large" color={Colors.NextLbryGreen} style={downloadsStyle.loading} />
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{!fetching && !hasDownloads && (
|
|
||||||
<View style={downloadsStyle.busyContainer}>
|
|
||||||
<Text style={downloadsStyle.noDownloadsText}>You do not have any downloaded content on this device.</Text>
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
{!fetching && hasDownloads && (
|
{!fetching && hasDownloads && (
|
||||||
<FlatList
|
<FlatList
|
||||||
extraData={this.state}
|
extraData={this.state}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
|
doAbandonClaim,
|
||||||
doFetchFileInfo,
|
doFetchFileInfo,
|
||||||
doFetchChannelListMine,
|
doFetchChannelListMine,
|
||||||
doFetchClaimListMine,
|
doFetchClaimListMine,
|
||||||
@@ -73,6 +74,7 @@ const select = (state, props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
||||||
claimEligibleRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
claimEligibleRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
||||||
deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => {
|
deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => {
|
||||||
dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim));
|
dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim));
|
||||||
|
|||||||
+77
-19
@@ -6,6 +6,7 @@ import {
|
|||||||
Alert,
|
Alert,
|
||||||
DeviceEventEmitter,
|
DeviceEventEmitter,
|
||||||
Dimensions,
|
Dimensions,
|
||||||
|
Linking,
|
||||||
NativeModules,
|
NativeModules,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
StatusBar,
|
StatusBar,
|
||||||
@@ -22,6 +23,7 @@ import { navigateBack, navigateToUri } from 'utils/helper';
|
|||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import ImageViewer from 'react-native-image-zoom-viewer';
|
import ImageViewer from 'react-native-image-zoom-viewer';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
import EmptyStateView from 'component/emptyStateView';
|
||||||
import Tag from 'component/tag';
|
import Tag from 'component/tag';
|
||||||
import ChannelPage from 'page/channel';
|
import ChannelPage from 'page/channel';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
@@ -100,7 +102,7 @@ class FilePage extends React.PureComponent {
|
|||||||
DeviceEventEmitter.addListener('onDownloadUpdated', this.handleDownloadUpdated);
|
DeviceEventEmitter.addListener('onDownloadUpdated', this.handleDownloadUpdated);
|
||||||
DeviceEventEmitter.addListener('onDownloadCompleted', this.handleDownloadCompleted);
|
DeviceEventEmitter.addListener('onDownloadCompleted', this.handleDownloadCompleted);
|
||||||
|
|
||||||
const { fetchChannelListMine, fileInfo, isResolvingUri, resolveUri, navigation } = this.props;
|
const { fetchMyClaims, fileInfo, isResolvingUri, resolveUri, navigation } = this.props;
|
||||||
const { uri, uriVars } = navigation.state.params;
|
const { uri, uriVars } = navigation.state.params;
|
||||||
this.setState({ uri, uriVars });
|
this.setState({ uri, uriVars });
|
||||||
|
|
||||||
@@ -108,7 +110,7 @@ class FilePage extends React.PureComponent {
|
|||||||
|
|
||||||
this.fetchFileInfo(this.props);
|
this.fetchFileInfo(this.props);
|
||||||
this.fetchCostInfo(this.props);
|
this.fetchCostInfo(this.props);
|
||||||
fetchChannelListMine();
|
fetchMyClaims();
|
||||||
|
|
||||||
if (NativeModules.Firebase) {
|
if (NativeModules.Firebase) {
|
||||||
NativeModules.Firebase.track('open_file_page', { uri: uri });
|
NativeModules.Firebase.track('open_file_page', { uri: uri });
|
||||||
@@ -239,7 +241,7 @@ class FilePage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onDeletePressed = () => {
|
onDeletePressed = () => {
|
||||||
const { claim, deleteFile, deletePurchasedUri, fileInfo, navigation } = this.props;
|
const { abandonClaim, claim, deleteFile, deletePurchasedUri, myClaimUris, fileInfo, navigation } = this.props;
|
||||||
|
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
'Delete file',
|
'Delete file',
|
||||||
@@ -261,6 +263,16 @@ class FilePage extends React.PureComponent {
|
|||||||
mediaLoaded: false,
|
mediaLoaded: false,
|
||||||
stopDownloadConfirmed: false,
|
stopDownloadConfirmed: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (claim) {
|
||||||
|
const fullUri = normalizeURI(`${claim.name}#${claim.claim_id}`);
|
||||||
|
const ownedClaim = myClaimUris.includes(fullUri);
|
||||||
|
if (ownedClaim) {
|
||||||
|
const { txid, nout } = claim;
|
||||||
|
abandonClaim(txid, nout);
|
||||||
|
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISHES });
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -496,6 +508,20 @@ class FilePage extends React.PureComponent {
|
|||||||
this.setState({ fileViewLogged: true });
|
this.setState({ fileViewLogged: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: Move this to lbry-redux
|
||||||
|
formatLbryUrlForWeb = url => {
|
||||||
|
return url.replace('lbry://', '/').replace(/#/g, ':');
|
||||||
|
};
|
||||||
|
|
||||||
|
handleSharePress = () => {
|
||||||
|
const { claim, notify } = this.props;
|
||||||
|
if (claim) {
|
||||||
|
const { canonical_url: canonicalUrl, short_url: shortUrl, permanent_url: permanentUrl } = claim;
|
||||||
|
const url = 'https://open.lbry.com' + this.formatLbryUrlForWeb(canonicalUrl || shortUrl || permanentUrl);
|
||||||
|
NativeModules.UtilityModule.shareUrl(url);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
handleSendTip = () => {
|
handleSendTip = () => {
|
||||||
const { claim, balance, navigation, notify, sendTip } = this.props;
|
const { claim, balance, navigation, notify, sendTip } = this.props;
|
||||||
const { uri } = navigation.state.params;
|
const { uri } = navigation.state.params;
|
||||||
@@ -590,14 +616,15 @@ class FilePage extends React.PureComponent {
|
|||||||
} = this.props;
|
} = this.props;
|
||||||
const { uri, autoplay } = navigation.state.params;
|
const { uri, autoplay } = navigation.state.params;
|
||||||
|
|
||||||
|
const { isChannel } = parseURI(uri);
|
||||||
const myChannelUris = channels ? channels.map(channel => channel.permanent_url) : [];
|
const myChannelUris = channels ? channels.map(channel => channel.permanent_url) : [];
|
||||||
const ownedClaim = myClaimUris.includes(uri) || myChannelUris.includes(uri);
|
const ownedClaim = myClaimUris.includes(uri) || myChannelUris.includes(uri);
|
||||||
const { isChannel } = parseURI(uri);
|
|
||||||
|
|
||||||
let innerContent = null;
|
let innerContent = null;
|
||||||
if ((isResolvingUri && !claim) || !claim) {
|
if ((isResolvingUri && !claim) || !claim) {
|
||||||
return (
|
return (
|
||||||
<View style={filePageStyle.container}>
|
<View style={filePageStyle.container}>
|
||||||
|
<UriBar value={uri} navigation={navigation} />
|
||||||
{isResolvingUri && (
|
{isResolvingUri && (
|
||||||
<View style={filePageStyle.busyContainer}>
|
<View style={filePageStyle.busyContainer}>
|
||||||
<ActivityIndicator size="large" color={Colors.NextLbryGreen} />
|
<ActivityIndicator size="large" color={Colors.NextLbryGreen} />
|
||||||
@@ -607,16 +634,29 @@ class FilePage extends React.PureComponent {
|
|||||||
{claim === null && !isResolvingUri && (
|
{claim === null && !isResolvingUri && (
|
||||||
<View style={filePageStyle.container}>
|
<View style={filePageStyle.container}>
|
||||||
{ownedClaim && (
|
{ownedClaim && (
|
||||||
<Text style={filePageStyle.emptyClaimText}>
|
<EmptyStateView
|
||||||
{isChannel
|
message={
|
||||||
? 'It looks like you just created this channel. It will appear in a few minutes.'
|
isChannel
|
||||||
: 'It looks you just published this content. It will appear in a few minutes.'}
|
? 'It looks like you just created this channel. It will appear in a few minutes.'
|
||||||
</Text>
|
: 'It looks you just published this content. It will appear in a few minutes.'
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{!ownedClaim && (
|
||||||
|
<EmptyStateView
|
||||||
|
message={"There's nothing at this location."}
|
||||||
|
buttonText={'Publish something here'}
|
||||||
|
onButtonPress={() =>
|
||||||
|
navigation.navigate({
|
||||||
|
routeName: Constants.DRAWER_ROUTE_PUBLISH,
|
||||||
|
params: { vanityUrl: uri.trim() },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
{!ownedClaim && <Text style={filePageStyle.emptyClaimText}>There's nothing at this location.</Text>}
|
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
<UriBar value={uri} navigation={navigation} />
|
<FloatingWalletBalance navigation={navigation} />
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -859,11 +899,11 @@ class FilePage extends React.PureComponent {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{completed && (
|
{(completed || canEdit) && (
|
||||||
<Button
|
<Button
|
||||||
style={filePageStyle.actionButton}
|
style={filePageStyle.actionButton}
|
||||||
theme={'light'}
|
theme={'light'}
|
||||||
icon={'trash'}
|
icon={'trash-alt'}
|
||||||
text={'Delete'}
|
text={'Delete'}
|
||||||
onPress={this.onDeletePressed}
|
onPress={this.onDeletePressed}
|
||||||
/>
|
/>
|
||||||
@@ -907,6 +947,30 @@ class FilePage extends React.PureComponent {
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</TouchableWithoutFeedback>
|
</TouchableWithoutFeedback>
|
||||||
|
|
||||||
|
<View style={filePageStyle.largeButtonsRow}>
|
||||||
|
<TouchableOpacity style={filePageStyle.largeButton} onPress={this.handleSharePress}>
|
||||||
|
<Icon name={'share-alt'} size={20} style={filePageStyle.largeButtonIcon} />
|
||||||
|
<Text style={filePageStyle.largeButtonText}>Share</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
<TouchableOpacity
|
||||||
|
style={filePageStyle.largeButton}
|
||||||
|
onPress={() => this.setState({ showTipView: true })}
|
||||||
|
>
|
||||||
|
<Icon name={'gift'} size={20} style={filePageStyle.largeButtonIcon} />
|
||||||
|
<Text style={filePageStyle.largeButtonText}>Tip</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
<TouchableOpacity
|
||||||
|
style={filePageStyle.largeButton}
|
||||||
|
onPress={() => Linking.openURL(`https://lbry.com/dmca/${claim.claim_id}`)}
|
||||||
|
>
|
||||||
|
<Icon name={'flag'} size={20} style={filePageStyle.largeButtonIcon} />
|
||||||
|
<Text style={filePageStyle.largeButtonText}>Report</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
|
||||||
<View style={filePageStyle.channelRow}>
|
<View style={filePageStyle.channelRow}>
|
||||||
<View style={filePageStyle.publishInfo}>
|
<View style={filePageStyle.publishInfo}>
|
||||||
{channelName && (
|
{channelName && (
|
||||||
@@ -943,12 +1007,6 @@ class FilePage extends React.PureComponent {
|
|||||||
onPress={this.onSaveFilePressed}
|
onPress={this.onSaveFilePressed}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Button
|
|
||||||
style={[filePageStyle.actionButton, filePageStyle.tipButton]}
|
|
||||||
theme={'light'}
|
|
||||||
icon={'gift'}
|
|
||||||
onPress={() => this.setState({ showTipView: true })}
|
|
||||||
/>
|
|
||||||
{channelName && (
|
{channelName && (
|
||||||
<SubscribeButton
|
<SubscribeButton
|
||||||
style={filePageStyle.actionButton}
|
style={filePageStyle.actionButton}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
doAuthenticate,
|
doAuthenticate,
|
||||||
doCheckSync,
|
doCheckSync,
|
||||||
doGetSync,
|
doGetSync,
|
||||||
doSetDefaultAccount,
|
|
||||||
doSyncApply,
|
doSyncApply,
|
||||||
doUserEmailNew,
|
doUserEmailNew,
|
||||||
doUserResendVerificationEmail,
|
doUserResendVerificationEmail,
|
||||||
@@ -41,12 +40,11 @@ const select = state => ({
|
|||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
||||||
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)),
|
authenticate: (appVersion, os, firebaseToken) => dispatch(doAuthenticate(appVersion, os, firebaseToken)),
|
||||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||||
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
||||||
getSync: password => dispatch(doGetSync(password)),
|
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||||
checkSync: () => dispatch(doCheckSync()),
|
checkSync: () => dispatch(doCheckSync()),
|
||||||
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
|
|
||||||
notify: data => dispatch(doToast(data)),
|
notify: data => dispatch(doToast(data)),
|
||||||
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants';
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import firstRunStyle from 'styles/firstRun';
|
import firstRunStyle from 'styles/firstRun';
|
||||||
|
|
||||||
@@ -45,8 +45,8 @@ class SkipAccountPage extends React.PureComponent {
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<Text style={firstRunStyle.rowParagraph}>
|
<Text style={firstRunStyle.rowParagraph}>
|
||||||
I understand that by uninstalling LBRY I will lose any balances or published content with no recovery
|
I understand that by uninstalling LBRY I will lose any balances or published content with no recovery option
|
||||||
option.
|
if it is not backed up manually (see wallet page)
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
import { BarPasswordStrengthDisplay } from 'react-native-password-strength-meter';
|
import { BarPasswordStrengthDisplay } from 'react-native-password-strength-meter';
|
||||||
import AsyncStorage from '@react-native-community/async-storage';
|
import AsyncStorage from '@react-native-community/async-storage';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants';
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import firstRunStyle from 'styles/firstRun';
|
import firstRunStyle from 'styles/firstRun';
|
||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
|
|
||||||
@@ -62,7 +62,14 @@ class WalletPage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { onPasswordChanged, onWalletViewLayout, getSyncIsPending, hasSyncedWallet, syncApplyIsPending } = this.props;
|
const {
|
||||||
|
onPasswordChanged,
|
||||||
|
onWalletViewLayout,
|
||||||
|
getSyncIsPending,
|
||||||
|
hasSyncedWallet,
|
||||||
|
syncApplyIsPending,
|
||||||
|
syncApplyStarted,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
let content;
|
let content;
|
||||||
if (!this.state.walletReady || !this.state.hasCheckedSync || getSyncIsPending) {
|
if (!this.state.walletReady || !this.state.hasCheckedSync || getSyncIsPending) {
|
||||||
@@ -72,11 +79,11 @@ class WalletPage extends React.PureComponent {
|
|||||||
<Text style={firstRunStyle.paragraph}>Retrieving your account information...</Text>
|
<Text style={firstRunStyle.paragraph}>Retrieving your account information...</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
} else if (syncApplyIsPending) {
|
} else if (syncApplyStarted || syncApplyIsPending) {
|
||||||
content = (
|
content = (
|
||||||
<View style={firstRunStyle.centered}>
|
<View style={firstRunStyle.centered}>
|
||||||
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
|
<ActivityIndicator size="large" color={Colors.White} style={firstRunStyle.waiting} />
|
||||||
<Text style={firstRunStyle.paragraph}>Validating password...</Text>
|
<Text style={firstRunStyle.paragraph}>{syncApplyIsPending ? 'Validating password' : 'Synchronizing'}...</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Lbry } from 'lbry-redux';
|
|||||||
import { ActivityIndicator, NativeModules, Platform, Text, View } from 'react-native';
|
import { ActivityIndicator, NativeModules, Platform, Text, View } from 'react-native';
|
||||||
import AsyncStorage from '@react-native-community/async-storage';
|
import AsyncStorage from '@react-native-community/async-storage';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants';
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import firstRunStyle from 'styles/firstRun';
|
import firstRunStyle from 'styles/firstRun';
|
||||||
|
|
||||||
class WelcomePage extends React.PureComponent {
|
class WelcomePage extends React.PureComponent {
|
||||||
@@ -25,7 +25,7 @@ class WelcomePage extends React.PureComponent {
|
|||||||
} else {
|
} else {
|
||||||
// first_user_auth because it's the first time
|
// first_user_auth because it's the first time
|
||||||
AsyncStorage.getItem(Constants.KEY_FIRST_USER_AUTH).then(firstUserAuth => {
|
AsyncStorage.getItem(Constants.KEY_FIRST_USER_AUTH).then(firstUserAuth => {
|
||||||
if ('true' !== firstUserAuth) {
|
if (firstUserAuth !== 'true') {
|
||||||
// first_user_auth
|
// first_user_auth
|
||||||
NativeModules.Firebase.track('first_user_auth', null);
|
NativeModules.Firebase.track('first_user_auth', null);
|
||||||
AsyncStorage.setItem(Constants.KEY_FIRST_USER_AUTH, 'true');
|
AsyncStorage.setItem(Constants.KEY_FIRST_USER_AUTH, 'true');
|
||||||
@@ -44,31 +44,39 @@ class WelcomePage extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startAuthenticating = () => {
|
startAuthenticating = () => {
|
||||||
const { authenticate } = this.props;
|
|
||||||
this.setState({ authenticationStarted: true, authenticationFailed: false });
|
this.setState({ authenticationStarted: true, authenticationFailed: false });
|
||||||
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
|
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
|
||||||
Lbry.status()
|
NativeModules.Firebase.getMessagingToken()
|
||||||
.then(info => {
|
.then(firebaseToken => this.performAuthenticate(appVersion, firebaseToken))
|
||||||
this.setState({ sdkStarted: true });
|
.catch(() => {
|
||||||
|
this.performAuthenticate(appVersion); /* proceed without firebase */
|
||||||
authenticate(appVersion, Platform.OS);
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
if (this.state.statusTries >= WelcomePage.MAX_STATUS_TRIES) {
|
|
||||||
this.setState({ authenticationFailed: true });
|
|
||||||
|
|
||||||
// sdk_start_failed
|
|
||||||
NativeModules.Firebase.track('sdk_start_failed', null);
|
|
||||||
} else {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.startAuthenticating();
|
|
||||||
this.setState({ statusTries: this.state.statusTries + 1 });
|
|
||||||
}, 1000); // Retry every second for a maximum of MAX_STATUS_TRIES tries (60 seconds)
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
performAuthenticate(appVersion, firebaseToken) {
|
||||||
|
const { authenticate } = this.props;
|
||||||
|
Lbry.status()
|
||||||
|
.then(info => {
|
||||||
|
this.setState({ sdkStarted: true });
|
||||||
|
|
||||||
|
authenticate(appVersion, Platform.OS, firebaseToken);
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
if (this.state.statusTries >= WelcomePage.MAX_STATUS_TRIES) {
|
||||||
|
this.setState({ authenticationFailed: true });
|
||||||
|
|
||||||
|
// sdk_start_failed
|
||||||
|
NativeModules.Firebase.track('sdk_start_failed', null);
|
||||||
|
} else {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.startAuthenticating();
|
||||||
|
this.setState({ statusTries: this.state.statusTries + 1 });
|
||||||
|
}, 1000); // Retry every second for a maximum of MAX_STATUS_TRIES tries (60 seconds)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { authenticating, authToken, onWelcomePageLayout } = this.props;
|
const { authenticating, authToken, onWelcomePageLayout } = this.props;
|
||||||
|
|
||||||
|
|||||||
+39
-27
@@ -66,7 +66,7 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
const { emailNewErrorMessage, emailNewPending, syncApplyErrorMessage, syncApplyIsPending, user } = nextProps;
|
const { emailNewErrorMessage, emailNewPending, syncApplyErrorMessage, syncApplyIsPending, user } = nextProps;
|
||||||
const { notify, isApplyingSync, setClientSetting, setDefaultAccount } = this.props;
|
const { notify, isApplyingSync, setClientSetting } = this.props;
|
||||||
|
|
||||||
if (this.state.emailSubmitted && !emailNewPending) {
|
if (this.state.emailSubmitted && !emailNewPending) {
|
||||||
this.setState({ emailSubmitted: false });
|
this.setState({ emailSubmitted: false });
|
||||||
@@ -80,31 +80,34 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.syncApplyStarted && !syncApplyIsPending) {
|
if (this.state.syncApplyStarted && !syncApplyIsPending) {
|
||||||
this.setState({ syncApplyStarted: false });
|
|
||||||
if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) {
|
if (syncApplyErrorMessage && syncApplyErrorMessage.trim().length > 0) {
|
||||||
notify({ message: syncApplyErrorMessage, isError: true });
|
notify({ message: syncApplyErrorMessage, isError: true });
|
||||||
this.setState({ showBottomContainer: true });
|
this.setState({ showBottomContainer: true, syncApplyStarted: false });
|
||||||
} else {
|
} else {
|
||||||
// password successfully verified
|
// password successfully verified
|
||||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, this.state.walletPassword);
|
NativeModules.UtilityModule.setSecureValue(
|
||||||
setDefaultAccount(
|
Constants.KEY_WALLET_PASSWORD,
|
||||||
() => {
|
this.state.walletPassword ? this.state.walletPassword : ''
|
||||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
|
||||||
|
|
||||||
// unlock the wallet
|
|
||||||
Lbry.account_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' })
|
|
||||||
.then(() => this.closeFinalPage())
|
|
||||||
.catch(err =>
|
|
||||||
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
|
|
||||||
);
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
notify({
|
|
||||||
message:
|
|
||||||
'The account restore operation could not be completed successfully. Please restart the app and try again.',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||||
|
Lbry.wallet_status().then(status => {
|
||||||
|
// unlock the wallet
|
||||||
|
if (status.is_locked) {
|
||||||
|
Lbry.wallet_unlock({ password: this.state.walletPassword ? this.state.walletPassword : '' }).then(
|
||||||
|
unlocked => {
|
||||||
|
if (unlocked) {
|
||||||
|
this.closeFinalPage();
|
||||||
|
} else {
|
||||||
|
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// wallet not locked. close final page
|
||||||
|
this.closeFinalPage();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,9 +133,9 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
const resetAction = StackActions.reset({
|
const resetAction = StackActions.reset({
|
||||||
index: 0,
|
index: 0,
|
||||||
actions: [NavigationActions.navigate({ routeName: 'Splash', params: { launchUri: this.state.launchUri } })],
|
actions: [NavigationActions.navigate({ routeName: 'Splash', params: { launchUri: this.state.launchUrl } })],
|
||||||
});
|
});
|
||||||
navigation.dispatch(resetAction);
|
setTimeout(() => navigation.dispatch(resetAction), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLeftButtonPressed = () => {
|
handleLeftButtonPressed = () => {
|
||||||
@@ -233,6 +236,7 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
|
|
||||||
closeFinalPage() {
|
closeFinalPage() {
|
||||||
// Final page. Let the app know that first run experience is completed.
|
// Final page. Let the app know that first run experience is completed.
|
||||||
|
this.setState({ syncApplyStarted: false });
|
||||||
if (NativeModules.FirstRun) {
|
if (NativeModules.FirstRun) {
|
||||||
NativeModules.FirstRun.firstRunCompleted();
|
NativeModules.FirstRun.firstRunCompleted();
|
||||||
}
|
}
|
||||||
@@ -295,13 +299,20 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
const { getSync, setClientSetting } = this.props;
|
const { getSync, setClientSetting } = this.props;
|
||||||
if (NativeModules.UtilityModule) {
|
if (NativeModules.UtilityModule) {
|
||||||
const newPassword = this.state.walletPassword ? this.state.walletPassword : '';
|
const newPassword = this.state.walletPassword ? this.state.walletPassword : '';
|
||||||
NativeModules.UtilityModule.setSecureValue(Constants.KEY_FIRST_RUN_PASSWORD, newPassword);
|
NativeModules.UtilityModule.setSecureValue(Constants.KEY_WALLET_PASSWORD, newPassword);
|
||||||
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
|
if (newPassword.trim().length === 0) {
|
||||||
// fresh account, new password set
|
// blank password. Do not encrypt
|
||||||
getSync(newPassword);
|
getSync(newPassword);
|
||||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||||
this.closeFinalPage();
|
this.closeFinalPage();
|
||||||
});
|
} else {
|
||||||
|
Lbry.wallet_encrypt({ new_password: newPassword }).then(() => {
|
||||||
|
// fresh account, new password set
|
||||||
|
getSync(newPassword);
|
||||||
|
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||||
|
this.closeFinalPage();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -364,6 +375,7 @@ class FirstRunScreen extends React.PureComponent {
|
|||||||
hasSyncedWallet={hasSyncedWallet}
|
hasSyncedWallet={hasSyncedWallet}
|
||||||
getSyncIsPending={getSyncIsPending}
|
getSyncIsPending={getSyncIsPending}
|
||||||
syncApplyIsPending={syncApplyIsPending}
|
syncApplyIsPending={syncApplyIsPending}
|
||||||
|
syncApplyStarted={this.state.syncApplyStarted}
|
||||||
onWalletViewLayout={this.onWalletViewLayout}
|
onWalletViewLayout={this.onWalletViewLayout}
|
||||||
onPasswordChanged={this.onWalletPasswordChanged}
|
onPasswordChanged={this.onWalletPasswordChanged}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
doResolveUri,
|
doResolveUri,
|
||||||
doToast,
|
doToast,
|
||||||
doUpdatePublishForm,
|
doUpdatePublishForm,
|
||||||
doUploadThumbnail,
|
|
||||||
selectBalance,
|
selectBalance,
|
||||||
selectPublishFormValues,
|
selectPublishFormValues,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
@@ -28,7 +27,6 @@ const perform = dispatch => ({
|
|||||||
clearPublishFormState: () => dispatch(doClearPublishFormState()),
|
clearPublishFormState: () => dispatch(doClearPublishFormState()),
|
||||||
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
|
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
|
||||||
updatePublishFormState: data => dispatch(doUpdatePublishFormState(data)),
|
updatePublishFormState: data => dispatch(doUpdatePublishFormState(data)),
|
||||||
uploadThumbnail: (filePath, fsAdapter) => dispatch(doUploadThumbnail(filePath, null, fsAdapter)),
|
|
||||||
publish: (success, fail) => dispatch(doPublish(success, fail)),
|
publish: (success, fail) => dispatch(doPublish(success, fail)),
|
||||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||||
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
||||||
|
|||||||
+170
-81
@@ -43,7 +43,7 @@ import Tag from 'component/tag';
|
|||||||
import TagSearch from 'component/tagSearch';
|
import TagSearch from 'component/tagSearch';
|
||||||
import UriBar from 'component/uriBar';
|
import UriBar from 'component/uriBar';
|
||||||
import publishStyle from 'styles/publish';
|
import publishStyle from 'styles/publish';
|
||||||
import { __, navigateToUri } from 'utils/helper';
|
import { __, navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||||
|
|
||||||
const languages = {
|
const languages = {
|
||||||
en: 'English',
|
en: 'English',
|
||||||
@@ -76,8 +76,10 @@ const languages = {
|
|||||||
class PublishPage extends React.PureComponent {
|
class PublishPage extends React.PureComponent {
|
||||||
camera = null;
|
camera = null;
|
||||||
|
|
||||||
|
scrollView = null;
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
canPublish: false,
|
canPublish: true,
|
||||||
canUseCamera: false,
|
canUseCamera: false,
|
||||||
documentPickerOpen: false,
|
documentPickerOpen: false,
|
||||||
editMode: false,
|
editMode: false,
|
||||||
@@ -129,6 +131,8 @@ class PublishPage extends React.PureComponent {
|
|||||||
uploadedThumbnailUri: null,
|
uploadedThumbnailUri: null,
|
||||||
vanityUrlSet: false,
|
vanityUrlSet: false,
|
||||||
|
|
||||||
|
thumbnailImagePickerOpen: false,
|
||||||
|
|
||||||
// other
|
// other
|
||||||
publishStarted: false,
|
publishStarted: false,
|
||||||
};
|
};
|
||||||
@@ -184,7 +188,6 @@ class PublishPage extends React.PureComponent {
|
|||||||
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
|
NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath }));
|
||||||
this.setState(
|
this.setState(
|
||||||
{
|
{
|
||||||
canPublish: balance >= 0.1,
|
|
||||||
loadingVideos: true,
|
loadingVideos: true,
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
@@ -218,10 +221,8 @@ class PublishPage extends React.PureComponent {
|
|||||||
// replace name with the specified vanity URL if there was one in the pending state
|
// replace name with the specified vanity URL if there was one in the pending state
|
||||||
this.setState({ name: this.state.vanityUrl });
|
this.setState({ name: this.state.vanityUrl });
|
||||||
}
|
}
|
||||||
this.setState({ currentPhase: Constants.PHASE_DETAILS });
|
|
||||||
} else {
|
|
||||||
this.setState({ currentPhase: Constants.PHASE_SELECTOR });
|
|
||||||
}
|
}
|
||||||
|
this.setState({ currentPhase: isEditMode || hasFormState ? Constants.PHASE_DETAILS : Constants.PHASE_SELECTOR });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -256,6 +257,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
this.setState(
|
this.setState(
|
||||||
{
|
{
|
||||||
editMode: true,
|
editMode: true,
|
||||||
|
publishStarted: false,
|
||||||
currentPhase: Constants.PHASE_DETAILS,
|
currentPhase: Constants.PHASE_DETAILS,
|
||||||
|
|
||||||
hasEditedContentAddress: true,
|
hasEditedContentAddress: true,
|
||||||
@@ -318,7 +320,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handlePublishPressed = () => {
|
handlePublishPressed = () => {
|
||||||
const { notify, publish, updatePublishForm } = this.props;
|
const { balance, notify, publish, updatePublishForm } = this.props;
|
||||||
const {
|
const {
|
||||||
editMode,
|
editMode,
|
||||||
bid,
|
bid,
|
||||||
@@ -339,6 +341,16 @@ class PublishPage extends React.PureComponent {
|
|||||||
uri,
|
uri,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
|
if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) {
|
||||||
|
notify({
|
||||||
|
message: 'Publishing content requires credits. Press the blue bar to get some for free.',
|
||||||
|
});
|
||||||
|
if (this.scrollView) {
|
||||||
|
this.scrollView.scrollTo({ x: 0, y: 0, animated: true });
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!title || title.trim().length === 0) {
|
if (!title || title.trim().length === 0) {
|
||||||
notify({ message: 'Please provide a title' });
|
notify({ message: 'Please provide a title' });
|
||||||
return;
|
return;
|
||||||
@@ -359,7 +371,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
filePath: currentMedia ? currentMedia.filePath : null,
|
filePath: currentMedia ? currentMedia.filePath : null,
|
||||||
bid: bid || 0.1,
|
bid: bid || 0.1,
|
||||||
title: title || '',
|
title: title || '',
|
||||||
thumbnail,
|
thumbnail: thumbnail || '',
|
||||||
description: description || '',
|
description: description || '',
|
||||||
language,
|
language,
|
||||||
license,
|
license,
|
||||||
@@ -382,10 +394,17 @@ class PublishPage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handlePublishSuccess = data => {
|
handlePublishSuccess = data => {
|
||||||
const { navigation, notify } = this.props;
|
const { clearPublishFormState, navigation, notify } = this.props;
|
||||||
|
const pendingClaim = data.outputs[0];
|
||||||
|
logPublish(pendingClaim);
|
||||||
|
|
||||||
|
// TODO: fake temp claim for claim_list_mine
|
||||||
|
|
||||||
notify({
|
notify({
|
||||||
message: `Your content was successfully published to ${this.state.uri}. It will be available in a few mintues.`,
|
message: `Your content was successfully published to ${this.state.uri}. It will be available in a few mintues.`,
|
||||||
});
|
});
|
||||||
|
clearPublishFormState();
|
||||||
|
this.setState({ publishStarted: false });
|
||||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISHES, params: { publishSuccess: true } });
|
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISHES, params: { publishSuccess: true } });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -407,14 +426,6 @@ class PublishPage extends React.PureComponent {
|
|||||||
this.onComponentFocused();
|
this.onComponentFocused();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (publishFormValues) {
|
|
||||||
if (publishFormValues.thumbnail && !this.state.uploadedThumbnailUri) {
|
|
||||||
const { thumbnail } = publishFormValues;
|
|
||||||
updatePublishFormState({ currentThumbnailUri: thumbnail, uploadedThumbnailUri: thumbnail });
|
|
||||||
this.setState({ currentThumbnailUri: thumbnail, uploadedThumbnailUri: thumbnail });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.state.currentPhase === Constants.PHASE_DETAILS &&
|
this.state.currentPhase === Constants.PHASE_DETAILS &&
|
||||||
prevDrawerStack[prevDrawerStack.length - 1].route === Constants.DRAWER_ROUTE_PUBLISH_FORM &&
|
prevDrawerStack[prevDrawerStack.length - 1].route === Constants.DRAWER_ROUTE_PUBLISH_FORM &&
|
||||||
@@ -432,6 +443,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
updatePublishFormState({ currentMedia: media, name: newName });
|
updatePublishFormState({ currentMedia: media, name: newName });
|
||||||
this.setState(
|
this.setState(
|
||||||
{
|
{
|
||||||
|
publishStarted: false,
|
||||||
currentMedia: media,
|
currentMedia: media,
|
||||||
title: null, // no title autogeneration (user will fill this in)
|
title: null, // no title autogeneration (user will fill this in)
|
||||||
name: newName,
|
name: newName,
|
||||||
@@ -449,7 +461,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
showSelector() {
|
showSelector() {
|
||||||
const { updatePublishForm } = this.props;
|
const { clearPublishFormState, updatePublishForm } = this.props;
|
||||||
|
|
||||||
this.setState(
|
this.setState(
|
||||||
{
|
{
|
||||||
@@ -486,9 +498,12 @@ class PublishPage extends React.PureComponent {
|
|||||||
selectedChannel: null,
|
selectedChannel: null,
|
||||||
uploadedThumbnailUri: null,
|
uploadedThumbnailUri: null,
|
||||||
|
|
||||||
|
thumbnailImagePickerOpen: false,
|
||||||
|
|
||||||
vanityUrlSet: false,
|
vanityUrlSet: false,
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
|
clearPublishFormState();
|
||||||
// reset thumbnail
|
// reset thumbnail
|
||||||
updatePublishForm({ thumbnail: null });
|
updatePublishForm({ thumbnail: null });
|
||||||
}
|
}
|
||||||
@@ -522,19 +537,59 @@ class PublishPage extends React.PureComponent {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
onFilePicked = evt => {
|
handleThumbnailUploadSuccess = ({ url }) => {
|
||||||
this.setState({ documentPickerOpen: false }, () => {
|
const { updatePublishFormState } = this.props;
|
||||||
const currentMedia = {
|
|
||||||
id: -1,
|
this.setState({
|
||||||
filePath: `file://${evt.path}`,
|
uploadThumbnailStarted: false,
|
||||||
duration: 0,
|
currentThumbnailUri: url,
|
||||||
};
|
uploadedThumbnailUri: url,
|
||||||
this.setCurrentMedia(currentMedia);
|
|
||||||
});
|
});
|
||||||
|
updatePublishFormState({ currentThumbnailUri: url, uploadedThumbnailUri: url });
|
||||||
|
};
|
||||||
|
|
||||||
|
handleThumbnailUploadFailure = err => {
|
||||||
|
const { notify } = this.props;
|
||||||
|
this.setState({ uploadThumbnailStarted: false });
|
||||||
|
notify({ message: 'The thumbnail could not be uploaded. Please try again.' });
|
||||||
|
};
|
||||||
|
|
||||||
|
onFilePicked = evt => {
|
||||||
|
const { notify } = this.props;
|
||||||
|
if (evt.path && evt.path.length > 0) {
|
||||||
|
const fileUrl = `file://${evt.path}`;
|
||||||
|
|
||||||
|
if (this.state.documentPickerOpen) {
|
||||||
|
this.setState({ documentPickerOpen: false, thumbnailImagePickerOpen: false }, () => {
|
||||||
|
const currentMedia = {
|
||||||
|
id: -1,
|
||||||
|
filePath: evt.path,
|
||||||
|
duration: 0,
|
||||||
|
};
|
||||||
|
this.setCurrentMedia(currentMedia);
|
||||||
|
});
|
||||||
|
} else if (this.state.thumbnailImagePickerOpen) {
|
||||||
|
this.setState(
|
||||||
|
{
|
||||||
|
documentPickerOpen: false,
|
||||||
|
thumbnailImagePickerOpen: false,
|
||||||
|
uploadThumbnailStarted: true,
|
||||||
|
currentThumbnailUri: fileUrl,
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
// upload a new thumbnail
|
||||||
|
uploadImageAsset(fileUrl, this.handleThumbnailUploadSuccess, this.handleThumbnailUploadFailure);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// could not determine the file path
|
||||||
|
notify({ message: 'The path could not be determined. Please try a different file.' });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onPickerCanceled = () => {
|
onPickerCanceled = () => {
|
||||||
this.setState({ documentPickerOpen: false });
|
this.setState({ documentPickerOpen: false, thumbnailImagePickerOpen: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
handleCloseCameraPressed = () => {
|
handleCloseCameraPressed = () => {
|
||||||
@@ -569,6 +624,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
{
|
{
|
||||||
currentThumbnailUri: null,
|
currentThumbnailUri: null,
|
||||||
updatingThumbnailUri: false,
|
updatingThumbnailUri: false,
|
||||||
|
publishStarted: false,
|
||||||
currentPhase: Constants.PHASE_DETAILS,
|
currentPhase: Constants.PHASE_DETAILS,
|
||||||
showCameraOverlay: false,
|
showCameraOverlay: false,
|
||||||
videoRecordingMode: false,
|
videoRecordingMode: false,
|
||||||
@@ -593,6 +649,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
{
|
{
|
||||||
currentPhase: Constants.PHASE_DETAILS,
|
currentPhase: Constants.PHASE_DETAILS,
|
||||||
currentThumbnailUri: null,
|
currentThumbnailUri: null,
|
||||||
|
publishStarted: false,
|
||||||
updatingThumbnailUri: false,
|
updatingThumbnailUri: false,
|
||||||
showCameraOverlay: false,
|
showCameraOverlay: false,
|
||||||
videoRecordingMode: false,
|
videoRecordingMode: false,
|
||||||
@@ -611,8 +668,6 @@ class PublishPage extends React.PureComponent {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
handleUploadPressed = () => {};
|
|
||||||
|
|
||||||
getRandomFileId = () => {
|
getRandomFileId = () => {
|
||||||
// generate a random id for a photo or recorded video between 1 and 20 (for creating thumbnails)
|
// generate a random id for a photo or recorded video between 1 and 20 (for creating thumbnails)
|
||||||
const id = Math.floor(Math.random() * (20 - 2)) + 1;
|
const id = Math.floor(Math.random() * (20 - 2)) + 1;
|
||||||
@@ -699,7 +754,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { notify, uploadThumbnail } = this.props;
|
const { notify } = this.props;
|
||||||
const { thumbnailPath } = this.state;
|
const { thumbnailPath } = this.state;
|
||||||
|
|
||||||
this.setState({ updatingThumbnailUri: true });
|
this.setState({ updatingThumbnailUri: true });
|
||||||
@@ -714,7 +769,13 @@ class PublishPage extends React.PureComponent {
|
|||||||
|
|
||||||
// upload the thumbnail
|
// upload the thumbnail
|
||||||
if (!this.state.uploadedThumbnailUri) {
|
if (!this.state.uploadedThumbnailUri) {
|
||||||
this.setState({ uploadThumbnailStarted: true }, () => uploadThumbnail(this.getFilePathFromUri(uri), RNFS));
|
this.setState({ uploadThumbnailStarted: true }, () =>
|
||||||
|
uploadImageAsset(
|
||||||
|
this.getFilePathFromUri(uri),
|
||||||
|
this.handleThumbnailUploadSuccess,
|
||||||
|
this.handleThumbnailUploadFailure
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else if (mediaType === 'image' || mediaType === 'video') {
|
} else if (mediaType === 'image' || mediaType === 'video') {
|
||||||
const create =
|
const create =
|
||||||
@@ -725,7 +786,9 @@ class PublishPage extends React.PureComponent {
|
|||||||
.then(path => {
|
.then(path => {
|
||||||
this.setState({ currentThumbnailUri: `file://${path}`, updatingThumbnailUri: false });
|
this.setState({ currentThumbnailUri: `file://${path}`, updatingThumbnailUri: false });
|
||||||
if (!this.state.uploadedThumbnailUri) {
|
if (!this.state.uploadedThumbnailUri) {
|
||||||
this.setState({ uploadThumbnailStarted: true }, () => uploadThumbnail(path, RNFS));
|
this.setState({ uploadThumbnailStarted: true }, () =>
|
||||||
|
uploadImageAsset(path, this.handleThumbnailUploadSuccess, this.handleThumbnailUploadFailure)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
@@ -781,7 +844,7 @@ class PublishPage extends React.PureComponent {
|
|||||||
: '';
|
: '';
|
||||||
const licenseUrl = LICENSES.CC_LICENSES.reduce((value, item) => {
|
const licenseUrl = LICENSES.CC_LICENSES.reduce((value, item) => {
|
||||||
if (typeof value === 'object') {
|
if (typeof value === 'object') {
|
||||||
value = '';
|
value = license === value.value ? item.url : '';
|
||||||
}
|
}
|
||||||
if (license === item.value) {
|
if (license === item.value) {
|
||||||
value = item.url;
|
value = item.url;
|
||||||
@@ -799,11 +862,31 @@ class PublishPage extends React.PureComponent {
|
|||||||
this.setState({ otherLicenseDescription });
|
this.setState({ otherLicenseDescription });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handleThumbnailPressed = () => {
|
||||||
|
const { notify } = this.props;
|
||||||
|
if (this.state.thumbnailImagePickerOpen || this.state.uploadThumbnailStarted) {
|
||||||
|
if (this.state.uploadThumbnailStarted) {
|
||||||
|
notify({ message: 'A thumbnail is already being uploaded. Please wait for the upload to finish.' });
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState(
|
||||||
|
{
|
||||||
|
thumbnailImagePickerOpen: true,
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
NativeModules.UtilityModule.openDocumentPicker('image/*');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { balance, navigation, notify, publishFormValues } = this.props;
|
const { balance, navigation, notify, publishFormValues } = this.props;
|
||||||
const {
|
const {
|
||||||
allThumbnailsChecked,
|
allThumbnailsChecked,
|
||||||
canUseCamera,
|
canUseCamera,
|
||||||
|
showCameraOverlay,
|
||||||
currentPhase,
|
currentPhase,
|
||||||
checkedThumbnails,
|
checkedThumbnails,
|
||||||
loadingVideos,
|
loadingVideos,
|
||||||
@@ -816,7 +899,9 @@ class PublishPage extends React.PureComponent {
|
|||||||
content = (
|
content = (
|
||||||
<View style={publishStyle.gallerySelector}>
|
<View style={publishStyle.gallerySelector}>
|
||||||
<View style={publishStyle.actionsView}>
|
<View style={publishStyle.actionsView}>
|
||||||
{canUseCamera && <RNCamera style={publishStyle.cameraPreview} type={RNCamera.Constants.Type.back} />}
|
{canUseCamera && !showCameraOverlay && (
|
||||||
|
<RNCamera captureAudio={false} style={publishStyle.cameraPreview} type={RNCamera.Constants.Type.back} />
|
||||||
|
)}
|
||||||
<View style={publishStyle.actionsSubView}>
|
<View style={publishStyle.actionsSubView}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={[
|
style={[
|
||||||
@@ -892,24 +977,26 @@ class PublishPage extends React.PureComponent {
|
|||||||
this.updateThumbnailUriForMedia(currentMedia);
|
this.updateThumbnailUriForMedia(currentMedia);
|
||||||
}
|
}
|
||||||
content = (
|
content = (
|
||||||
<ScrollView style={publishStyle.publishDetails}>
|
<ScrollView ref={ref => (this.scrollView = ref)} style={publishStyle.publishDetails}>
|
||||||
{currentThumbnailUri && currentThumbnailUri.trim().length > 0 && (
|
<TouchableOpacity style={publishStyle.mainThumbnailContainer} onPress={this.handleThumbnailPressed}>
|
||||||
<View style={publishStyle.mainThumbnailContainer}>
|
<FastImage
|
||||||
<FastImage
|
style={publishStyle.mainThumbnail}
|
||||||
style={publishStyle.mainThumbnail}
|
resizeMode={FastImage.resizeMode.contain}
|
||||||
resizeMode={FastImage.resizeMode.contain}
|
source={{ uri: currentThumbnailUri }}
|
||||||
source={{ uri: currentThumbnailUri }}
|
/>
|
||||||
/>
|
|
||||||
|
|
||||||
{this.state.uploadThumbnailStarted && !this.state.uploadedThumbnailUri && (
|
<View style={publishStyle.thumbnailEditOverlay}>
|
||||||
<View style={publishStyle.thumbnailUploadContainer}>
|
<Icon name={'edit'} style={publishStyle.editIcon} />
|
||||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
|
||||||
<Text style={publishStyle.thumbnailUploadText}>Uploading thumbnail...</Text>
|
|
||||||
</View>
|
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
)}
|
|
||||||
{!this.state.canPublish && <PublishRewardsDriver navigation={navigation} />}
|
{this.state.uploadThumbnailStarted && (
|
||||||
|
<View style={publishStyle.thumbnailUploadContainer}>
|
||||||
|
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
||||||
|
<Text style={publishStyle.thumbnailUploadText}>Uploading thumbnail...</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</TouchableOpacity>
|
||||||
|
{balance < Constants.MINIMUM_TRANSACTION_BALANCE && <PublishRewardsDriver navigation={navigation} />}
|
||||||
|
|
||||||
<View style={publishStyle.card}>
|
<View style={publishStyle.card}>
|
||||||
<View style={publishStyle.textInputLayout}>
|
<View style={publishStyle.textInputLayout}>
|
||||||
@@ -1105,21 +1192,21 @@ class PublishPage extends React.PureComponent {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={publishStyle.actionButtons}>
|
<View style={publishStyle.actionButtons}>
|
||||||
{(this.state.publishStarted || publishFormValues.publishing) && (
|
{this.state.publishStarted && (
|
||||||
<View style={publishStyle.progress}>
|
<View style={publishStyle.progress}>
|
||||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!publishFormValues.publishing && !this.state.publishStarted && (
|
{!this.state.publishStarted && (
|
||||||
<Link style={publishStyle.cancelLink} text="Cancel" onPress={() => this.showSelector()} />
|
<Link style={publishStyle.cancelLink} text="Cancel" onPress={() => this.showSelector()} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!publishFormValues.publishing && !this.state.publishStarted && (
|
{!this.state.publishStarted && (
|
||||||
<View style={publishStyle.rightActionButtons}>
|
<View style={publishStyle.rightActionButtons}>
|
||||||
<Button
|
<Button
|
||||||
style={publishStyle.publishButton}
|
style={publishStyle.publishButton}
|
||||||
disabled={!this.state.canPublish || !this.state.uploadedThumbnailUri}
|
disabled={this.state.uploadThumbnailStarted}
|
||||||
text={this.state.editMode ? 'Save changes' : 'Publish'}
|
text={this.state.editMode ? 'Save changes' : 'Publish'}
|
||||||
onPress={this.handlePublishPressed}
|
onPress={this.handlePublishPressed}
|
||||||
/>
|
/>
|
||||||
@@ -1168,34 +1255,36 @@ class PublishPage extends React.PureComponent {
|
|||||||
{false && Constants.PHASE_SELECTOR !== this.state.currentPhase && (
|
{false && Constants.PHASE_SELECTOR !== this.state.currentPhase && (
|
||||||
<FloatingWalletBalance navigation={navigation} />
|
<FloatingWalletBalance navigation={navigation} />
|
||||||
)}
|
)}
|
||||||
{this.state.canUseCamera && this.state.showCameraOverlay && (
|
{this.state.showCameraOverlay && (
|
||||||
<View style={publishStyle.cameraOverlay}>
|
<View style={publishStyle.cameraOverlay}>
|
||||||
<RNCamera
|
{this.state.canUseCamera && (
|
||||||
captureAudio={this.state.videoRecordingMode}
|
<RNCamera
|
||||||
style={publishStyle.fullCamera}
|
captureAudio={this.state.videoRecordingMode}
|
||||||
ref={ref => {
|
style={publishStyle.fullCamera}
|
||||||
this.camera = ref;
|
ref={ref => {
|
||||||
}}
|
this.camera = ref;
|
||||||
type={this.state.cameraType}
|
}}
|
||||||
flashMode={RNCamera.Constants.FlashMode.off}
|
type={this.state.cameraType}
|
||||||
androidCameraPermissionOptions={{
|
flashMode={RNCamera.Constants.FlashMode.off}
|
||||||
title: 'Camera',
|
androidCameraPermissionOptions={{
|
||||||
message: 'Please grant access to make use of your camera',
|
title: __('Camera'),
|
||||||
buttonPositive: 'OK',
|
message: __('Please grant access to make use of your camera'),
|
||||||
buttonNegative: 'Cancel',
|
buttonPositive: __('OK'),
|
||||||
}}
|
buttonNegative: __('Cancel'),
|
||||||
androidRecordAudioPermissionOptions={{
|
}}
|
||||||
title: 'Audio',
|
androidRecordAudioPermissionOptions={{
|
||||||
message: 'Please grant access to record audio',
|
title: __('Audio'),
|
||||||
buttonPositive: 'OK',
|
message: __('Please grant access to record audio'),
|
||||||
buttonNegative: 'Cancel',
|
buttonPositive: __('OK'),
|
||||||
}}
|
buttonNegative: __('Cancel'),
|
||||||
notAuthorizedView={
|
}}
|
||||||
<View style={publishStyle.fullCentered}>
|
notAuthorizedView={
|
||||||
<Text style={publishStyle.cameraInfo}>Camera not authorized</Text>
|
<View style={publishStyle.fullCentered}>
|
||||||
</View>
|
<Text style={publishStyle.cameraInfo}>Camera not authorized</Text>
|
||||||
}
|
</View>
|
||||||
/>
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
publishStyle.cameraControls,
|
publishStyle.cameraControls,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { ActivityIndicator, Alert, FlatList, NativeModules, Text, TouchableOpaci
|
|||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
import EmptyStateView from 'component/emptyStateView';
|
||||||
import FileListItem from 'component/fileListItem';
|
import FileListItem from 'component/fileListItem';
|
||||||
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
import FloatingWalletBalance from 'component/floatingWalletBalance';
|
||||||
import UriBar from 'component/uriBar';
|
import UriBar from 'component/uriBar';
|
||||||
@@ -137,16 +138,11 @@ class PublishesPage extends React.PureComponent {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{!fetching && (!uris || uris.length === 0) && (
|
{!fetching && (!uris || uris.length === 0) && (
|
||||||
<View style={publishStyle.noPublishes}>
|
<EmptyStateView
|
||||||
<Text style={publishStyle.noPublishText}>
|
message={__('It looks like you have not\npublished any content to LBRY yet.')}
|
||||||
{__('It looks like you have not published anything to LBRY yet.')}
|
buttonText={__('Publish something new')}
|
||||||
</Text>
|
onButtonPress={() => navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH })}
|
||||||
<Button
|
/>
|
||||||
style={publishStyle.publishNowButton}
|
|
||||||
text={__('Publish something new')}
|
|
||||||
onPress={() => navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH })}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{uris && uris.length > 0 && (
|
{uris && uris.length > 0 && (
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/a
|
|||||||
import { doSetClientSetting } from 'redux/actions/settings';
|
import { doSetClientSetting } from 'redux/actions/settings';
|
||||||
import { selectCurrentRoute, selectDrawerStack } from 'redux/selectors/drawer';
|
import { selectCurrentRoute, selectDrawerStack } from 'redux/selectors/drawer';
|
||||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||||
import Constants from 'constants';
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import SettingsPage from './view';
|
import SettingsPage from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
@@ -13,6 +13,11 @@ const select = state => ({
|
|||||||
drawerStack: selectDrawerStack(state),
|
drawerStack: selectDrawerStack(state),
|
||||||
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state),
|
||||||
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state),
|
||||||
|
showUriBarSuggestions: makeSelectClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS)(state),
|
||||||
|
receiveSubscriptionNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_SUBSCRIPTION_NOTIFICATIONS)(state),
|
||||||
|
receiveRewardNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_REWARD_NOTIFICATIONS)(state),
|
||||||
|
receiveInterestsNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_INTERESTS_NOTIFICATIONS)(state),
|
||||||
|
receiveCreatorNotifications: makeSelectClientSetting(SETTINGS.RECEIVE_CREATOR_NOTIFICATIONS)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
|||||||
+102
-4
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { SETTINGS } from 'lbry-redux';
|
import { SETTINGS } from 'lbry-redux';
|
||||||
import { Text, View, ScrollView, Switch, NativeModules } from 'react-native';
|
import { Text, View, ScrollView, Switch, NativeModules } from 'react-native';
|
||||||
import { navigateBack } from 'utils/helper';
|
import { __, navigateBack } from 'utils/helper';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import PageHeader from 'component/pageHeader';
|
import PageHeader from 'component/pageHeader';
|
||||||
import settingsStyle from 'styles/settings';
|
import settingsStyle from 'styles/settings';
|
||||||
@@ -43,6 +43,16 @@ class SettingsPage extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setNativeBooleanSetting = (key, value) => {
|
||||||
|
const { setClientSetting } = this.props;
|
||||||
|
setClientSetting(key, value);
|
||||||
|
NativeModules.UtilityModule.setNativeBooleanSetting(key, value);
|
||||||
|
};
|
||||||
|
|
||||||
|
getBooleanSetting = (value, defaultValue) => {
|
||||||
|
return value === null || value === undefined ? defaultValue : value;
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
backgroundPlayEnabled,
|
backgroundPlayEnabled,
|
||||||
@@ -50,18 +60,27 @@ class SettingsPage extends React.PureComponent {
|
|||||||
keepDaemonRunning,
|
keepDaemonRunning,
|
||||||
navigation,
|
navigation,
|
||||||
popDrawerStack,
|
popDrawerStack,
|
||||||
|
receiveSubscriptionNotifications,
|
||||||
|
receiveRewardNotifications,
|
||||||
|
receiveInterestsNotifications,
|
||||||
|
receiveCreatorNotifications,
|
||||||
showNsfw,
|
showNsfw,
|
||||||
|
showUriBarSuggestions,
|
||||||
setClientSetting,
|
setClientSetting,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
// default to true if the setting is null or undefined
|
// default to true if the setting is null or undefined
|
||||||
const actualKeepDaemonRunning =
|
const actualKeepDaemonRunning = this.getBooleanSetting(keepDaemonRunning, true);
|
||||||
keepDaemonRunning === null || keepDaemonRunning === undefined ? true : keepDaemonRunning;
|
const actualReceiveSubscriptionNotifications = this.getBooleanSetting(receiveSubscriptionNotifications, true);
|
||||||
|
const actualReceiveRewardNotifications = this.getBooleanSetting(receiveRewardNotifications, true);
|
||||||
|
const actualReceiveInterestsNotifications = this.getBooleanSetting(receiveInterestsNotifications, true);
|
||||||
|
const actualReceiveCreatorNotifications = this.getBooleanSetting(receiveCreatorNotifications, true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={settingsStyle.container}>
|
<View style={settingsStyle.container}>
|
||||||
<PageHeader title={'Settings'} onBackPressed={() => navigateBack(navigation, drawerStack, popDrawerStack)} />
|
<PageHeader title={'Settings'} onBackPressed={() => navigateBack(navigation, drawerStack, popDrawerStack)} />
|
||||||
<ScrollView style={settingsStyle.scrollContainer}>
|
<ScrollView style={settingsStyle.scrollContainer}>
|
||||||
|
<Text style={settingsStyle.sectionTitle}>Content</Text>
|
||||||
<View style={settingsStyle.row}>
|
<View style={settingsStyle.row}>
|
||||||
<View style={settingsStyle.switchText}>
|
<View style={settingsStyle.switchText}>
|
||||||
<Text style={settingsStyle.label}>Enable background media playback</Text>
|
<Text style={settingsStyle.label}>Enable background media playback</Text>
|
||||||
@@ -79,13 +98,92 @@ class SettingsPage extends React.PureComponent {
|
|||||||
|
|
||||||
<View style={settingsStyle.row}>
|
<View style={settingsStyle.row}>
|
||||||
<View style={settingsStyle.switchText}>
|
<View style={settingsStyle.switchText}>
|
||||||
<Text style={settingsStyle.label}>Show NSFW content</Text>
|
<Text style={settingsStyle.label}>Show mature content</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={settingsStyle.switchContainer}>
|
<View style={settingsStyle.switchContainer}>
|
||||||
<Switch value={showNsfw} onValueChange={value => setClientSetting(SETTINGS.SHOW_NSFW, value)} />
|
<Switch value={showNsfw} onValueChange={value => setClientSetting(SETTINGS.SHOW_NSFW, value)} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
<View style={settingsStyle.sectionDivider} />
|
||||||
|
<Text style={settingsStyle.sectionTitle}>{__('Notifications')}</Text>
|
||||||
|
<Text style={settingsStyle.sectionDescription}>
|
||||||
|
{__('Choose the notifications you would like to receive.')}
|
||||||
|
</Text>
|
||||||
|
<View style={settingsStyle.row}>
|
||||||
|
<View style={settingsStyle.switchText}>
|
||||||
|
<Text style={settingsStyle.label}>{__('Subscriptions')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={settingsStyle.switchContainer}>
|
||||||
|
<Switch
|
||||||
|
value={actualReceiveSubscriptionNotifications}
|
||||||
|
onValueChange={value => {
|
||||||
|
this.setNativeBooleanSetting(SETTINGS.RECEIVE_SUBSCRIPTION_NOTIFICATIONS, value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={settingsStyle.row}>
|
||||||
|
<View style={settingsStyle.switchText}>
|
||||||
|
<Text style={settingsStyle.label}>{__('Rewards')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={settingsStyle.switchContainer}>
|
||||||
|
<Switch
|
||||||
|
value={actualReceiveRewardNotifications}
|
||||||
|
onValueChange={value => {
|
||||||
|
this.setNativeBooleanSetting(SETTINGS.RECEIVE_REWARD_NOTIFICATIONS, value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={settingsStyle.row}>
|
||||||
|
<View style={settingsStyle.switchText}>
|
||||||
|
<Text style={settingsStyle.label}>{__('Tags you follow')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={settingsStyle.switchContainer}>
|
||||||
|
<Switch
|
||||||
|
value={actualReceiveInterestsNotifications}
|
||||||
|
onValueChange={value => {
|
||||||
|
this.setNativeBooleanSetting(SETTINGS.RECEIVE_INTERESTS_NOTIFICATIONS, value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{false && (
|
||||||
|
<View style={settingsStyle.row}>
|
||||||
|
<View style={settingsStyle.switchText}>
|
||||||
|
<Text style={settingsStyle.label}>{__('Content creator tips')}</Text>
|
||||||
|
</View>
|
||||||
|
<View style={settingsStyle.switchContainer}>
|
||||||
|
<Switch
|
||||||
|
value={actualReceiveCreatorNotifications}
|
||||||
|
onValueChange={value => {
|
||||||
|
this.setNativeBooleanSetting(SETTINGS.RECEIVE_CREATOR_NOTIFICATIONS, value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<View style={settingsStyle.sectionDivider} />
|
||||||
|
<Text style={settingsStyle.sectionTitle}>Search</Text>
|
||||||
|
<View style={settingsStyle.row}>
|
||||||
|
<View style={settingsStyle.switchText}>
|
||||||
|
<Text style={settingsStyle.label}>Show URL suggestions</Text>
|
||||||
|
</View>
|
||||||
|
<View style={settingsStyle.switchContainer}>
|
||||||
|
<Switch
|
||||||
|
value={showUriBarSuggestions}
|
||||||
|
onValueChange={value => setClientSetting(SETTINGS.SHOW_URI_BAR_SUGGESTIONS, value)}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<View style={settingsStyle.sectionDivider} />
|
||||||
|
<Text style={settingsStyle.sectionTitle}>Other</Text>
|
||||||
<View style={settingsStyle.row}>
|
<View style={settingsStyle.row}>
|
||||||
<View style={settingsStyle.switchText}>
|
<View style={settingsStyle.switchText}>
|
||||||
<Text style={settingsStyle.label}>Keep the daemon background service running after closing the app</Text>
|
<Text style={settingsStyle.label}>Keep the daemon background service running after closing the app</Text>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { doBalanceSubscribe, doUpdateBlockHeight, doToast } from 'lbry-redux';
|
import { doBalanceSubscribe, doUpdateBlockHeight, doPopulateSharedUserState, doToast } from 'lbry-redux';
|
||||||
import {
|
import {
|
||||||
doAuthenticate,
|
doAuthenticate,
|
||||||
doBlackListedOutpointsSubscribe,
|
doBlackListedOutpointsSubscribe,
|
||||||
@@ -23,17 +23,18 @@ const select = state => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)),
|
authenticate: (appVersion, os, firebaseToken) => dispatch(doAuthenticate(appVersion, os, firebaseToken)),
|
||||||
balanceSubscribe: () => dispatch(doBalanceSubscribe()),
|
balanceSubscribe: () => dispatch(doBalanceSubscribe()),
|
||||||
blacklistedOutpointsSubscribe: () => dispatch(doBlackListedOutpointsSubscribe()),
|
blacklistedOutpointsSubscribe: () => dispatch(doBlackListedOutpointsSubscribe()),
|
||||||
filteredOutpointsSubscribe: () => dispatch(doFilteredOutpointsSubscribe()),
|
filteredOutpointsSubscribe: () => dispatch(doFilteredOutpointsSubscribe()),
|
||||||
checkSubscriptionsInit: () => dispatch(doCheckSubscriptionsInit()),
|
checkSubscriptionsInit: () => dispatch(doCheckSubscriptionsInit()),
|
||||||
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
|
||||||
fetchSubscriptions: callback => dispatch(doFetchMySubscriptions(callback)),
|
fetchSubscriptions: callback => dispatch(doFetchMySubscriptions(callback)),
|
||||||
getSync: password => dispatch(doGetSync(password)),
|
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||||
notify: data => dispatch(doToast(data)),
|
notify: data => dispatch(doToast(data)),
|
||||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||||
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
||||||
|
populateSharedUserState: settings => dispatch(doPopulateSharedUserState(settings)),
|
||||||
updateBlockHeight: () => dispatch(doUpdateBlockHeight()),
|
updateBlockHeight: () => dispatch(doUpdateBlockHeight()),
|
||||||
verifyUserEmail: (token, recaptcha) => dispatch(doUserEmailVerify(token, recaptcha)),
|
verifyUserEmail: (token, recaptcha) => dispatch(doUserEmailVerify(token, recaptcha)),
|
||||||
verifyUserEmailFailure: error => dispatch(doUserEmailVerifyFailure(error)),
|
verifyUserEmailFailure: error => dispatch(doUserEmailVerifyFailure(error)),
|
||||||
|
|||||||
+58
-49
@@ -1,5 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Lbry } from 'lbry-redux';
|
import { Lbry, doPreferenceGet } from 'lbry-redux';
|
||||||
|
import { Lbryio } from 'lbryinc';
|
||||||
import { ActivityIndicator, Linking, NativeModules, Platform, Text, View } from 'react-native';
|
import { ActivityIndicator, Linking, NativeModules, Platform, Text, View } from 'react-native';
|
||||||
import { NavigationActions, StackActions } from 'react-navigation';
|
import { NavigationActions, StackActions } from 'react-navigation';
|
||||||
import { decode as atob } from 'base-64';
|
import { decode as atob } from 'base-64';
|
||||||
@@ -37,12 +38,6 @@ class SplashScreen extends React.PureComponent {
|
|||||||
subscriptionsFetched: false,
|
subscriptionsFetched: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillMount() {
|
|
||||||
if (NativeModules.DaemonServiceControl) {
|
|
||||||
NativeModules.DaemonServiceControl.startService();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateStatus() {
|
updateStatus() {
|
||||||
Lbry.status().then(status => {
|
Lbry.status().then(status => {
|
||||||
this._updateStatusCallback(status);
|
this._updateStatusCallback(status);
|
||||||
@@ -57,7 +52,7 @@ class SplashScreen extends React.PureComponent {
|
|||||||
});
|
});
|
||||||
navigation.dispatch(resetAction);
|
navigation.dispatch(resetAction);
|
||||||
|
|
||||||
const launchUrl = navigation.state.params.launchUrl || this.state.launchUrl;
|
const launchUrl = navigation.state.params ? navigation.state.params.launchUrl : this.state.launchUrl;
|
||||||
if (launchUrl) {
|
if (launchUrl) {
|
||||||
if (launchUrl.startsWith('lbry://?verify=')) {
|
if (launchUrl.startsWith('lbry://?verify=')) {
|
||||||
let verification = {};
|
let verification = {};
|
||||||
@@ -88,16 +83,15 @@ class SplashScreen extends React.PureComponent {
|
|||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
const { emailToVerify, getSync, setEmailToVerify, verifyUserEmail, verifyUserEmailFailure } = this.props;
|
const { emailToVerify, getSync, setEmailToVerify, verifyUserEmail, verifyUserEmailFailure } = this.props;
|
||||||
|
const { daemonReady, shouldAuthenticate } = this.state;
|
||||||
const { user } = nextProps;
|
const { user } = nextProps;
|
||||||
|
|
||||||
if (this.state.daemonReady && this.state.shouldAuthenticate && user && user.id) {
|
if (daemonReady && shouldAuthenticate && user && user.id) {
|
||||||
this.setState({ shouldAuthenticate: false }, () => {
|
this.setState({ shouldAuthenticate: false }, () => {
|
||||||
// user is authenticated, navigate to the main view
|
// user is authenticated, navigate to the main view
|
||||||
if (user.has_verified_email) {
|
if (user.has_verified_email) {
|
||||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||||
if (walletPassword && walletPassword.trim().length > 0) {
|
getSync(walletPassword, () => this.getUserSettings());
|
||||||
getSync(walletPassword);
|
|
||||||
}
|
|
||||||
this.navigateToMain();
|
this.navigateToMain();
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@@ -108,6 +102,20 @@ class SplashScreen extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getUserSettings = () => {
|
||||||
|
const { populateSharedUserState } = this.props;
|
||||||
|
|
||||||
|
doPreferenceGet(
|
||||||
|
'shared',
|
||||||
|
preference => {
|
||||||
|
populateSharedUserState(preference);
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
/* failed */
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
finishSplashScreen = () => {
|
finishSplashScreen = () => {
|
||||||
const {
|
const {
|
||||||
authenticate,
|
authenticate,
|
||||||
@@ -129,16 +137,16 @@ class SplashScreen extends React.PureComponent {
|
|||||||
|
|
||||||
if (user && user.id && user.has_verified_email) {
|
if (user && user.id && user.has_verified_email) {
|
||||||
// user already authenticated
|
// user already authenticated
|
||||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||||
if (walletPassword) {
|
getSync(walletPassword, () => this.getUserSettings());
|
||||||
getSync(walletPassword);
|
|
||||||
}
|
|
||||||
this.navigateToMain();
|
this.navigateToMain();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
|
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
|
||||||
this.setState({ shouldAuthenticate: true });
|
this.setState({ shouldAuthenticate: true });
|
||||||
authenticate(appVersion, Platform.OS);
|
NativeModules.Firebase.getMessagingToken()
|
||||||
|
.then(firebaseToken => authenticate(appVersion, Platform.OS, firebaseToken))
|
||||||
|
.catch(() => authenticate(appVersion, Platform.OS));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -150,7 +158,10 @@ class SplashScreen extends React.PureComponent {
|
|||||||
|
|
||||||
_updateStatusCallback(status) {
|
_updateStatusCallback(status) {
|
||||||
const { fetchSubscriptions, getSync, setClientSetting } = this.props;
|
const { fetchSubscriptions, getSync, setClientSetting } = this.props;
|
||||||
|
const blockchainHeaders = status.blockchain_headers;
|
||||||
const startupStatus = status.startup_status;
|
const startupStatus = status.startup_status;
|
||||||
|
const walletStatus = status.wallet;
|
||||||
|
|
||||||
// At the minimum, wallet should be started and blocks_behind equal to 0 before calling resolve
|
// At the minimum, wallet should be started and blocks_behind equal to 0 before calling resolve
|
||||||
const hasStarted = startupStatus.stream_manager && startupStatus.wallet && status.wallet.blocks_behind <= 0;
|
const hasStarted = startupStatus.stream_manager && startupStatus.wallet && status.wallet.blocks_behind <= 0;
|
||||||
if (hasStarted) {
|
if (hasStarted) {
|
||||||
@@ -164,39 +175,40 @@ class SplashScreen extends React.PureComponent {
|
|||||||
isRunning: true,
|
isRunning: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// For now, automatically unlock the wallet if a password is set so that downloads work
|
Lbry.wallet_status().then(secureWalletStatus => {
|
||||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(password => {
|
// For now, automatically unlock the wallet if a password is set so that downloads work
|
||||||
if (password) {
|
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password => {
|
||||||
this.setState({
|
if ((secureWalletStatus.is_encrypted && !secureWalletStatus.is_locked) || secureWalletStatus.is_locked) {
|
||||||
message: 'Unlocking account',
|
this.setState({
|
||||||
details: 'Decrypting wallet',
|
message: 'Unlocking account',
|
||||||
});
|
details: 'Decrypting wallet',
|
||||||
|
});
|
||||||
|
|
||||||
// unlock the wallet and then finish the splash screen
|
// unlock the wallet and then finish the splash screen
|
||||||
Lbry.account_unlock({ password: password || '' })
|
Lbry.wallet_unlock({ password: password || '' }).then(unlocked => {
|
||||||
.then(() => {
|
if (unlocked) {
|
||||||
this.setState({
|
this.setState({
|
||||||
message: testingNetwork,
|
message: testingNetwork,
|
||||||
details: waitingForResolution,
|
details: waitingForResolution,
|
||||||
});
|
});
|
||||||
this.finishSplashScreen();
|
this.finishSplashScreen();
|
||||||
})
|
} else {
|
||||||
.catch(() => this.handleAccountUnlockFailed());
|
this.handleAccountUnlockFailed();
|
||||||
} else {
|
}
|
||||||
this.setState({
|
});
|
||||||
message: testingNetwork,
|
} else {
|
||||||
details: waitingForResolution,
|
this.setState({
|
||||||
});
|
message: testingNetwork,
|
||||||
this.finishSplashScreen();
|
details: waitingForResolution,
|
||||||
}
|
});
|
||||||
|
this.finishSplashScreen();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const blockchainHeaders = status.blockchain_headers;
|
|
||||||
const walletStatus = status.wallet;
|
|
||||||
|
|
||||||
if (blockchainHeaders) {
|
if (blockchainHeaders) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isDownloadingHeaders: blockchainHeaders.downloading_headers,
|
isDownloadingHeaders: blockchainHeaders.downloading_headers,
|
||||||
@@ -235,10 +247,7 @@ class SplashScreen extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (NativeModules.Firebase) {
|
NativeModules.Firebase.track('app_launch', null);
|
||||||
NativeModules.Firebase.track('app_launch', null);
|
|
||||||
}
|
|
||||||
|
|
||||||
NativeModules.Firebase.setCurrentScreen('Splash');
|
NativeModules.Firebase.setCurrentScreen('Splash');
|
||||||
|
|
||||||
this.props.fetchRewardedContent();
|
this.props.fetchRewardedContent();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import FileItem from 'component/fileItem';
|
|||||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||||
import Link from 'component/link';
|
import Link from 'component/link';
|
||||||
import ModalPicker from 'component/modalPicker';
|
import ModalPicker from 'component/modalPicker';
|
||||||
|
import ModalSuggestedSubscriptions from 'component/modalSuggestedSubscriptions';
|
||||||
import SubscribedChannelList from 'component/subscribedChannelList';
|
import SubscribedChannelList from 'component/subscribedChannelList';
|
||||||
import SuggestedSubscriptions from 'component/suggestedSubscriptions';
|
import SuggestedSubscriptions from 'component/suggestedSubscriptions';
|
||||||
import UriBar from 'component/uriBar';
|
import UriBar from 'component/uriBar';
|
||||||
@@ -34,6 +35,7 @@ class SubscriptionsPage extends React.PureComponent {
|
|||||||
showingSuggestedSubs: false,
|
showingSuggestedSubs: false,
|
||||||
showSortPicker: false,
|
showSortPicker: false,
|
||||||
showTimePicker: false,
|
showTimePicker: false,
|
||||||
|
showModalSuggestedSubs: false,
|
||||||
orderBy: ['release_time'],
|
orderBy: ['release_time'],
|
||||||
filteredChannels: [],
|
filteredChannels: [],
|
||||||
currentSortByItem: Constants.CLAIM_SEARCH_SORT_BY_ITEMS[1], // should always default to sorting subscriptions by new
|
currentSortByItem: Constants.CLAIM_SEARCH_SORT_BY_ITEMS[1], // should always default to sorting subscriptions by new
|
||||||
@@ -122,7 +124,7 @@ class SubscriptionsPage extends React.PureComponent {
|
|||||||
unreadSubscriptions,
|
unreadSubscriptions,
|
||||||
navigation,
|
navigation,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { currentSortByItem, filteredChannels, showSortPicker, showTimePicker } = this.state;
|
const { currentSortByItem, filteredChannels, showModalSuggestedSubs, showSortPicker, showTimePicker } = this.state;
|
||||||
|
|
||||||
const numberOfSubscriptions = subscribedChannels ? subscribedChannels.length : 0;
|
const numberOfSubscriptions = subscribedChannels ? subscribedChannels.length : 0;
|
||||||
const hasSubscriptions = numberOfSubscriptions > 0;
|
const hasSubscriptions = numberOfSubscriptions > 0;
|
||||||
@@ -151,23 +153,31 @@ class SubscriptionsPage extends React.PureComponent {
|
|||||||
</View>
|
</View>
|
||||||
{!this.state.showingSuggestedSubs && hasSubscriptions && (
|
{!this.state.showingSuggestedSubs && hasSubscriptions && (
|
||||||
<View style={subscriptionsStyle.pickerRow}>
|
<View style={subscriptionsStyle.pickerRow}>
|
||||||
<TouchableOpacity
|
<View style={subscriptionsStyle.leftPickerRow}>
|
||||||
style={subscriptionsStyle.tagSortBy}
|
|
||||||
onPress={() => this.setState({ showSortPicker: true })}
|
|
||||||
>
|
|
||||||
<Text style={subscriptionsStyle.tagSortText}>{currentSortByItem.label.split(' ')[0]}</Text>
|
|
||||||
<Icon style={subscriptionsStyle.tagSortIcon} name={'sort-down'} size={14} />
|
|
||||||
</TouchableOpacity>
|
|
||||||
|
|
||||||
{Constants.SORT_BY_TOP === currentSortByItem.name && (
|
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={subscriptionsStyle.tagSortBy}
|
style={subscriptionsStyle.tagSortBy}
|
||||||
onPress={() => this.setState({ showTimePicker: true })}
|
onPress={() => this.setState({ showSortPicker: true })}
|
||||||
>
|
>
|
||||||
<Text style={subscriptionsStyle.tagSortText}>{timeItem.label}</Text>
|
<Text style={subscriptionsStyle.tagSortText}>{currentSortByItem.label.split(' ')[0]}</Text>
|
||||||
<Icon style={subscriptionsStyle.tagSortIcon} name={'sort-down'} size={14} />
|
<Icon style={subscriptionsStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
)}
|
|
||||||
|
{Constants.SORT_BY_TOP === currentSortByItem.name && (
|
||||||
|
<TouchableOpacity
|
||||||
|
style={subscriptionsStyle.tagSortBy}
|
||||||
|
onPress={() => this.setState({ showTimePicker: true })}
|
||||||
|
>
|
||||||
|
<Text style={subscriptionsStyle.tagSortText}>{timeItem.label}</Text>
|
||||||
|
<Icon style={subscriptionsStyle.tagSortIcon} name={'sort-down'} size={14} />
|
||||||
|
</TouchableOpacity>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<Link
|
||||||
|
style={subscriptionsStyle.suggestedLink}
|
||||||
|
text={'Suggested'}
|
||||||
|
onPress={() => this.setState({ showModalSuggestedSubs: true })}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{!this.state.showingSuggestedSubs && hasSubscriptions && !loading && (
|
{!this.state.showingSuggestedSubs && hasSubscriptions && !loading && (
|
||||||
@@ -223,7 +233,9 @@ class SubscriptionsPage extends React.PureComponent {
|
|||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!showSortPicker && !showTimePicker && <FloatingWalletBalance navigation={navigation} />}
|
{!showSortPicker && !showTimePicker && !showModalSuggestedSubs && (
|
||||||
|
<FloatingWalletBalance navigation={navigation} />
|
||||||
|
)}
|
||||||
{showSortPicker && (
|
{showSortPicker && (
|
||||||
<ModalPicker
|
<ModalPicker
|
||||||
title={__('Sort content by')}
|
title={__('Sort content by')}
|
||||||
@@ -242,6 +254,13 @@ class SubscriptionsPage extends React.PureComponent {
|
|||||||
items={Constants.CLAIM_SEARCH_TIME_ITEMS}
|
items={Constants.CLAIM_SEARCH_TIME_ITEMS}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{showModalSuggestedSubs && (
|
||||||
|
<ModalSuggestedSubscriptions
|
||||||
|
navigation={navigation}
|
||||||
|
onOverlayPress={() => this.setState({ showModalSuggestedSubs: false })}
|
||||||
|
onDonePress={() => this.setState({ showModalSuggestedSubs: false })}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React from 'react';
|
|||||||
import { ActivityIndicator, NativeModules, View, ScrollView, Text } from 'react-native';
|
import { ActivityIndicator, NativeModules, View, ScrollView, Text } from 'react-native';
|
||||||
import Colors from 'styles/colors';
|
import Colors from 'styles/colors';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
import EmptyStateView from 'component/emptyStateView';
|
||||||
import TransactionList from 'component/transactionList';
|
import TransactionList from 'component/transactionList';
|
||||||
import UriBar from 'component/uriBar';
|
import UriBar from 'component/uriBar';
|
||||||
import walletStyle from 'styles/wallet';
|
import walletStyle from 'styles/wallet';
|
||||||
@@ -53,11 +54,9 @@ class TransactionHistoryPage extends React.PureComponent {
|
|||||||
<Text style={walletStyle.loadingText}>Loading transactions...</Text>
|
<Text style={walletStyle.loadingText}>Loading transactions...</Text>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
{!fetchingTransactions && transactions.length === 0 && <EmptyStateView message={'No transactions to list.'} />}
|
||||||
<ScrollView style={walletStyle.transactionHistoryScroll}>
|
<ScrollView style={walletStyle.transactionHistoryScroll}>
|
||||||
<View style={walletStyle.historyList}>
|
<View style={walletStyle.historyList}>
|
||||||
{!fetchingTransactions && transactions.length === 0 && (
|
|
||||||
<Text style={walletStyle.infoText}>No transactions to list.</Text>
|
|
||||||
)}
|
|
||||||
{!fetchingTransactions && transactions && transactions.length > 0 && (
|
{!fetchingTransactions && transactions && transactions.length > 0 && (
|
||||||
<TransactionList navigation={navigation} transactions={transactions} />
|
<TransactionList navigation={navigation} transactions={transactions} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { doToast } from 'lbry-redux';
|
|||||||
import {
|
import {
|
||||||
doCheckSync,
|
doCheckSync,
|
||||||
doGetSync,
|
doGetSync,
|
||||||
doSetDefaultAccount,
|
|
||||||
doSyncApply,
|
doSyncApply,
|
||||||
doUserEmailNew,
|
doUserEmailNew,
|
||||||
doUserEmailToVerify,
|
doUserEmailToVerify,
|
||||||
@@ -55,12 +54,11 @@ const select = state => ({
|
|||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
addUserEmail: email => dispatch(doUserEmailNew(email)),
|
||||||
addUserPhone: (phone, countryCode) => dispatch(doUserPhoneNew(phone, countryCode)),
|
addUserPhone: (phone, countryCode) => dispatch(doUserPhoneNew(phone, countryCode)),
|
||||||
getSync: password => dispatch(doGetSync(password)),
|
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||||
checkSync: () => dispatch(doCheckSync()),
|
checkSync: () => dispatch(doCheckSync()),
|
||||||
verifyPhone: verificationCode => dispatch(doUserPhoneVerify(verificationCode)),
|
verifyPhone: verificationCode => dispatch(doUserPhoneVerify(verificationCode)),
|
||||||
notify: data => dispatch(doToast(data)),
|
notify: data => dispatch(doToast(data)),
|
||||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||||
setDefaultAccount: (success, failure) => dispatch(doSetDefaultAccount(success, failure)),
|
|
||||||
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
setEmailToVerify: email => dispatch(doUserEmailToVerify(email)),
|
||||||
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
syncApply: (hash, data, password) => dispatch(doSyncApply(hash, data, password)),
|
||||||
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
resendVerificationEmail: email => dispatch(doUserResendVerificationEmail(email)),
|
||||||
|
|||||||
@@ -37,20 +37,26 @@ class SyncVerifyPage extends React.PureComponent {
|
|||||||
if (!hasSyncedWallet) {
|
if (!hasSyncedWallet) {
|
||||||
// fresh account with no sync
|
// fresh account with no sync
|
||||||
const newPassword = this.state.password ? this.state.password : '';
|
const newPassword = this.state.password ? this.state.password : '';
|
||||||
Lbry.account_encrypt({ new_password: newPassword }).then(() => {
|
if (newPassword.trim().length === 0) {
|
||||||
getSync(newPassword);
|
getSync(newPassword);
|
||||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||||
navigation.goBack();
|
navigation.goBack();
|
||||||
});
|
} else {
|
||||||
|
Lbry.wallet_encrypt({ new_password: newPassword }).then(() => {
|
||||||
|
getSync(newPassword);
|
||||||
|
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||||
|
navigation.goBack();
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
syncApply(syncHash, syncData, this.state.password);
|
syncApply(syncHash, syncData, this.state.password ? this.state.password : '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
const { getSyncIsPending, syncApplyIsPending, syncApplyErrorMessage } = nextProps;
|
const { getSyncIsPending, syncApplyIsPending, syncApplyErrorMessage } = nextProps;
|
||||||
const { getSync, hasSyncedWallet, navigation, notify, setClientSetting, setDefaultAccount } = this.props;
|
const { getSync, hasSyncedWallet, navigation, notify, setClientSetting } = this.props;
|
||||||
if (this.state.checkSyncStarted && !getSyncIsPending) {
|
if (this.state.checkSyncStarted && !getSyncIsPending) {
|
||||||
this.setState({ syncChecked: true });
|
this.setState({ syncChecked: true });
|
||||||
}
|
}
|
||||||
@@ -63,32 +69,39 @@ class SyncVerifyPage extends React.PureComponent {
|
|||||||
// password successfully verified
|
// password successfully verified
|
||||||
if (NativeModules.UtilityModule) {
|
if (NativeModules.UtilityModule) {
|
||||||
NativeModules.UtilityModule.setSecureValue(
|
NativeModules.UtilityModule.setSecureValue(
|
||||||
Constants.KEY_FIRST_RUN_PASSWORD,
|
Constants.KEY_WALLET_PASSWORD,
|
||||||
this.state.password ? this.state.password : ''
|
this.state.password ? this.state.password : ''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
setDefaultAccount(
|
|
||||||
() => {
|
|
||||||
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
|
||||||
|
|
||||||
// unlock the wallet
|
this.finishSync(true);
|
||||||
Lbry.account_unlock({ password: this.state.password ? this.state.password : '' })
|
|
||||||
.then(() => navigation.goBack())
|
|
||||||
.catch(err =>
|
|
||||||
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' })
|
|
||||||
);
|
|
||||||
},
|
|
||||||
err => {
|
|
||||||
notify({
|
|
||||||
message:
|
|
||||||
'The account restore operation could not be completed successfully. Please restart the app and try again.',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finishSync = (notifyUnlockFailed = false) => {
|
||||||
|
const { navigation, notify, setClientSetting } = this.props;
|
||||||
|
|
||||||
|
setClientSetting(Constants.SETTING_DEVICE_WALLET_SYNCED, true);
|
||||||
|
|
||||||
|
// unlock the wallet (if locked)
|
||||||
|
Lbry.wallet_status().then(status => {
|
||||||
|
if (status.is_locked) {
|
||||||
|
Lbry.wallet_unlock({ password: this.state.password ? this.state.password : '' }).then(unlocked => {
|
||||||
|
if (unlocked) {
|
||||||
|
navigation.goBack();
|
||||||
|
} else {
|
||||||
|
if (notifyUnlockFailed) {
|
||||||
|
notify({ message: 'The wallet could not be unlocked at this time. Please restart the app.' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
navigation.goBack();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
handleChangeText = text => {
|
handleChangeText = text => {
|
||||||
// save the value to the state email
|
// save the value to the state email
|
||||||
const { onPasswordChanged } = this.props;
|
const { onPasswordChanged } = this.props;
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ class VerificationScreen extends React.PureComponent {
|
|||||||
notify,
|
notify,
|
||||||
addUserPhone,
|
addUserPhone,
|
||||||
getSyncIsPending,
|
getSyncIsPending,
|
||||||
setDefaultAccount,
|
|
||||||
hasSyncedWallet,
|
hasSyncedWallet,
|
||||||
setSyncIsPending,
|
setSyncIsPending,
|
||||||
syncApplyIsPending,
|
syncApplyIsPending,
|
||||||
@@ -162,7 +161,6 @@ class VerificationScreen extends React.PureComponent {
|
|||||||
notify={notify}
|
notify={notify}
|
||||||
setEmailVerificationPhase={this.setEmailVerificationPhase}
|
setEmailVerificationPhase={this.setEmailVerificationPhase}
|
||||||
setClientSetting={setClientSetting}
|
setClientSetting={setClientSetting}
|
||||||
setDefaultAccount={setDefaultAccount}
|
|
||||||
setSyncIsPending={setSyncIsPending}
|
setSyncIsPending={setSyncIsPending}
|
||||||
syncApplyIsPending={syncApplyIsPending}
|
syncApplyIsPending={syncApplyIsPending}
|
||||||
syncApplyErrorMessage={syncApplyErrorMessage}
|
syncApplyErrorMessage={syncApplyErrorMessage}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
|||||||
import { selectCurrentRoute } from 'redux/selectors/drawer';
|
import { selectCurrentRoute } from 'redux/selectors/drawer';
|
||||||
import { selectBalance } from 'lbry-redux';
|
import { selectBalance } from 'lbry-redux';
|
||||||
import { doCheckSync, doGetSync, selectUser, selectHasSyncedWallet } from 'lbryinc';
|
import { doCheckSync, doGetSync, selectUser, selectHasSyncedWallet } from 'lbryinc';
|
||||||
import Constants from 'constants';
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import WalletPage from './view';
|
import WalletPage from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
@@ -21,7 +21,7 @@ const select = state => ({
|
|||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
checkSync: () => dispatch(doCheckSync()),
|
checkSync: () => dispatch(doCheckSync()),
|
||||||
getSync: password => dispatch(doGetSync(password)),
|
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_WALLET)),
|
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_WALLET)),
|
||||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||||
|
|||||||
@@ -46,10 +46,8 @@ class WalletPage extends React.PureComponent {
|
|||||||
|
|
||||||
const { deviceWalletSynced, getSync, user } = this.props;
|
const { deviceWalletSynced, getSync, user } = this.props;
|
||||||
if (deviceWalletSynced && user && user.has_verified_email) {
|
if (deviceWalletSynced && user && user.has_verified_email) {
|
||||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_FIRST_RUN_PASSWORD).then(walletPassword => {
|
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(walletPassword => {
|
||||||
if (walletPassword) {
|
getSync(walletPassword);
|
||||||
getSync(walletPassword);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ const channelCreatorStyle = StyleSheet.create({
|
|||||||
helpText: {
|
helpText: {
|
||||||
fontFamily: 'Inter-UI-Regular',
|
fontFamily: 'Inter-UI-Regular',
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
|
color: Colors.DescriptionGrey,
|
||||||
},
|
},
|
||||||
channelTitleInput: {
|
channelTitleInput: {
|
||||||
marginBottom: 4,
|
marginBottom: 4,
|
||||||
@@ -104,11 +105,12 @@ const channelCreatorStyle = StyleSheet.create({
|
|||||||
avatarImageContainer: {
|
avatarImageContainer: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
left: screenWidth / 2 - 80 / 2,
|
left: screenWidth / 2 - 80 / 2,
|
||||||
bottom: -16,
|
bottom: -8,
|
||||||
width: 80,
|
width: 80,
|
||||||
height: 80,
|
height: 80,
|
||||||
borderRadius: 160,
|
borderRadius: 160,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
|
zIndex: 50,
|
||||||
},
|
},
|
||||||
avatarTouchArea: {
|
avatarTouchArea: {
|
||||||
width: 80,
|
width: 80,
|
||||||
@@ -121,7 +123,7 @@ const channelCreatorStyle = StyleSheet.create({
|
|||||||
height: '100%',
|
height: '100%',
|
||||||
},
|
},
|
||||||
listFooter: {
|
listFooter: {
|
||||||
marginTop: 24,
|
marginTop: 8,
|
||||||
},
|
},
|
||||||
createChannelButton: {
|
createChannelButton: {
|
||||||
backgroundColor: Colors.LbryGreen,
|
backgroundColor: Colors.LbryGreen,
|
||||||
@@ -254,6 +256,15 @@ const channelCreatorStyle = StyleSheet.create({
|
|||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
marginLeft: 4,
|
marginLeft: 4,
|
||||||
},
|
},
|
||||||
|
loading: {
|
||||||
|
position: 'absolute',
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
top: 0,
|
||||||
|
bottom: 0,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default channelCreatorStyle;
|
export default channelCreatorStyle;
|
||||||
@@ -169,6 +169,9 @@ const channelPageStyle = StyleSheet.create({
|
|||||||
actionButton: {
|
actionButton: {
|
||||||
backgroundColor: Colors.White,
|
backgroundColor: Colors.White,
|
||||||
},
|
},
|
||||||
|
deleteButton: {
|
||||||
|
marginLeft: 8,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default channelPageStyle;
|
export default channelPageStyle;
|
||||||
@@ -19,6 +19,7 @@ const Colors = {
|
|||||||
VeryLightGrey: '#f1f1f1',
|
VeryLightGrey: '#f1f1f1',
|
||||||
White: '#ffffff',
|
White: '#ffffff',
|
||||||
UriDescBlue: '#3971db',
|
UriDescBlue: '#3971db',
|
||||||
|
RewardDriverBlue: '#2196f3',
|
||||||
|
|
||||||
StatsAudio: '#f6a637',
|
StatsAudio: '#f6a637',
|
||||||
StatsImage: '#ff4a7d',
|
StatsImage: '#ff4a7d',
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import { StyleSheet } from 'react-native';
|
||||||
|
import Colors from './colors';
|
||||||
|
|
||||||
|
const emptyStateStyle = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
position: 'absolute',
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
paddingLeft: 24,
|
||||||
|
paddingRight: 24,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
zIndex: 99,
|
||||||
|
},
|
||||||
|
outerContainer: {
|
||||||
|
top: 60,
|
||||||
|
},
|
||||||
|
innerContainer: {
|
||||||
|
top: 0,
|
||||||
|
},
|
||||||
|
button: {
|
||||||
|
backgroundColor: Colors.LbryGreen,
|
||||||
|
fontSize: 18,
|
||||||
|
},
|
||||||
|
image: {
|
||||||
|
width: 128,
|
||||||
|
height: 170,
|
||||||
|
},
|
||||||
|
message: {
|
||||||
|
marginTop: 24,
|
||||||
|
textAlign: 'center',
|
||||||
|
fontFamily: 'Inter-UI-Regular',
|
||||||
|
fontSize: 18,
|
||||||
|
lineHeight: 28,
|
||||||
|
marginBottom: 24,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default emptyStateStyle;
|
||||||
+29
-1
@@ -322,6 +322,9 @@ const filePageStyle = StyleSheet.create({
|
|||||||
saveFileButton: {
|
saveFileButton: {
|
||||||
marginRight: 8,
|
marginRight: 8,
|
||||||
},
|
},
|
||||||
|
reportButton: {
|
||||||
|
marginRight: 8,
|
||||||
|
},
|
||||||
tagContainer: {
|
tagContainer: {
|
||||||
marginLeft: 12,
|
marginLeft: 12,
|
||||||
marginRight: 12,
|
marginRight: 12,
|
||||||
@@ -345,13 +348,17 @@ const filePageStyle = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
rewardDriverCard: {
|
rewardDriverCard: {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
backgroundColor: Colors.BrighterLbryGreen,
|
backgroundColor: Colors.RewardDriverBlue,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
paddingLeft: 16,
|
paddingLeft: 16,
|
||||||
paddingRight: 16,
|
paddingRight: 16,
|
||||||
paddingTop: 12,
|
paddingTop: 12,
|
||||||
paddingBottom: 12,
|
paddingBottom: 12,
|
||||||
},
|
},
|
||||||
|
rewardDriverIcon: {
|
||||||
|
color: Colors.White,
|
||||||
|
marginRight: 8,
|
||||||
|
},
|
||||||
rewardDriverText: {
|
rewardDriverText: {
|
||||||
fontFamily: 'Inter-UI-Regular',
|
fontFamily: 'Inter-UI-Regular',
|
||||||
color: Colors.White,
|
color: Colors.White,
|
||||||
@@ -374,6 +381,27 @@ const filePageStyle = StyleSheet.create({
|
|||||||
backButtonIcon: {
|
backButtonIcon: {
|
||||||
color: Colors.White,
|
color: Colors.White,
|
||||||
},
|
},
|
||||||
|
largeButton: {
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
marginRight: 48,
|
||||||
|
},
|
||||||
|
largeButtonIcon: {
|
||||||
|
color: Colors.DescriptionGrey,
|
||||||
|
},
|
||||||
|
largeButtonText: {
|
||||||
|
fontFamily: 'Inter-UI-Regular',
|
||||||
|
fontSize: 14,
|
||||||
|
marginTop: 4,
|
||||||
|
},
|
||||||
|
largeButtonsRow: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
marginLeft: 20,
|
||||||
|
marginRight: 20,
|
||||||
|
marginTop: 12,
|
||||||
|
marginBottom: 12,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default filePageStyle;
|
export default filePageStyle;
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import { StyleSheet } from 'react-native';
|
||||||
|
import Colors from './colors';
|
||||||
|
|
||||||
|
const modalPickerStyle = StyleSheet.create({
|
||||||
|
overlay: {
|
||||||
|
backgroundColor: '#00000055',
|
||||||
|
flex: 1,
|
||||||
|
position: 'absolute',
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
top: 0,
|
||||||
|
bottom: 0,
|
||||||
|
zIndex: 300,
|
||||||
|
},
|
||||||
|
overlayTouchArea: {
|
||||||
|
position: 'absolute',
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
top: 0,
|
||||||
|
bottom: 0,
|
||||||
|
},
|
||||||
|
container: {
|
||||||
|
position: 'absolute',
|
||||||
|
left: 8,
|
||||||
|
right: 8,
|
||||||
|
bottom: 8,
|
||||||
|
borderRadius: 8,
|
||||||
|
backgroundColor: Colors.White,
|
||||||
|
overflow: 'hidden',
|
||||||
|
},
|
||||||
|
paddedContatiner: {
|
||||||
|
padding: 12,
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
marginTop: 16,
|
||||||
|
left: 8,
|
||||||
|
bottom: 8,
|
||||||
|
position: 'absolute',
|
||||||
|
},
|
||||||
|
doneButton: {
|
||||||
|
alignSelf: 'flex-start',
|
||||||
|
backgroundColor: Colors.LbryGreen,
|
||||||
|
paddingLeft: 16,
|
||||||
|
paddingRight: 16,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default modalPickerStyle;
|
||||||
+26
-3
@@ -1,6 +1,9 @@
|
|||||||
import { StyleSheet } from 'react-native';
|
import { Dimensions, StyleSheet } from 'react-native';
|
||||||
import Colors from './colors';
|
import Colors from './colors';
|
||||||
|
|
||||||
|
const screenDimension = Dimensions.get('window');
|
||||||
|
const screenWidth = screenDimension.width;
|
||||||
|
|
||||||
const publishStyle = StyleSheet.create({
|
const publishStyle = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
@@ -294,7 +297,7 @@ const publishStyle = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
rewardDriverCard: {
|
rewardDriverCard: {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
backgroundColor: Colors.BrighterLbryGreen,
|
backgroundColor: Colors.RewardDriverBlue,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
paddingLeft: 16,
|
paddingLeft: 16,
|
||||||
paddingRight: 16,
|
paddingRight: 16,
|
||||||
@@ -433,8 +436,13 @@ const publishStyle = StyleSheet.create({
|
|||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: Colors.DescriptionGrey,
|
color: Colors.DescriptionGrey,
|
||||||
},
|
},
|
||||||
|
helpText: {
|
||||||
|
fontFamily: 'Inter-UI-Regular',
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.DescriptionGrey,
|
||||||
|
},
|
||||||
publishesFooter: {
|
publishesFooter: {
|
||||||
marginTop: 16,
|
marginTop: 2,
|
||||||
marginLeft: 16,
|
marginLeft: 16,
|
||||||
marginRight: 16,
|
marginRight: 16,
|
||||||
},
|
},
|
||||||
@@ -443,6 +451,21 @@ const publishStyle = StyleSheet.create({
|
|||||||
backgroundColor: Colors.LbryGreen,
|
backgroundColor: Colors.LbryGreen,
|
||||||
marginTop: 16,
|
marginTop: 16,
|
||||||
},
|
},
|
||||||
|
thumbnailEditOverlay: {
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
borderRadius: 24,
|
||||||
|
position: 'absolute',
|
||||||
|
padding: 8,
|
||||||
|
left: screenWidth / 2 - 32 / 2,
|
||||||
|
bottom: 8,
|
||||||
|
backgroundColor: '#00000077',
|
||||||
|
},
|
||||||
|
editIcon: {
|
||||||
|
color: Colors.White,
|
||||||
|
fontFamily: 'Inter-UI-SemiBold',
|
||||||
|
fontSize: 12,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default publishStyle;
|
export default publishStyle;
|
||||||
@@ -39,6 +39,21 @@ const settingsStyle = StyleSheet.create({
|
|||||||
fontFamily: 'Inter-UI-Regular',
|
fontFamily: 'Inter-UI-Regular',
|
||||||
lineHeight: 18,
|
lineHeight: 18,
|
||||||
},
|
},
|
||||||
|
sectionTitle: {
|
||||||
|
fontFamily: 'Inter-UI-Regular',
|
||||||
|
fontSize: 20,
|
||||||
|
marginBottom: 4,
|
||||||
|
},
|
||||||
|
sectionDescription: {
|
||||||
|
color: '#aaaaaa',
|
||||||
|
fontFamily: 'Inter-UI-Regular',
|
||||||
|
fontSize: 12,
|
||||||
|
lineHeight: 18,
|
||||||
|
marginBottom: 8,
|
||||||
|
},
|
||||||
|
sectionDivider: {
|
||||||
|
marginTop: 24,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default settingsStyle;
|
export default settingsStyle;
|
||||||
@@ -13,7 +13,7 @@ const subscriptionsStyle = StyleSheet.create({
|
|||||||
suggestedSubsContainer: {
|
suggestedSubsContainer: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
suggestedScrollPadding: {
|
suggestedScrollContent: {
|
||||||
paddingTop: 8,
|
paddingTop: 8,
|
||||||
},
|
},
|
||||||
button: {
|
button: {
|
||||||
@@ -159,6 +159,7 @@ const subscriptionsStyle = StyleSheet.create({
|
|||||||
pickerRow: {
|
pickerRow: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
|
justifyContent: 'space-between',
|
||||||
marginLeft: 16,
|
marginLeft: 16,
|
||||||
marginRight: 16,
|
marginRight: 16,
|
||||||
marginTop: 8,
|
marginTop: 8,
|
||||||
@@ -245,6 +246,24 @@ const subscriptionsStyle = StyleSheet.create({
|
|||||||
marginRight: 4,
|
marginRight: 4,
|
||||||
marginBottom: 4,
|
marginBottom: 4,
|
||||||
},
|
},
|
||||||
|
leftPickerRow: {
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
|
suggestedLink: {
|
||||||
|
fontFamily: 'Inter-UI-Regular',
|
||||||
|
fontSize: 14,
|
||||||
|
},
|
||||||
|
modalContainer: {
|
||||||
|
height: '80%',
|
||||||
|
backgroundColor: Colors.PageBackground,
|
||||||
|
},
|
||||||
|
modalScrollContainer: {
|
||||||
|
marginBottom: 50,
|
||||||
|
},
|
||||||
|
modalSuggestedScrollContent: {
|
||||||
|
paddingTop: 16,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default subscriptionsStyle;
|
export default subscriptionsStyle;
|
||||||
@@ -36,7 +36,7 @@ const uriBarStyle = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
overlay: {
|
overlay: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'red',
|
||||||
top: 0,
|
top: 0,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
zIndex: 200,
|
zIndex: 200,
|
||||||
@@ -54,9 +54,10 @@ const uriBarStyle = StyleSheet.create({
|
|||||||
item: {
|
item: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
padding: 12,
|
paddingLeft: 16,
|
||||||
paddingTop: 8,
|
paddingRight: 16,
|
||||||
paddingBottom: 8,
|
paddingTop: 12,
|
||||||
|
paddingBottom: 12,
|
||||||
},
|
},
|
||||||
itemContent: {
|
itemContent: {
|
||||||
marginLeft: 12,
|
marginLeft: 12,
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ const walletStyle = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
rewardDriverCard: {
|
rewardDriverCard: {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
backgroundColor: Colors.BrighterLbryGreen,
|
backgroundColor: Colors.RewardDriverBlue,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
padding: 16,
|
padding: 16,
|
||||||
marginLeft: 16,
|
marginLeft: 16,
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
// underscore's deep equal function
|
||||||
|
// https://github.com/jashkenas/underscore/blob/master/underscore.js#L1189
|
||||||
|
|
||||||
|
export default function isEqual(a, b, aStack, bStack) {
|
||||||
|
// Identical objects are equal. `0 === -0`, but they aren't identical.
|
||||||
|
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
|
||||||
|
if (a === b) return a !== 0 || 1 / a === 1 / b;
|
||||||
|
// `null` or `undefined` only equal to itself (strict comparison).
|
||||||
|
if (a == null || b == null) return false;
|
||||||
|
// `NaN`s are equivalent, but non-reflexive.
|
||||||
|
if (a !== a) return b !== b;
|
||||||
|
// Exhaust primitive checks
|
||||||
|
var type = typeof a;
|
||||||
|
if (type !== 'function' && type !== 'object' && typeof b != 'object') return false;
|
||||||
|
return deepEq(a, b, aStack, bStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deepEq(a, b, aStack, bStack) {
|
||||||
|
// Compare `[[Class]]` names.
|
||||||
|
var className = toString.call(a);
|
||||||
|
if (className !== toString.call(b)) return false;
|
||||||
|
switch (className) {
|
||||||
|
// Strings, numbers, regular expressions, dates, and booleans are compared by value.
|
||||||
|
case '[object RegExp]':
|
||||||
|
// RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
|
||||||
|
case '[object String]':
|
||||||
|
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
|
||||||
|
// equivalent to `new String("5")`.
|
||||||
|
return '' + a === '' + b;
|
||||||
|
case '[object Number]':
|
||||||
|
// `NaN`s are equivalent, but non-reflexive.
|
||||||
|
// Object(NaN) is equivalent to NaN.
|
||||||
|
if (+a !== +a) return +b !== +b;
|
||||||
|
// An `egal` comparison is performed for other numeric values.
|
||||||
|
return +a === 0 ? 1 / +a === 1 / b : +a === +b;
|
||||||
|
case '[object Date]':
|
||||||
|
case '[object Boolean]':
|
||||||
|
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
|
||||||
|
// millisecond representations. Note that invalid dates with millisecond representations
|
||||||
|
// of `NaN` are not equivalent.
|
||||||
|
return +a === +b;
|
||||||
|
case '[object Symbol]':
|
||||||
|
return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
var areArrays = className === '[object Array]';
|
||||||
|
if (!areArrays) {
|
||||||
|
if (typeof a != 'object' || typeof b != 'object') return false;
|
||||||
|
|
||||||
|
// Objects with different constructors are not equivalent, but `Object`s or `Array`s
|
||||||
|
// from different frames are.
|
||||||
|
var aCtor = a.constructor,
|
||||||
|
bCtor = b.constructor;
|
||||||
|
if (
|
||||||
|
aCtor !== bCtor &&
|
||||||
|
!(
|
||||||
|
typeof aCtor === 'function' &&
|
||||||
|
aCtor instanceof aCtor &&
|
||||||
|
typeof bCtor === 'function' &&
|
||||||
|
bCtor instanceof bCtor
|
||||||
|
) &&
|
||||||
|
('constructor' in a && 'constructor' in b)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Assume equality for cyclic structures. The algorithm for detecting cyclic
|
||||||
|
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
|
||||||
|
|
||||||
|
// Initializing stack of traversed objects.
|
||||||
|
// It's done here since we only need them for objects and arrays comparison.
|
||||||
|
aStack = aStack || [];
|
||||||
|
bStack = bStack || [];
|
||||||
|
var length = aStack.length;
|
||||||
|
while (length--) {
|
||||||
|
// Linear search. Performance is inversely proportional to the number of
|
||||||
|
// unique nested structures.
|
||||||
|
if (aStack[length] === a) return bStack[length] === b;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the first object to the stack of traversed objects.
|
||||||
|
aStack.push(a);
|
||||||
|
bStack.push(b);
|
||||||
|
|
||||||
|
// Recursively compare objects and arrays.
|
||||||
|
if (areArrays) {
|
||||||
|
// Compare array lengths to determine if a deep comparison is necessary.
|
||||||
|
length = a.length;
|
||||||
|
if (length !== b.length) return false;
|
||||||
|
// Deep compare the contents, ignoring non-numeric properties.
|
||||||
|
while (length--) {
|
||||||
|
if (!isEqual(a[length], b[length], aStack, bStack)) return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Deep compare objects.
|
||||||
|
var keys = Object.keys(a),
|
||||||
|
key;
|
||||||
|
length = keys.length;
|
||||||
|
// Ensure that both objects contain the same number of properties before comparing deep equality.
|
||||||
|
if (Object.keys(b).length !== length) return false;
|
||||||
|
while (length--) {
|
||||||
|
// Deep compare each member
|
||||||
|
key = keys[length];
|
||||||
|
if (!(has(b, key) && isEqual(a[key], b[key], aStack, bStack))) return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Remove the first object from the stack of traversed objects.
|
||||||
|
aStack.pop();
|
||||||
|
bStack.pop();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function has(obj, path) {
|
||||||
|
return obj != null && hasOwnProperty.call(obj, path);
|
||||||
|
}
|
||||||
|
/* eslint-enable */
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { NavigationActions, StackActions } from 'react-navigation';
|
import { NavigationActions, StackActions } from 'react-navigation';
|
||||||
import { buildURI, isURIValid, normalizeURI } from 'lbry-redux';
|
import { buildURI, isURIValid, normalizeURI } from 'lbry-redux';
|
||||||
|
import { Lbryio } from 'lbryinc';
|
||||||
import { doPopDrawerStack, doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
import { doPopDrawerStack, doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||||
import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants, { DrawerRoutes, InnerDrawerRoutes } from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
|
|
||||||
@@ -290,6 +291,23 @@ export function __(str) {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function logPublish(claimResult) {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
if (!__DEV__) {
|
||||||
|
const { permanent_url: uri, claim_id: claimId, txid, nout, signing_channel: signingChannel } = claimResult;
|
||||||
|
let channelClaimId;
|
||||||
|
if (signingChannel) {
|
||||||
|
channelClaimId = signingChannel.claim_id;
|
||||||
|
}
|
||||||
|
const outpoint = `${txid}:${nout}`;
|
||||||
|
const params = { uri, claim_id: claimId, outpoint };
|
||||||
|
if (channelClaimId) {
|
||||||
|
params['channel_claim_id'] = channelClaimId;
|
||||||
|
}
|
||||||
|
Lbryio.call('event', 'publish', params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function uploadImageAsset(filePath, success, failure) {
|
export function uploadImageAsset(filePath, success, failure) {
|
||||||
const makeid = () => {
|
const makeid = () => {
|
||||||
let text = '';
|
let text = '';
|
||||||
|
|||||||
Reference in new issue
Block a user