Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5aed981049 | ||
|
|
04f1537e76 | ||
|
|
55b292ab0e | ||
|
|
736de8e5d9 | ||
|
|
f06252d397 | ||
|
|
fa25789855 | ||
|
|
514e077fbb | ||
|
|
3d44bfa88b | ||
|
|
f81e2d7441 | ||
|
|
81bdd37576 | ||
|
|
76938d3349 | ||
|
|
3a5edc461a | ||
|
|
3a8af2d7a0 | ||
|
|
601c589f69 | ||
|
|
f5ae1f34f7 | ||
|
|
4656be64a7 | ||
|
|
8e377d0e74 | ||
|
|
bf7f836465 | ||
|
|
017787ef25 | ||
|
|
d9ada93ff3 |
No files matched your search
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-2019 LBRY Inc
|
||||
Copyright (c) 2017-2020 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:
|
||||
|
||||
|
||||
Generated
+4
-4
@@ -7067,8 +7067,8 @@
|
||||
}
|
||||
},
|
||||
"lbry-redux": {
|
||||
"version": "github:lbryio/lbry-redux#c910cd2b80b165843a81fdf6ce96094429b94ec8",
|
||||
"from": "github:lbryio/lbry-redux#c910cd2b80b165843a81fdf6ce96094429b94ec8",
|
||||
"version": "github:lbryio/lbry-redux#1de1d534c982db913f145a6171f39d7b8ebd61af",
|
||||
"from": "github:lbryio/lbry-redux#1de1d534c982db913f145a6171f39d7b8ebd61af",
|
||||
"requires": {
|
||||
"proxy-polyfill": "0.1.6",
|
||||
"reselect": "^3.0.0",
|
||||
@@ -7076,8 +7076,8 @@
|
||||
}
|
||||
},
|
||||
"lbryinc": {
|
||||
"version": "github:lbryio/lbryinc#053ca52f4f7f9bf8eb62a3581b183671a475ad1c",
|
||||
"from": "github:lbryio/lbryinc#053ca52f4f7f9bf8eb62a3581b183671a475ad1c",
|
||||
"version": "github:lbryio/lbryinc#138a053754ec8e3da8e9bf153d32f527c962f25c",
|
||||
"from": "github:lbryio/lbryinc#138a053754ec8e3da8e9bf153d32f527c962f25c",
|
||||
"requires": {
|
||||
"reselect": "^3.0.0"
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@
|
||||
"base-64": "^0.1.0",
|
||||
"@expo/vector-icons": "^8.1.0",
|
||||
"gfycat-style-urls": "^1.0.3",
|
||||
"lbry-redux": "lbryio/lbry-redux#c910cd2b80b165843a81fdf6ce96094429b94ec8",
|
||||
"lbryinc": "lbryio/lbryinc#053ca52f4f7f9bf8eb62a3581b183671a475ad1c",
|
||||
"lbry-redux": "lbryio/lbry-redux#1de1d534c982db913f145a6171f39d7b8ebd61af",
|
||||
"lbryinc": "lbryio/lbryinc#138a053754ec8e3da8e9bf153d32f527c962f25c",
|
||||
"lodash": ">=4.17.11",
|
||||
"merge": ">=1.2.1",
|
||||
"moment": "^2.22.1",
|
||||
|
||||
@@ -6,6 +6,7 @@ import DownloadsPage from 'page/downloads';
|
||||
import DrawerContent from 'component/drawerContent';
|
||||
import FilePage from 'page/file';
|
||||
import FirstRunScreen from 'page/firstRun';
|
||||
import InvitesPage from 'page/invites';
|
||||
import PublishPage from 'page/publish';
|
||||
import PublishesPage from 'page/publishes';
|
||||
import RewardsPage from 'page/rewards';
|
||||
@@ -210,6 +211,12 @@ const drawer = createDrawerNavigator(
|
||||
drawerIcon: ({ tintColor }) => <Icon name="award" size={drawerIconSize} style={{ color: tintColor }} />,
|
||||
},
|
||||
},
|
||||
Invites: {
|
||||
screen: InvitesPage,
|
||||
navigationOptions: {
|
||||
drawerIcon: ({ tintColor }) => <Icon name="user-friends" size={drawerIconSize} style={{ color: tintColor }} />,
|
||||
},
|
||||
},
|
||||
Downloads: {
|
||||
screen: DownloadsPage,
|
||||
navigationOptions: {
|
||||
@@ -530,7 +537,7 @@ class AppWithNavigationState extends React.Component {
|
||||
try {
|
||||
verification = JSON.parse(atob(evt.url.substring(15)));
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
// console.log(error);
|
||||
}
|
||||
|
||||
if (verification.token && verification.recaptcha) {
|
||||
|
||||
@@ -19,11 +19,11 @@ const select = state => ({
|
||||
const perform = dispatch => ({
|
||||
notify: data => dispatch(doToast(data)),
|
||||
createChannel: (name, amount) => dispatch(doCreateChannel(name, amount)),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine(1, 99999, true)),
|
||||
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
perform,
|
||||
)(ChannelSelector);
|
||||
@@ -36,10 +36,14 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { channels: prevChannels = [], channelName } = this.props;
|
||||
const { channels = [] } = nextProps;
|
||||
const { channels: prevChannels = [], channelName: prevChannelName } = this.props;
|
||||
const { channels = [], channelName } = nextProps;
|
||||
|
||||
if (channels && channels.length !== prevChannels.length && channelName !== this.state.currentSelectedValue) {
|
||||
this.setState({ currentSelectedValue: prevChannelName });
|
||||
}
|
||||
|
||||
if (channelName !== prevChannelName) {
|
||||
this.setState({ currentSelectedValue: channelName });
|
||||
}
|
||||
}
|
||||
@@ -189,10 +193,11 @@ export default class ChannelSelector extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
const channel = this.state.addingChannel ? 'new' : this.props.channel;
|
||||
const { balance, enabled, fetchingChannels, channels = [] } = this.props;
|
||||
const pickerItems = [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].concat(
|
||||
channels ? channels.map(ch => ch.name) : [],
|
||||
);
|
||||
const { balance, enabled, fetchingChannels, channels = [], showAnonymous } = this.props;
|
||||
const pickerItems = (showAnonymous
|
||||
? [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL]
|
||||
: [Constants.ITEM_CREATE_A_CHANNEL]
|
||||
).concat(channels ? channels.map(ch => ch.name) : []);
|
||||
|
||||
const {
|
||||
newChannelName,
|
||||
|
||||
@@ -12,11 +12,11 @@ import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import ClaimList from './view';
|
||||
|
||||
const select = state => ({
|
||||
showNsfwContent: selectShowNsfw(state),
|
||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||
lastPageReached: selectClaimSearchByQueryLastPageReached(state),
|
||||
loadingByQuery: selectFetchingClaimSearchByQuery(state),
|
||||
loading: selectFetchingClaimSearch(state),
|
||||
showNsfwContent: selectShowNsfw(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
@@ -25,5 +25,5 @@ const perform = dispatch => ({
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
perform,
|
||||
)(ClaimList);
|
||||
@@ -9,10 +9,10 @@ const select = state => ({
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine(1, 99999, true)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
perform,
|
||||
)(DrawerContent);
|
||||
@@ -22,6 +22,7 @@ const groupedMenuItems = {
|
||||
Wallet: [
|
||||
{ icon: 'wallet', label: 'Wallet', route: Constants.DRAWER_ROUTE_WALLET },
|
||||
{ icon: 'award', label: 'Rewards', route: Constants.DRAWER_ROUTE_REWARDS },
|
||||
{ icon: 'user-friends', label: 'Invites', route: Constants.DRAWER_ROUTE_INVITES },
|
||||
],
|
||||
Settings: [
|
||||
{ icon: 'cog', label: 'Settings', route: Constants.DRAWER_ROUTE_SETTINGS },
|
||||
|
||||
@@ -167,7 +167,7 @@ class MediaPlayer extends React.PureComponent {
|
||||
|
||||
togglePlay = () => {
|
||||
this.showPlayerControls();
|
||||
this.setState({ paused: !this.state.paused }, this.handlePausedState);
|
||||
this.setState({ paused: !this.state.paused }, this.updateBackgroundMediaNotification);
|
||||
};
|
||||
|
||||
handlePausedState = () => {
|
||||
@@ -188,7 +188,7 @@ class MediaPlayer extends React.PureComponent {
|
||||
};
|
||||
|
||||
onEnd = () => {
|
||||
this.setState({ paused: true });
|
||||
this.setState({ paused: true }, this.updateBackgroundMediaNotification);
|
||||
if (this.props.onPlaybackFinished) {
|
||||
this.props.onPlaybackFinished();
|
||||
}
|
||||
@@ -327,6 +327,10 @@ class MediaPlayer extends React.PureComponent {
|
||||
}
|
||||
};
|
||||
|
||||
onFocusChanged = evt => {
|
||||
this.setState({ paused: !(this.state.paused && evt.hasAudioFocus) }, this.updateBackgroundMediaNotification);
|
||||
};
|
||||
|
||||
onBuffer = () => {
|
||||
if (!this.state.paused) {
|
||||
this.setState({ buffering: true }, () => this.manualHidePlayerControls());
|
||||
@@ -469,6 +473,7 @@ class MediaPlayer extends React.PureComponent {
|
||||
onEnd={this.onEnd}
|
||||
onError={this.onError}
|
||||
minLoadRetryCount={999}
|
||||
onAudioFocusChanged={this.onFocusChanged}
|
||||
/>
|
||||
|
||||
{this.state.firstPlay && thumbnail && (
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
selectResolvingUris,
|
||||
selectIsSearching,
|
||||
} from 'lbry-redux';
|
||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||
import RelatedContent from './view';
|
||||
|
||||
const RESULT_SIZE = 16;
|
||||
@@ -16,12 +17,13 @@ const select = (state, props) => ({
|
||||
isSearching: selectIsSearching(state),
|
||||
recommendedContent: makeSelectResolvedRecommendedContentForUri(props.uri, RESULT_SIZE)(state),
|
||||
resolvingUris: selectResolvingUris(state),
|
||||
showNsfwContent: selectShowNsfw(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
resolveUris: uris => dispatch(doResolveUris(uris)),
|
||||
searchRecommended: (query, claimId) =>
|
||||
dispatch(doResolvedSearch(query, RESULT_SIZE, undefined, true, { related_to: claimId }, false)),
|
||||
searchRecommended: (query, claimId, nsfw) =>
|
||||
dispatch(doResolvedSearch(query, RESULT_SIZE, undefined, true, { related_to: claimId }, nsfw)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
|
||||
@@ -10,9 +10,9 @@ import relatedContentStyle from 'styles/relatedContent';
|
||||
|
||||
export default class RelatedContent extends React.PureComponent {
|
||||
componentDidMount() {
|
||||
const { title, claimId, searchRecommended } = this.props;
|
||||
const { title, claimId, searchRecommended, showNsfwContent } = this.props;
|
||||
if (title && claimId) {
|
||||
searchRecommended(title, claimId);
|
||||
searchRecommended(title, claimId, showNsfwContent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectClaimsBalance, selectSupportsBalance, selectTipsBalance } from 'lbry-redux';
|
||||
import WalletBalanceExtra from './view';
|
||||
|
||||
const select = state => ({
|
||||
claimsBalance: selectClaimsBalance(state) || 0,
|
||||
supportsBalance: selectSupportsBalance(state) || 0,
|
||||
tipsBalance: selectTipsBalance(state) || 0,
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
null,
|
||||
)(WalletBalanceExtra);
|
||||
@@ -0,0 +1,54 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { Image, Text, View } from 'react-native';
|
||||
import { Lbry, formatCredits } from 'lbry-redux';
|
||||
import Address from 'component/address';
|
||||
import Button from 'component/button';
|
||||
import Colors from 'styles/colors';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import walletStyle from 'styles/wallet';
|
||||
|
||||
type Props = {
|
||||
claimsBalance: number,
|
||||
supportsBalance: number,
|
||||
tipsBalance: number,
|
||||
};
|
||||
|
||||
class WalletBalanceExtra extends React.PureComponent<Props> {
|
||||
render() {
|
||||
const { claimsBalance, supportsBalance, tipsBalance } = this.props;
|
||||
|
||||
return (
|
||||
<View style={walletStyle.balanceExtraCard}>
|
||||
<View style={walletStyle.walletExtraRow}>
|
||||
<View style={walletStyle.walletExtraCol}>
|
||||
<Icon style={walletStyle.walletExtraIcon} color={Colors.LbryGreen} name={'gift'} size={16} />
|
||||
<Text style={walletStyle.walletExtraCaption}>{__('You also have')}</Text>
|
||||
<View style={walletStyle.balanceRow}>
|
||||
<Text style={walletStyle.walletExtraBalance}>{formatCredits(parseFloat(tipsBalance), 2)}</Text>
|
||||
<Text style={walletStyle.walletExtraCurrency}>LBC</Text>
|
||||
</View>
|
||||
<Text style={walletStyle.text}>{__('in tips')}</Text>
|
||||
</View>
|
||||
|
||||
<View style={walletStyle.walletExtraCol}>
|
||||
<Icon style={walletStyle.walletExtraIcon} color={Colors.LbryGreen} name={'lock'} size={16} />
|
||||
<Text style={walletStyle.walletExtraCaption}>{__('You staked')}</Text>
|
||||
<View style={walletStyle.balanceRow}>
|
||||
<Text style={walletStyle.walletExtraBalance}>{formatCredits(parseFloat(claimsBalance), 2)}</Text>
|
||||
<Text style={walletStyle.walletExtraCurrency}>LBC</Text>
|
||||
</View>
|
||||
<Text style={walletStyle.text}>{__('in your publishes')}</Text>
|
||||
<View style={[walletStyle.balanceRow, walletStyle.walletExtraTopMargin]}>
|
||||
<Text style={walletStyle.walletExtraBalance}>{formatCredits(parseFloat(supportsBalance), 2)}</Text>
|
||||
<Text style={walletStyle.walletExtraCurrency}>LBC</Text>
|
||||
</View>
|
||||
<Text style={walletStyle.text}>{__('in your supports')}</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default WalletBalanceExtra;
|
||||
@@ -92,6 +92,7 @@ const Constants = {
|
||||
DRAWER_ROUTE_TAG: 'Tag',
|
||||
DRAWER_ROUTE_CHANNEL_CREATOR: 'ChannelCreator',
|
||||
DRAWER_ROUTE_CHANNEL_CREATOR_FORM: 'ChannnelCreatorForm',
|
||||
DRAWER_ROUTE_INVITES: 'Invites',
|
||||
|
||||
FULL_ROUTE_NAME_DISCOVER: 'DiscoverStack',
|
||||
FULL_ROUTE_NAME_WALLET: 'WalletStack',
|
||||
@@ -167,6 +168,7 @@ export const DrawerRoutes = [
|
||||
Constants.DRAWER_ROUTE_SEARCH,
|
||||
Constants.DRAWER_ROUTE_TRANSACTION_HISTORY,
|
||||
Constants.DRAWER_ROUTE_CHANNEL_CREATOR,
|
||||
Constants.DRAWER_ROUTE_INVITES,
|
||||
];
|
||||
|
||||
// sub-pages for main routes
|
||||
|
||||
@@ -18,7 +18,7 @@ const select = (state, props) => ({
|
||||
|
||||
const perform = dispatch => ({
|
||||
abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine(1, 99999, true)),
|
||||
fetchSubCount: claimId => dispatch(doFetchSubCount(claimId)),
|
||||
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
||||
setSortByItem: item => dispatch(doSetSortByItem(item)),
|
||||
@@ -27,5 +27,5 @@ const perform = dispatch => ({
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
perform,
|
||||
)(ChannelPage);
|
||||
@@ -42,7 +42,7 @@ const perform = dispatch => ({
|
||||
notify: data => dispatch(doToast(data)),
|
||||
clearChannelFormState: () => dispatch(doClearChannelFormState()),
|
||||
createChannel: (name, amount, optionalParams) => dispatch(doCreateChannel(name, amount, optionalParams)),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine(1, 99999, true)),
|
||||
getSync: (password, callback) => dispatch(doGetSync(password, callback)),
|
||||
updateChannel: params => dispatch(doUpdateChannel(params)),
|
||||
updateChannelFormState: data => dispatch(doUpdateChannelFormState(data)),
|
||||
|
||||
+16
-37
@@ -37,29 +37,6 @@ class DiscoverPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
// Track the total time taken if this is the first launch
|
||||
AsyncStorage.getItem('firstLaunchTime').then(startTime => {
|
||||
if (startTime !== null && !isNaN(parseInt(startTime, 10))) {
|
||||
// We don't need this value anymore once we've retrieved it
|
||||
AsyncStorage.removeItem('firstLaunchTime');
|
||||
|
||||
// We know this is the first app launch because firstLaunchTime is set and it"s a valid number
|
||||
const start = parseInt(startTime, 10);
|
||||
const now = moment().unix();
|
||||
const delta = now - start;
|
||||
AsyncStorage.getItem('firstLaunchSuspended').then(suspended => {
|
||||
AsyncStorage.removeItem('firstLaunchSuspended');
|
||||
const appSuspended = suspended === 'true';
|
||||
if (NativeModules.Firebase) {
|
||||
NativeModules.Firebase.track('first_run_time', {
|
||||
total_seconds: delta,
|
||||
app_suspended: appSuspended,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const { sortByItem, fetchRewardedContent, fileList, followedTags } = this.props;
|
||||
|
||||
this.buildTagCollection(followedTags);
|
||||
@@ -293,25 +270,27 @@ class DiscoverPage extends React.PureComponent {
|
||||
);
|
||||
|
||||
render() {
|
||||
const { navigation, sortByItem, timeItem } = this.props;
|
||||
const { currentRoute, navigation, sortByItem, timeItem } = this.props;
|
||||
const { orderBy, showModalTagSelector, showSortPicker, showTimePicker } = this.state;
|
||||
|
||||
return (
|
||||
<View style={discoverStyle.container}>
|
||||
<UriBar navigation={navigation} belowOverlay={showModalTagSelector} />
|
||||
<SectionList
|
||||
ListHeaderComponent={this.sectionListHeader}
|
||||
ListFooterComponent={this.sectionListFooter}
|
||||
style={discoverStyle.scrollContainer}
|
||||
contentContainerStyle={discoverStyle.scrollPadding}
|
||||
initialNumToRender={4}
|
||||
maxToRenderPerBatch={4}
|
||||
removeClippedSubviews
|
||||
renderItem={this.renderSectionListItem}
|
||||
renderSectionHeader={this.renderSectionHeader}
|
||||
sections={this.buildSections()}
|
||||
keyExtractor={(item, index) => item}
|
||||
/>
|
||||
{currentRoute !== Constants.ROUTE_FILE && currentRoute !== Constants.DRAWER_ROUTE_FILE_VIEW && (
|
||||
<SectionList
|
||||
ListHeaderComponent={this.sectionListHeader}
|
||||
ListFooterComponent={this.sectionListFooter}
|
||||
style={discoverStyle.scrollContainer}
|
||||
contentContainerStyle={discoverStyle.scrollPadding}
|
||||
initialNumToRender={4}
|
||||
maxToRenderPerBatch={4}
|
||||
removeClippedSubviews
|
||||
renderItem={this.renderSectionListItem}
|
||||
renderSectionHeader={this.renderSectionHeader}
|
||||
sections={this.buildSections()}
|
||||
keyExtractor={(item, index) => item}
|
||||
/>
|
||||
)}
|
||||
{!showModalTagSelector && !showSortPicker && !showTimePicker && (
|
||||
<FloatingWalletBalance navigation={navigation} />
|
||||
)}
|
||||
|
||||
@@ -27,7 +27,6 @@ import {
|
||||
selectPurchasedUris,
|
||||
selectFailedPurchaseUris,
|
||||
selectPurchaseUriErrorMessage,
|
||||
selectIsSearching,
|
||||
} from 'lbry-redux';
|
||||
import {
|
||||
doClaimEligiblePurchaseRewards,
|
||||
@@ -70,7 +69,6 @@ const select = (state, props) => {
|
||||
streamingUrl: makeSelectStreamingUrlForUri(contentUri)(state),
|
||||
thumbnail: makeSelectThumbnailForUri(contentUri)(state),
|
||||
title: makeSelectTitleForUri(contentUri)(state),
|
||||
isSearchingRecommendContent: selectIsSearching(state),
|
||||
viewCount: makeSelectViewCountForUri(contentUri)(state),
|
||||
};
|
||||
};
|
||||
@@ -84,7 +82,7 @@ const perform = dispatch => ({
|
||||
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
|
||||
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
|
||||
fetchMyClaims: () => dispatch(doFetchClaimListMine()),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine(1, 99999, true)),
|
||||
fetchViewCount: claimId => dispatch(doFetchViewCount(claimId)),
|
||||
fileGet: (uri, saveFile) => dispatch(doFileGet(uri, saveFile)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
|
||||
+46
-10
@@ -238,10 +238,42 @@ class FilePage extends React.PureComponent {
|
||||
const { fileInfo: prevFileInfo } = this.props;
|
||||
const { fileInfo } = nextProps;
|
||||
|
||||
return (
|
||||
Object.keys(this.difference(nextProps, this.props)).length > 0 ||
|
||||
Object.keys(this.difference(nextState, this.state)).length > 0
|
||||
);
|
||||
const propKeyTriggers = ['balance', 'viewCount', 'isResolvingUri'];
|
||||
const stateKeyTriggers = [
|
||||
'downloadPressed',
|
||||
'fullscreenMode',
|
||||
'mediaLoaded',
|
||||
'playerBgHeighht',
|
||||
'playerHeight',
|
||||
'relatedY',
|
||||
'showTipView',
|
||||
'showImageViewer',
|
||||
'showWebView',
|
||||
'showDescription',
|
||||
'showRecommended',
|
||||
'uri',
|
||||
];
|
||||
for (let i = 0; i < propKeyTriggers.length; i++) {
|
||||
const key = propKeyTriggers[i];
|
||||
if (this.props[key] !== nextProps[key]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < stateKeyTriggers.length; i++) {
|
||||
const key = stateKeyTriggers[i];
|
||||
if (this.state[key] !== nextState[key]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!prevFileInfo && fileInfo) {
|
||||
return true;
|
||||
}
|
||||
if (prevFileInfo && fileInfo && Object.keys(this.difference(fileInfo, prevFileInfo)).length > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
@@ -578,7 +610,7 @@ class FilePage extends React.PureComponent {
|
||||
let timeToStartMillis, timeToStart;
|
||||
if (this.startTime) {
|
||||
timeToStartMillis = Date.now() - this.startTime;
|
||||
timeToStart = Math.ceil(timeToStartMillis / 1000);
|
||||
timeToStart = Math.ceil(timeToStartMillis / 1000.0);
|
||||
this.startTime = null;
|
||||
}
|
||||
|
||||
@@ -588,8 +620,8 @@ class FilePage extends React.PureComponent {
|
||||
|
||||
let payload = { uri: uri };
|
||||
if (!isNaN(timeToStart)) {
|
||||
payload['time_to_start_seconds'] = timeToStart;
|
||||
payload['time_to_start_ms'] = timeToStartMillis;
|
||||
payload['time_to_start_seconds'] = parseInt(timeToStart, 10);
|
||||
payload['time_to_start_ms'] = parseInt(timeToStartMillis, 10);
|
||||
}
|
||||
NativeModules.Firebase.track('play', payload);
|
||||
|
||||
@@ -670,19 +702,24 @@ class FilePage extends React.PureComponent {
|
||||
[
|
||||
{
|
||||
text: __('OK'),
|
||||
onPress: () => purchaseUri(uri, costInfo, download),
|
||||
onPress: () => {
|
||||
this.startTime = Date.now();
|
||||
purchaseUri(uri, costInfo, download);
|
||||
},
|
||||
},
|
||||
{ text: __('Cancel') },
|
||||
],
|
||||
);
|
||||
} else {
|
||||
// Free content. Just call purchaseUri directly.
|
||||
this.startTime = Date.now();
|
||||
purchaseUri(uri, costInfo, download);
|
||||
}
|
||||
};
|
||||
|
||||
onFileDownloadButtonPressed = () => {
|
||||
const { claim, costInfo, contentType, purchaseUri, setPlayerVisible } = this.props;
|
||||
this.startTime = Date.now();
|
||||
const { claim, costInfo, contentType, setPlayerVisible } = this.props;
|
||||
const mediaType = Lbry.getMediaType(contentType);
|
||||
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||
const isViewable = mediaType === 'image' || mediaType === 'text';
|
||||
@@ -697,7 +734,6 @@ class FilePage extends React.PureComponent {
|
||||
}
|
||||
|
||||
if (isPlayable) {
|
||||
this.startTime = Date.now();
|
||||
this.setState({ downloadPressed: true, autoPlayMedia: true, stopDownloadConfirmed: false });
|
||||
}
|
||||
if (isViewable) {
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectMyChannelClaims, selectFetchingMyChannels, doFetchChannelListMine, doToast } from 'lbry-redux';
|
||||
import {
|
||||
selectReferralReward,
|
||||
selectUserInvitesRemaining,
|
||||
selectUserInviteNewIsPending,
|
||||
selectUserInviteNewErrorMessage,
|
||||
selectUserInviteReferralLink,
|
||||
selectUserInviteReferralCode,
|
||||
selectUserInvitees,
|
||||
selectUserInviteStatusIsPending,
|
||||
doFetchInviteStatus,
|
||||
doUserInviteNew,
|
||||
} from 'lbryinc';
|
||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { doUpdateChannelFormState, doClearChannelFormState } from 'redux/actions/form';
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
import { selectChannelFormState, selectHasChannelFormState } from 'redux/selectors/form';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import InvitesPage from './view';
|
||||
|
||||
const select = state => ({
|
||||
channels: selectMyChannelClaims(state),
|
||||
fetchingChannels: selectFetchingMyChannels(state),
|
||||
fetchingInvitees: selectUserInviteStatusIsPending(state),
|
||||
errorMessage: selectUserInviteNewErrorMessage(state),
|
||||
invitesRemaining: selectUserInvitesRemaining(state),
|
||||
referralCode: selectUserInviteReferralCode(state),
|
||||
isPending: selectUserInviteNewIsPending(state),
|
||||
invitees: selectUserInvitees(state),
|
||||
referralReward: selectReferralReward(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine(1, 99999, true)),
|
||||
fetchInviteStatus: () => dispatch(doFetchInviteStatus()),
|
||||
inviteNew: email => dispatch(doUserInviteNew(email)),
|
||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_INVITES)),
|
||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform,
|
||||
)(InvitesPage);
|
||||
@@ -0,0 +1,244 @@
|
||||
import React from 'react';
|
||||
import { Lbry, parseURI } from 'lbry-redux';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Clipboard,
|
||||
NativeModules,
|
||||
ScrollView,
|
||||
Text,
|
||||
TextInput,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import Link from 'component/link';
|
||||
import Button from 'component/button';
|
||||
import ChannelSelector from 'component/channelSelector';
|
||||
import PageHeader from 'component/pageHeader';
|
||||
import RewardCard from 'component/rewardCard';
|
||||
import RewardEnrolment from 'component/rewardEnrolment';
|
||||
import UriBar from 'component/uriBar';
|
||||
import invitesStyle from 'styles/invites';
|
||||
import { fetchReferralCode, logPublish } from 'utils/helper';
|
||||
|
||||
class InvitesPage extends React.PureComponent {
|
||||
state = {
|
||||
channelName: null,
|
||||
email: null,
|
||||
inviteLink: null,
|
||||
selectedChannel: null,
|
||||
};
|
||||
|
||||
componentWillMount() {
|
||||
const { navigation } = this.props;
|
||||
// this.didFocusListener = navigation.addListener('didFocus', this.onComponentFocused);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.didFocusListener) {
|
||||
this.didFocusListener.remove();
|
||||
}
|
||||
}
|
||||
|
||||
onComponentFocused = () => {
|
||||
const { fetchChannelListMine, fetchInviteStatus, pushDrawerStack, navigation, setPlayerVisible, user } = this.props;
|
||||
|
||||
pushDrawerStack();
|
||||
setPlayerVisible();
|
||||
NativeModules.Firebase.setCurrentScreen('Invites').then(result => {
|
||||
fetchReferralCode(
|
||||
response => {
|
||||
if (response && response.length > 0) {
|
||||
// only need to use the first referral code.
|
||||
// inviteLink will be updated after channels are loaded (if the user has created at least one channel)
|
||||
this.setState({ inviteLink: `https://lbry.tv/$/invite/${response[0]}` });
|
||||
}
|
||||
fetchChannelListMine();
|
||||
},
|
||||
error => {
|
||||
fetchChannelListMine();
|
||||
},
|
||||
);
|
||||
fetchInviteStatus();
|
||||
});
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.onComponentFocused();
|
||||
}
|
||||
|
||||
handleChannelChange = channelName => {
|
||||
const { channels = [] } = this.props;
|
||||
if (channels && channels.length > 0) {
|
||||
const filtered = channels.filter(c => c.name === channelName);
|
||||
if (filtered.length > 0) {
|
||||
const channel = filtered[0];
|
||||
logPublish(channel);
|
||||
this.setState({ channelName, inviteLink: this.getLinkForChannel(channel) });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getLinkForChannel = channel => {
|
||||
const parsedUrl = channel.canonical_url ? parseURI(channel.canonical_url) : parseURI(channel.permanent_url);
|
||||
const { claimId, claimName } = parsedUrl;
|
||||
return `https://lbry.tv/$/invite/${claimName}:${claimId}`;
|
||||
};
|
||||
|
||||
handleInviteEmailChange = text => {
|
||||
this.setState({ email: text });
|
||||
};
|
||||
|
||||
handleInvitePress = () => {
|
||||
const { inviteNew, notify } = this.props;
|
||||
const { email } = this.state;
|
||||
if (!email || email.indexOf('@') === -1) {
|
||||
return notify({
|
||||
message: __('Please enter a valid email address to send an invite to.'),
|
||||
isError: true,
|
||||
});
|
||||
}
|
||||
|
||||
inviteNew(email);
|
||||
};
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { isPending: prevPending, notify } = this.props;
|
||||
const { channels = [], isPending, errorMessage } = nextProps;
|
||||
const { email } = this.state;
|
||||
|
||||
if (!this.state.channelName && channels && channels.length > 0) {
|
||||
const firstChannel = channels[0];
|
||||
logPublish(firstChannel);
|
||||
this.setState({ channelName: firstChannel.name, inviteLink: this.getLinkForChannel(firstChannel) });
|
||||
}
|
||||
|
||||
if (prevPending && !isPending) {
|
||||
if (errorMessage && errorMessage.trim().length > 0) {
|
||||
notify({ message: errorMessage, isError: true });
|
||||
} else {
|
||||
notify({ message: __(`${email} was invited to the LBRY party!`) });
|
||||
this.setState({ email: null });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleInviteLinkPress = () => {
|
||||
const { notify } = this.props;
|
||||
Clipboard.setString(this.state.inviteLink);
|
||||
notify({
|
||||
message: __('Invite link copied'),
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const { fetchingInvitees, user, navigation, notify, isPending, invitees } = this.props;
|
||||
const { email, inviteLink } = this.state;
|
||||
const hasInvitees = invitees && invitees.length > 0;
|
||||
|
||||
return (
|
||||
<View style={invitesStyle.container}>
|
||||
<UriBar navigation={navigation} />
|
||||
|
||||
<ScrollView style={invitesStyle.scrollContainer}>
|
||||
<TouchableOpacity style={invitesStyle.rewardDriverCard} onPress={() => navigation.navigate('Rewards')}>
|
||||
<Icon name="award" size={16} style={invitesStyle.rewardDriverIcon} />
|
||||
<Text style={invitesStyle.rewardDriverText}>{__('Earn rewards for inviting your friends.')}</Text>
|
||||
</TouchableOpacity>
|
||||
|
||||
<View style={invitesStyle.card}>
|
||||
<Text style={invitesStyle.title}>{__('Invite Link')}</Text>
|
||||
<Text style={invitesStyle.text}>
|
||||
{__('Share this link with friends (or enemies) and get 20 LBC when they join lbry.tv')}
|
||||
</Text>
|
||||
|
||||
<Text style={invitesStyle.subTitle}>{__('Your invite link')}</Text>
|
||||
<View style={invitesStyle.row}>
|
||||
<Text selectable numberOfLines={1} style={invitesStyle.inviteLink} onPress={this.handleInviteLinkPress}>
|
||||
{this.state.inviteLink}
|
||||
</Text>
|
||||
<Button icon={'clipboard'} style={invitesStyle.button} onPress={this.handleInviteLinkPress} />
|
||||
</View>
|
||||
|
||||
<Text style={invitesStyle.customizeTitle}>{__('Customize invite link')}</Text>
|
||||
<ChannelSelector
|
||||
showAnonymous={false}
|
||||
channelName={this.state.channelName}
|
||||
onChannelChange={this.handleChannelChange}
|
||||
/>
|
||||
</View>
|
||||
|
||||
<View style={invitesStyle.card}>
|
||||
<Text style={invitesStyle.title}>{__('Invite by Email')}</Text>
|
||||
<Text style={invitesStyle.text}>
|
||||
{__('Invite someone you know by email and earn 20 LBC when they join lbry.tv.')}
|
||||
</Text>
|
||||
|
||||
<TextInput
|
||||
style={invitesStyle.emailInput}
|
||||
editable={!isPending}
|
||||
value={this.state.email}
|
||||
onChangeText={this.handleInviteEmailChange}
|
||||
placeholder={__('imaginary@friend.com')}
|
||||
underlineColorAndroid={Colors.NextLbryGreen}
|
||||
/>
|
||||
<View style={invitesStyle.rightRow}>
|
||||
{isPending && (
|
||||
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} style={invitesStyle.loading} />
|
||||
)}
|
||||
<Button
|
||||
disabled={!email || email.indexOf('@') === -1 || isPending}
|
||||
style={invitesStyle.button}
|
||||
text={__('Invite')}
|
||||
onPress={this.handleInvitePress}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View style={[invitesStyle.card, invitesStyle.lastCard]}>
|
||||
<View style={invitesStyle.titleRow}>
|
||||
<Text style={invitesStyle.titleCol}>{__('Invite History')}</Text>
|
||||
{fetchingInvitees && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
|
||||
</View>
|
||||
|
||||
<Text style={invitesStyle.text}>
|
||||
{__(
|
||||
'Earn 20 LBC for inviting a friend, an enemy, a frenemy, or an enefriend. Everyone needs content freedom.',
|
||||
)}
|
||||
</Text>
|
||||
|
||||
<View style={invitesStyle.invitees}>
|
||||
{hasInvitees && (
|
||||
<View style={invitesStyle.inviteesHeader}>
|
||||
<Text style={invitesStyle.emailHeader} numberOfLines={1}>
|
||||
{__('Email')}
|
||||
</Text>
|
||||
<Text style={invitesStyle.rewardHeader} numberOfLines={1}>
|
||||
{__('Reward')}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
{hasInvitees &&
|
||||
invitees.map(invitee => (
|
||||
<View key={invitee.email} style={invitesStyle.inviteeItem}>
|
||||
<Text style={invitesStyle.inviteeEmail} numberOfLines={1}>
|
||||
{invitee.email}
|
||||
</Text>
|
||||
<Text style={invitesStyle.rewardStatus} numberOfLines={1}>
|
||||
{invitee.invite_reward_claimed && __('Claimed')}
|
||||
{!invitee.invite_reward_claimed &&
|
||||
(invitee.invite_reward_claimable ? __('Claimable') : __('Unclaimable'))}
|
||||
</Text>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
</View>
|
||||
</ScrollView>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default InvitesPage;
|
||||
@@ -11,6 +11,10 @@ import RewardEnrolment from 'component/rewardEnrolment';
|
||||
import UriBar from 'component/uriBar';
|
||||
import rewardStyle from 'styles/reward';
|
||||
|
||||
const FILTER_ALL = 'all';
|
||||
const FILTER_AVAILABLE = 'available';
|
||||
const FILTER_CLAIMED = 'claimed';
|
||||
|
||||
class RewardsPage extends React.PureComponent {
|
||||
state = {
|
||||
isEmailVerified: false,
|
||||
@@ -19,6 +23,7 @@ class RewardsPage extends React.PureComponent {
|
||||
verifyRequestStarted: false,
|
||||
revealVerification: true,
|
||||
firstRewardClaimed: false,
|
||||
currentFilter: FILTER_AVAILABLE,
|
||||
};
|
||||
|
||||
scrollView = null;
|
||||
@@ -182,8 +187,13 @@ class RewardsPage extends React.PureComponent {
|
||||
});
|
||||
};
|
||||
|
||||
setFilter = filter => {
|
||||
this.setState({ currentFilter: filter });
|
||||
};
|
||||
|
||||
render() {
|
||||
const { user, navigation } = this.props;
|
||||
const { currentFilter } = this.state;
|
||||
|
||||
return (
|
||||
<View style={rewardStyle.container}>
|
||||
@@ -197,8 +207,29 @@ class RewardsPage extends React.PureComponent {
|
||||
style={rewardStyle.scrollContainer}
|
||||
contentContainerStyle={rewardStyle.scrollContentContainer}
|
||||
>
|
||||
{this.renderUnclaimedRewards()}
|
||||
{this.renderClaimedRewards()}
|
||||
<View style={rewardStyle.filterHeader}>
|
||||
<Link
|
||||
style={[rewardStyle.filterLink, currentFilter === FILTER_ALL ? rewardStyle.activeFilterLink : null]}
|
||||
text={__('All')}
|
||||
onPress={() => this.setFilter(FILTER_ALL)}
|
||||
/>
|
||||
<Link
|
||||
style={[
|
||||
rewardStyle.filterLink,
|
||||
currentFilter === FILTER_AVAILABLE ? rewardStyle.activeFilterLink : null,
|
||||
]}
|
||||
text={__('Available')}
|
||||
onPress={() => this.setFilter(FILTER_AVAILABLE)}
|
||||
/>
|
||||
<Link
|
||||
style={[rewardStyle.filterLink, currentFilter === FILTER_CLAIMED ? rewardStyle.activeFilterLink : null]}
|
||||
text={__('Claimed')}
|
||||
onPress={() => this.setFilter(FILTER_CLAIMED)}
|
||||
/>
|
||||
</View>
|
||||
|
||||
{(currentFilter === FILTER_AVAILABLE || currentFilter === FILTER_ALL) && this.renderUnclaimedRewards()}
|
||||
{(currentFilter === FILTER_CLAIMED || currentFilter === FILTER_ALL) && this.renderClaimedRewards()}
|
||||
</ScrollView>
|
||||
)}
|
||||
</View>
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
} from 'lbry-redux';
|
||||
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { selectCurrentRoute } from 'redux/selectors/drawer';
|
||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import SearchPage from './view';
|
||||
|
||||
@@ -24,6 +25,7 @@ const select = state => ({
|
||||
isSearching: selectIsSearching(state),
|
||||
query: selectSearchValue(state),
|
||||
resolvingUris: selectResolvingUris(state),
|
||||
showNsfwContent: selectShowNsfw(state),
|
||||
uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, Constants.DEFAULT_PAGE_SIZE)(state))(state),
|
||||
results: makeSelectResolvedSearchResults(makeSelectQueryWithOptions(null, Constants.DEFAULT_PAGE_SIZE)(state))(state),
|
||||
lastPageReached: makeSelectResolvedSearchResultsLastPageReached(
|
||||
@@ -32,10 +34,10 @@ const select = state => ({
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
search: (query, from) => dispatch(doResolvedSearch(query, Constants.DEFAULT_PAGE_SIZE, from, false, {})),
|
||||
search: (query, from, nsfw) => dispatch(doResolvedSearch(query, Constants.DEFAULT_PAGE_SIZE, from, false, {}, nsfw)),
|
||||
claimSearch: options => dispatch(doClaimSearch(options)),
|
||||
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)),
|
||||
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
||||
resolveUris: uris => dispatch(doResolveUris(uris)),
|
||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||
});
|
||||
|
||||
+34
-35
@@ -52,9 +52,9 @@ class SearchPage extends React.PureComponent {
|
||||
}
|
||||
|
||||
onComponentFocused = () => {
|
||||
const { pushDrawerStack, setPlayerVisible, query, search } = this.props;
|
||||
pushDrawerStack();
|
||||
const { pushDrawerStack, setPlayerVisible, navigation, query, search, showNsfwContent } = this.props;
|
||||
setPlayerVisible();
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_SEARCH, navigation.state.params ? navigation.state.params : null);
|
||||
NativeModules.Firebase.setCurrentScreen('Search').then(result => {
|
||||
const searchQuery = query || this.getSearchQuery();
|
||||
if (searchQuery && searchQuery.trim().length > 0) {
|
||||
@@ -68,7 +68,7 @@ class SearchPage extends React.PureComponent {
|
||||
resultsResolved: false,
|
||||
tagResultDisplayed: false,
|
||||
});
|
||||
search(searchQuery, 0);
|
||||
search(searchQuery, 0, showNsfwContent);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -79,7 +79,7 @@ class SearchPage extends React.PureComponent {
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { currentRoute, query, isSearching } = nextProps;
|
||||
const { currentRoute: prevRoute, search, isSearching: prevIsSearching } = this.props;
|
||||
const { currentRoute: prevRoute, search, isSearching: prevIsSearching, showNsfwContent } = this.props;
|
||||
|
||||
if (Constants.DRAWER_ROUTE_SEARCH === currentRoute && currentRoute !== prevRoute) {
|
||||
this.onComponentFocused();
|
||||
@@ -93,7 +93,7 @@ class SearchPage extends React.PureComponent {
|
||||
resultsResolved: false,
|
||||
tagResultDisplayed: false,
|
||||
});
|
||||
search(query, 0);
|
||||
search(query, 0, showNsfwContent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ class SearchPage extends React.PureComponent {
|
||||
}
|
||||
|
||||
handleSearchSubmitted = keywords => {
|
||||
const { search } = this.props;
|
||||
const { search, showNsfwContent } = this.props;
|
||||
this.setState({
|
||||
currentUri: isURIValid(keywords) ? normalizeURI(keywords) : null,
|
||||
currentFrom: 0,
|
||||
@@ -147,7 +147,7 @@ class SearchPage extends React.PureComponent {
|
||||
resultsResolved: false,
|
||||
tagResultDisplayed: false,
|
||||
});
|
||||
search(keywords, 0);
|
||||
search(keywords, 0, showNsfwContent);
|
||||
};
|
||||
|
||||
listEmptyComponent = () => {
|
||||
@@ -195,7 +195,7 @@ class SearchPage extends React.PureComponent {
|
||||
|
||||
handleVerticalEndReached = () => {
|
||||
// fetch more results
|
||||
const { lastPageReached, results, search, isSearching } = this.props;
|
||||
const { lastPageReached, results, search, showNsfwContent, isSearching } = this.props;
|
||||
if (lastPageReached || (results && results.length > softLimit)) {
|
||||
return;
|
||||
}
|
||||
@@ -203,7 +203,7 @@ class SearchPage extends React.PureComponent {
|
||||
if (!isSearching) {
|
||||
const from = results ? results.length : 0;
|
||||
this.setState({ currentFrom: from }, () => {
|
||||
search(this.state.currentQuery, from);
|
||||
search(this.state.currentQuery, from, showNsfwContent);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -221,32 +221,31 @@ class SearchPage extends React.PureComponent {
|
||||
</View>
|
||||
)}
|
||||
|
||||
{(!isSearching || this.state.currentFrom > 0) && (
|
||||
<FlatList
|
||||
extraData={this.state}
|
||||
style={searchStyle.scrollContainer}
|
||||
contentContainerStyle={searchStyle.scrollPadding}
|
||||
keyboardShouldPersistTaps={'handled'}
|
||||
data={results}
|
||||
keyExtractor={(item, index) => item.claimId}
|
||||
initialNumToRender={10}
|
||||
maxToRenderPerBatch={20}
|
||||
onEndReached={this.handleVerticalEndReached}
|
||||
onEndReachedThreshold={0.2}
|
||||
removeClippedSubviews
|
||||
ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null}
|
||||
ListHeaderComponent={this.listHeaderComponent(this.state.showTagResult, this.state.currentQuery)}
|
||||
renderItem={({ item }) => (
|
||||
<ClaimResultItem
|
||||
key={item.claimId}
|
||||
uri={item ? normalizeURI(`${item.name}#${item.claimId}`) : null}
|
||||
result={item}
|
||||
style={searchStyle.resultItem}
|
||||
navigation={navigation}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
<FlatList
|
||||
extraData={this.state}
|
||||
style={searchStyle.scrollContainer}
|
||||
contentContainerStyle={searchStyle.scrollPadding}
|
||||
keyboardShouldPersistTaps={'handled'}
|
||||
data={results}
|
||||
keyExtractor={(item, index) => item.claimId}
|
||||
initialNumToRender={10}
|
||||
maxToRenderPerBatch={20}
|
||||
onEndReached={this.handleVerticalEndReached}
|
||||
onEndReachedThreshold={0.2}
|
||||
removeClippedSubviews
|
||||
ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null}
|
||||
ListHeaderComponent={this.listHeaderComponent(this.state.showTagResult, this.state.currentQuery)}
|
||||
renderItem={({ item }) => (
|
||||
<ClaimResultItem
|
||||
key={item.claimId}
|
||||
uri={item ? normalizeURI(`${item.name}#${item.claimId}`) : null}
|
||||
result={item}
|
||||
style={searchStyle.resultItem}
|
||||
navigation={navigation}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
{this.state.currentFrom > 0 && isSearching && (
|
||||
<View style={searchStyle.moreLoading}>
|
||||
<ActivityIndicator size="small" color={Colors.NextLbryGreen} />
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
doUserEmailToVerify,
|
||||
doUserEmailVerify,
|
||||
doUserEmailVerifyFailure,
|
||||
selectAuthenticationIsPending,
|
||||
selectUser,
|
||||
selectEmailToVerify,
|
||||
} from 'lbryinc';
|
||||
@@ -18,6 +19,7 @@ import { selectLastRouteInStack } from 'redux/selectors/drawer';
|
||||
import SplashScreen from './view';
|
||||
|
||||
const select = state => ({
|
||||
authIsPending: selectAuthenticationIsPending(state),
|
||||
user: selectUser(state),
|
||||
emailToVerify: selectEmailToVerify(state),
|
||||
lastRouteInStack: selectLastRouteInStack(state),
|
||||
|
||||
+10
-6
@@ -67,6 +67,9 @@ class SplashScreen extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// splash screen is done at this point, next page to be displayed will be user-interactable
|
||||
NativeModules.Firebase.logLaunchTiming();
|
||||
};
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@@ -139,12 +142,13 @@ class SplashScreen extends React.PureComponent {
|
||||
this.navigateToMain();
|
||||
} else {
|
||||
NativeModules.VersionInfo.getAppVersion().then(appVersion => {
|
||||
this.setState({ shouldAuthenticate: true });
|
||||
NativeModules.Firebase.getMessagingToken()
|
||||
.then(firebaseToken => {
|
||||
authenticate(appVersion, Platform.OS, firebaseToken);
|
||||
})
|
||||
.catch(() => authenticate(appVersion, Platform.OS));
|
||||
this.setState({ shouldAuthenticate: true }, () => {
|
||||
NativeModules.Firebase.getMessagingToken()
|
||||
.then(firebaseToken => {
|
||||
authenticate(appVersion, Platform.OS, firebaseToken);
|
||||
})
|
||||
.catch(() => authenticate(appVersion, Platform.OS));
|
||||
});
|
||||
});
|
||||
}
|
||||
// });
|
||||
|
||||
@@ -3,6 +3,7 @@ import { NativeModules, ScrollView, Text, View } from 'react-native';
|
||||
import TransactionListRecent from 'component/transactionListRecent';
|
||||
import WalletAddress from 'component/walletAddress';
|
||||
import WalletBalance from 'component/walletBalance';
|
||||
import WalletBalanceExtra from 'component/walletBalanceExtra';
|
||||
import WalletSend from 'component/walletSend';
|
||||
import WalletRewardsDriver from 'component/walletRewardsDriver';
|
||||
import WalletSignIn from 'component/walletSignIn';
|
||||
@@ -90,6 +91,7 @@ class WalletPage extends React.PureComponent {
|
||||
>
|
||||
{!rewardsNotInterested && (!balance || balance === 0) && <WalletRewardsDriver navigation={navigation} />}
|
||||
<WalletBalance />
|
||||
<WalletBalanceExtra />
|
||||
<WalletAddress />
|
||||
<WalletSend />
|
||||
<TransactionListRecent navigation={navigation} />
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
|
||||
export const doPushDrawerStack = (routeName, params) => dispatch =>
|
||||
export const doPushDrawerStack = (routeName, params) => dispatch => {
|
||||
dispatch({
|
||||
type: Constants.ACTION_PUSH_DRAWER_STACK,
|
||||
data: { routeName, params },
|
||||
});
|
||||
|
||||
export const doPopDrawerStack = () => dispatch =>
|
||||
if (window.persistor) {
|
||||
window.persistor.flush();
|
||||
}
|
||||
};
|
||||
|
||||
export const doPopDrawerStack = () => dispatch => {
|
||||
dispatch({
|
||||
type: Constants.ACTION_POP_DRAWER_STACK,
|
||||
});
|
||||
|
||||
if (window.persistor) {
|
||||
window.persistor.flush();
|
||||
}
|
||||
};
|
||||
|
||||
export const doSetPlayerVisible = (visible, uri) => dispatch =>
|
||||
dispatch({
|
||||
type: Constants.ACTION_SET_PLAYER_VISIBLE,
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
import { StyleSheet } from 'react-native';
|
||||
import Colors from './colors';
|
||||
|
||||
const walletStyle = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: Colors.PageBackground,
|
||||
},
|
||||
scrollContainer: {
|
||||
marginTop: 60,
|
||||
},
|
||||
row: {
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
},
|
||||
button: {
|
||||
backgroundColor: Colors.LbryGreen,
|
||||
alignSelf: 'flex-start',
|
||||
},
|
||||
card: {
|
||||
backgroundColor: Colors.White,
|
||||
marginTop: 16,
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
padding: 16,
|
||||
},
|
||||
title: {
|
||||
fontFamily: 'Inter-SemiBold',
|
||||
fontSize: 20,
|
||||
marginBottom: 8,
|
||||
},
|
||||
titleRow: {
|
||||
alignItems: 'center',
|
||||
flexDirection: 'row',
|
||||
marginBottom: 8,
|
||||
justifyContent: 'space-between',
|
||||
},
|
||||
titleCol: {
|
||||
fontFamily: 'Inter-SemiBold',
|
||||
fontSize: 20,
|
||||
},
|
||||
text: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
fontSize: 14,
|
||||
},
|
||||
link: {
|
||||
color: Colors.LbryGreen,
|
||||
fontFamily: 'Inter-Regular',
|
||||
fontSize: 14,
|
||||
},
|
||||
smallText: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
fontSize: 12,
|
||||
},
|
||||
rewardDriverCard: {
|
||||
alignItems: 'center',
|
||||
backgroundColor: Colors.RewardDriverBlue,
|
||||
flexDirection: 'row',
|
||||
padding: 16,
|
||||
marginLeft: 16,
|
||||
marginTop: 16,
|
||||
marginRight: 16,
|
||||
},
|
||||
rewardDriverIcon: {
|
||||
color: Colors.White,
|
||||
marginRight: 8,
|
||||
},
|
||||
rewardDriverText: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
color: Colors.White,
|
||||
fontSize: 14,
|
||||
},
|
||||
subTitle: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
fontSize: 14,
|
||||
marginTop: 12,
|
||||
marginBottom: 4,
|
||||
},
|
||||
customizeTitle: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
fontSize: 14,
|
||||
marginTop: 12,
|
||||
},
|
||||
inviteLink: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
borderWidth: 1,
|
||||
borderRadius: 16,
|
||||
borderStyle: 'dashed',
|
||||
borderColor: '#e1e1e1',
|
||||
backgroundColor: '#f9f9f9',
|
||||
paddingTop: 8,
|
||||
paddingLeft: 8,
|
||||
paddingRight: 8,
|
||||
paddingBottom: 6,
|
||||
width: '88%',
|
||||
},
|
||||
emailInput: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
fontSize: 14,
|
||||
},
|
||||
rightRow: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-end',
|
||||
},
|
||||
loading: {
|
||||
marginRight: 8,
|
||||
},
|
||||
lastCard: {
|
||||
marginBottom: 16,
|
||||
},
|
||||
invitees: {
|
||||
marginTop: 8,
|
||||
},
|
||||
inviteesHeader: {
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
marginBottom: 8,
|
||||
},
|
||||
emailHeader: {
|
||||
fontFamily: 'Inter-SemiBold',
|
||||
fontSize: 14,
|
||||
width: '65%',
|
||||
},
|
||||
rewardHeader: {
|
||||
fontFamily: 'Inter-SemiBold',
|
||||
fontSize: 14,
|
||||
width: '35%',
|
||||
},
|
||||
inviteeItem: {
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
marginBottom: 8,
|
||||
},
|
||||
inviteeEmail: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
fontSize: 12,
|
||||
width: '65%',
|
||||
},
|
||||
rewardStatus: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
fontSize: 12,
|
||||
width: '35%',
|
||||
},
|
||||
});
|
||||
|
||||
export default walletStyle;
|
||||
@@ -305,6 +305,23 @@ const rewardStyle = StyleSheet.create({
|
||||
fontSize: 12,
|
||||
lineHeight: 16,
|
||||
},
|
||||
filterHeader: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
marginTop: 16,
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
padding: 16,
|
||||
backgroundColor: Colors.White,
|
||||
},
|
||||
filterLink: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
fontSize: 14,
|
||||
marginRight: 24,
|
||||
},
|
||||
activeFilterLink: {
|
||||
fontFamily: 'Inter-SemiBold',
|
||||
},
|
||||
});
|
||||
|
||||
export default rewardStyle;
|
||||
@@ -103,6 +103,12 @@ const walletStyle = StyleSheet.create({
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
},
|
||||
balanceExtraCard: {
|
||||
backgroundColor: Colors.White,
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
padding: 16,
|
||||
},
|
||||
balanceBackground: {
|
||||
position: 'absolute',
|
||||
alignSelf: 'stretch',
|
||||
@@ -191,6 +197,7 @@ const walletStyle = StyleSheet.create({
|
||||
paddingRight: 18,
|
||||
},
|
||||
currency: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
alignSelf: 'flex-start',
|
||||
fontSize: 12,
|
||||
marginTop: 16,
|
||||
@@ -366,6 +373,39 @@ const walletStyle = StyleSheet.create({
|
||||
fontFamily: 'Inter-Regular',
|
||||
fontSize: 28,
|
||||
},
|
||||
walletExtraRow: {
|
||||
flexDirection: 'row',
|
||||
},
|
||||
walletExtraCol: {
|
||||
flex: 0.5,
|
||||
paddingLeft: 24,
|
||||
},
|
||||
walletExtraBalance: {
|
||||
fontFamily: 'Inter-SemiBold',
|
||||
fontSize: 28,
|
||||
},
|
||||
balanceRow: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
},
|
||||
walletExtraCaption: {
|
||||
fontFamily: 'Inter-Medium',
|
||||
fontSize: 14,
|
||||
},
|
||||
walletExtraCurrency: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
fontSize: 12,
|
||||
marginTop: 8,
|
||||
marginLeft: 4,
|
||||
},
|
||||
walletExtraTopMargin: {
|
||||
marginTop: 16,
|
||||
},
|
||||
walletExtraIcon: {
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
top: 0,
|
||||
},
|
||||
});
|
||||
|
||||
export default walletStyle;
|
||||
@@ -10,6 +10,8 @@ const specialRouteMap = {
|
||||
about: Constants.DRAWER_ROUTE_ABOUT,
|
||||
allContent: Constants.DRAWER_ROUTE_TRENDING,
|
||||
channels: Constants.DRAWER_ROUTE_CHANNEL_CREATOR,
|
||||
invite: Constants.DRAWER_ROUTE_INVITES,
|
||||
invites: Constants.DRAWER_ROUTE_INVITES,
|
||||
library: Constants.DRAWER_ROUTE_MY_LBRY,
|
||||
publish: Constants.DRAWER_ROUTE_PUBLISH,
|
||||
publishes: Constants.DRAWER_ROUTE_PUBLISHES,
|
||||
@@ -408,3 +410,17 @@ export function formatTitle(title) {
|
||||
|
||||
return title.length > 80 ? title.substring(0, 77).trim() + '...' : title;
|
||||
}
|
||||
|
||||
export function fetchReferralCode(successCallback, errorCallback) {
|
||||
Lbryio.call('user_referral_code', 'list')
|
||||
.then(response => {
|
||||
if (successCallback) {
|
||||
successCallback(response);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
if (errorCallback) {
|
||||
errorCallback(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user