Compare commits
26
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e57931d353 | ||
|
|
24f9fa1667 | ||
|
|
647d7e6a93 | ||
|
|
dbaaf66bb0 | ||
|
|
1f649b9d38 | ||
|
|
55b292ab0e | ||
|
|
736de8e5d9 | ||
|
|
f06252d397 | ||
|
|
fa25789855 | ||
|
|
514e077fbb | ||
|
|
3d44bfa88b | ||
|
|
f81e2d7441 | ||
|
|
81bdd37576 | ||
|
|
76938d3349 | ||
|
|
456c787683 | ||
|
|
3a5edc461a | ||
|
|
3a8af2d7a0 | ||
|
|
601c589f69 | ||
|
|
f5ae1f34f7 | ||
|
|
4656be64a7 | ||
|
|
8e377d0e74 | ||
|
|
bf7f836465 | ||
|
|
017787ef25 | ||
|
|
d9ada93ff3 | ||
|
|
95a33b411b | ||
|
|
9bc5a2ecac |
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#5c874e921769093428966fa7ecdf723719cb9067",
|
||||
"from": "github:lbryio/lbry-redux#5c874e921769093428966fa7ecdf723719cb9067",
|
||||
"requires": {
|
||||
"proxy-polyfill": "0.1.6",
|
||||
"reselect": "^3.0.0",
|
||||
@@ -7076,8 +7076,8 @@
|
||||
}
|
||||
},
|
||||
"lbryinc": {
|
||||
"version": "github:lbryio/lbryinc#138a053754ec8e3da8e9bf153d32f527c962f25c",
|
||||
"from": "github:lbryio/lbryinc#138a053754ec8e3da8e9bf153d32f527c962f25c",
|
||||
"version": "github:lbryio/lbryinc#0dc8829a319a708f45a855765f70a193ccb72676",
|
||||
"from": "github:lbryio/lbryinc#0dc8829a319a708f45a855765f70a193ccb72676",
|
||||
"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#138a053754ec8e3da8e9bf153d32f527c962f25c",
|
||||
"lbry-redux": "lbryio/lbry-redux#5c874e921769093428966fa7ecdf723719cb9067",
|
||||
"lbryinc": "lbryio/lbryinc#0dc8829a319a708f45a855765f70a193ccb72676",
|
||||
"lodash": ">=4.17.11",
|
||||
"merge": ">=1.2.1",
|
||||
"moment": "^2.22.1",
|
||||
|
||||
@@ -88,12 +88,13 @@ const menuNavigationButton = navigation => (
|
||||
|
||||
const discoverStack = createStackNavigator(
|
||||
{
|
||||
Discover: {
|
||||
screen: DiscoverPage,
|
||||
navigationOptions: ({ navigation }) => ({
|
||||
title: 'Explore',
|
||||
Subscriptions: {
|
||||
screen: SubscriptionsPage,
|
||||
navigationOptions: {
|
||||
title: 'Following',
|
||||
header: null,
|
||||
}),
|
||||
drawerIcon: ({ tintColor }) => <Icon name="heart" solid size={drawerIconSize} style={{ color: tintColor }} />,
|
||||
},
|
||||
},
|
||||
File: {
|
||||
screen: FilePage,
|
||||
@@ -160,10 +161,17 @@ const drawer = createDrawerNavigator(
|
||||
DiscoverStack: {
|
||||
screen: discoverStack,
|
||||
navigationOptions: {
|
||||
title: 'Explore',
|
||||
title: 'Following',
|
||||
drawerIcon: ({ tintColor }) => <Icon name="home" size={drawerIconSize} style={{ color: tintColor }} />,
|
||||
},
|
||||
},
|
||||
Discover: {
|
||||
screen: DiscoverPage,
|
||||
navigationOptions: ({ navigation }) => ({
|
||||
title: 'Your Tags',
|
||||
header: null,
|
||||
}),
|
||||
},
|
||||
Trending: {
|
||||
screen: TrendingPage,
|
||||
navigationOptions: {
|
||||
@@ -171,13 +179,6 @@ const drawer = createDrawerNavigator(
|
||||
drawerIcon: ({ tintColor }) => <Icon name="fire" size={drawerIconSize} style={{ color: tintColor }} />,
|
||||
},
|
||||
},
|
||||
Subscriptions: {
|
||||
screen: SubscriptionsPage,
|
||||
navigationOptions: {
|
||||
title: 'Subscriptions',
|
||||
drawerIcon: ({ tintColor }) => <Icon name="heart" solid size={drawerIconSize} style={{ color: tintColor }} />,
|
||||
},
|
||||
},
|
||||
WalletStack: {
|
||||
screen: walletStack,
|
||||
navigationOptions: {
|
||||
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -9,8 +9,8 @@ import discoverStyle from 'styles/discover';
|
||||
|
||||
const groupedMenuItems = {
|
||||
'Find content': [
|
||||
{ icon: 'hashtag', label: 'Your Tags', route: Constants.DRAWER_ROUTE_DISCOVER },
|
||||
{ icon: 'heart', solid: true, label: 'Following', route: Constants.DRAWER_ROUTE_SUBSCRIPTIONS },
|
||||
{ icon: 'hashtag', label: 'Your Tags', route: Constants.DRAWER_ROUTE_DISCOVER },
|
||||
{ icon: 'globe-americas', label: 'All Content', route: Constants.DRAWER_ROUTE_TRENDING },
|
||||
],
|
||||
'Your content': [
|
||||
@@ -145,7 +145,7 @@ class DrawerContent extends React.PureComponent {
|
||||
const focused =
|
||||
activeItemKey === item.route ||
|
||||
(activeItemKey === Constants.FULL_ROUTE_NAME_DISCOVER &&
|
||||
item.route === Constants.DRAWER_ROUTE_DISCOVER) ||
|
||||
item.route === Constants.DRAWER_ROUTE_SUBSCRIPTIONS) ||
|
||||
(activeItemKey === Constants.FULL_ROUTE_NAME_WALLET &&
|
||||
item.route === Constants.DRAWER_ROUTE_WALLET);
|
||||
return (
|
||||
|
||||
@@ -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 && (
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { selectFetchingClaimSearch } from 'lbry-redux';
|
||||
import ModalSuggestedSubscriptions from './view';
|
||||
|
||||
export default connect()(ModalSuggestedSubscriptions);
|
||||
const select = state => ({
|
||||
loadingSuggested: selectFetchingClaimSearch(state),
|
||||
});
|
||||
|
||||
export default connect(select)(ModalSuggestedSubscriptions);
|
||||
@@ -1,23 +1,26 @@
|
||||
import React from 'react';
|
||||
import { ScrollView, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { ActivityIndicator, 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 SuggestedSubscriptionsGrid from 'component/suggestedSubscriptionsGrid';
|
||||
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;
|
||||
const { loadingSuggested, 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} />
|
||||
<SuggestedSubscriptionsGrid inModal navigation={navigation} />
|
||||
<View style={modalStyle.wideButtons}>
|
||||
<Button style={modalStyle.wideDoneButton} text={__('Done')} onPress={onDonePress} />
|
||||
{loadingSuggested && (
|
||||
<ActivityIndicator size="small" color={Colors.White} style={subscriptionsStyle.modalLoading} />
|
||||
)}
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -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,18 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doChannelSubscribe, doChannelUnsubscribe, selectSubscriptions, makeSelectIsSubscribed } from 'lbryinc';
|
||||
import { doToast } from 'lbry-redux';
|
||||
import SubscribeButtonOverlay from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
subscriptions: selectSubscriptions(state),
|
||||
isSubscribed: makeSelectIsSubscribed(props.uri, true)(state),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
{
|
||||
doChannelSubscribe,
|
||||
doChannelUnsubscribe,
|
||||
doToast,
|
||||
},
|
||||
)(SubscribeButtonOverlay);
|
||||
@@ -0,0 +1,36 @@
|
||||
import React from 'react';
|
||||
import { normalizeURI, parseURI } from 'lbry-redux';
|
||||
import { NativeModules, Text, View, TouchableOpacity } from 'react-native';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import Button from 'component/button';
|
||||
import Colors from 'styles/colors';
|
||||
|
||||
class SubscribeButtonOverlay extends React.PureComponent {
|
||||
handlePress = () => {
|
||||
const { claim, isSubscribed, doChannelSubscribe, doChannelUnsubscribe, uri } = this.props;
|
||||
if (!claim) {
|
||||
return;
|
||||
}
|
||||
|
||||
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
||||
const { name: claimName } = claim;
|
||||
subscriptionHandler({
|
||||
channelName: claimName,
|
||||
uri: normalizeURI(uri),
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const { uri, isSubscribed, style } = this.props;
|
||||
let styles = style.length ? style : [style];
|
||||
|
||||
return (
|
||||
<TouchableOpacity style={styles} opacity={0.7} onPress={this.handlePress}>
|
||||
{isSubscribed && <Icon name={'heart'} size={20} solid color={Colors.Red} />}
|
||||
{!isSubscribed && <Icon name={'heart'} size={20} color={Colors.Red} />}
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default SubscribeButtonOverlay;
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
makeSelectTitleForUri,
|
||||
makeSelectIsUriResolving,
|
||||
} from 'lbry-redux';
|
||||
import { doChannelSubscribe, doChannelUnsubscribe, makeSelectIsSubscribed } from 'lbryinc';
|
||||
import SuggestedSubscriptionItem from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
@@ -13,13 +14,16 @@ const select = (state, props) => ({
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
isResolvingUri: makeSelectIsUriResolving(props.uri)(state),
|
||||
isSubscribed: makeSelectIsSubscribed(props.uri, true)(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||
subscribe: subscription => doChannelSubscribe(subscription),
|
||||
unsubscribe: subscription => doChannelUnsubscribe(subscription),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
perform,
|
||||
)(SuggestedSubscriptionItem);
|
||||
@@ -1,13 +1,13 @@
|
||||
import React from 'react';
|
||||
import { buildURI, normalizeURI } from 'lbry-redux';
|
||||
import { ActivityIndicator, FlatList, Image, Text, View } from 'react-native';
|
||||
import { ActivityIndicator, FlatList, Image, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { navigateToUri } from 'utils/helper';
|
||||
import Colors from 'styles/colors';
|
||||
import ChannelIconItem from 'component/channelIconItem';
|
||||
import channelIconStyle from 'styles/channelIcon';
|
||||
import discoverStyle from 'styles/discover';
|
||||
import FileItem from 'component/fileItem';
|
||||
import SubscribeButton from 'component/subscribeButton';
|
||||
import SubscribeButtonOverlay from 'component/subscribeButtonOverlay';
|
||||
import subscriptionsStyle from 'styles/subscriptions';
|
||||
import Link from 'component/link';
|
||||
import Tag from 'component/tag';
|
||||
@@ -31,6 +31,7 @@ class SuggestedSubscriptionItem extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
const { claim, isResolvingUri, navigation, thumbnail, title, uri } = this.props;
|
||||
|
||||
let shortUrl, tags;
|
||||
if (claim) {
|
||||
shortUrl = claim.short_url;
|
||||
@@ -49,7 +50,7 @@ class SuggestedSubscriptionItem extends React.PureComponent {
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={subscriptionsStyle.suggestedItem}>
|
||||
<TouchableOpacity style={subscriptionsStyle.suggestedItem}>
|
||||
<View style={[subscriptionsStyle.suggestedItemThumbnailContainer, this.state.autoStyle]}>
|
||||
{hasThumbnail && (
|
||||
<Image style={subscriptionsStyle.suggestedItemThumbnail} resizeMode={'cover'} source={{ uri: thumbnail }} />
|
||||
@@ -62,35 +63,37 @@ class SuggestedSubscriptionItem extends React.PureComponent {
|
||||
</View>
|
||||
|
||||
<View style={subscriptionsStyle.suggestedItemDetails}>
|
||||
{title && (
|
||||
<Text style={subscriptionsStyle.suggestedItemTitle} numberOfLines={1}>
|
||||
{title}
|
||||
</Text>
|
||||
)}
|
||||
{claim && (
|
||||
<Link
|
||||
style={subscriptionsStyle.suggestedItemName}
|
||||
numberOfLines={1}
|
||||
text={claim.name}
|
||||
onPress={() => navigateToUri(navigation, normalizeURI(shortUrl || uri), null, false, claim.permanent_url)}
|
||||
/>
|
||||
)}
|
||||
<Text style={subscriptionsStyle.suggestedItemTitle} numberOfLines={2}>
|
||||
{title || claim.name}
|
||||
</Text>
|
||||
{tags && (
|
||||
<View style={subscriptionsStyle.suggestedItemTagList}>
|
||||
{tags &&
|
||||
tags
|
||||
.slice(0, 3)
|
||||
.slice(0, 1)
|
||||
.map(tag => (
|
||||
<Tag style={subscriptionsStyle.tag} key={tag} name={tag} navigation={navigation} truncate />
|
||||
<Tag
|
||||
numberOfLines={1}
|
||||
onPress={this.handleItemPress}
|
||||
style={subscriptionsStyle.tag}
|
||||
key={tag}
|
||||
name={tag}
|
||||
navigation={navigation}
|
||||
truncate
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
{claim && (
|
||||
<SubscribeButton style={subscriptionsStyle.suggestedItemSubscribe} uri={normalizeURI(claim.permanent_url)} />
|
||||
<SubscribeButtonOverlay
|
||||
claim={claim}
|
||||
style={subscriptionsStyle.suggestedItemSubscribeOverlay}
|
||||
uri={normalizeURI(claim.permanent_url)}
|
||||
/>
|
||||
)}
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doClaimSearch,
|
||||
selectFetchingClaimSearch,
|
||||
selectClaimSearchByQuery,
|
||||
selectClaimSearchByQueryLastPageReached,
|
||||
selectFollowedTags,
|
||||
} from 'lbry-redux';
|
||||
import { selectSubscriptions, selectSuggestedChannels, selectIsFetchingSuggested } from 'lbryinc';
|
||||
import { selectShowNsfw } from 'redux/selectors/settings';
|
||||
import SuggestedSubscriptionsGrid from './view';
|
||||
|
||||
const select = state => ({
|
||||
followedTags: selectFollowedTags(state),
|
||||
subscriptions: selectSubscriptions(state),
|
||||
suggested: selectSuggestedChannels(state),
|
||||
loading: selectIsFetchingSuggested(state) || selectFetchingClaimSearch(state),
|
||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||
lastPageReached: selectClaimSearchByQueryLastPageReached(state),
|
||||
showNsfwContent: selectShowNsfw(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
claimSearch: options => dispatch(doClaimSearch(options)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform,
|
||||
)(SuggestedSubscriptionsGrid);
|
||||
@@ -0,0 +1,100 @@
|
||||
import React from 'react';
|
||||
import { ActivityIndicator, SectionList, Text, View } from 'react-native';
|
||||
import { MATURE_TAGS, createNormalizedClaimSearchKey, normalizeURI } from 'lbry-redux';
|
||||
import { navigateToUri } from 'utils/helper';
|
||||
import { FlatGrid } from 'react-native-super-grid';
|
||||
import SubscribeButton from 'component/subscribeButton';
|
||||
import SuggestedSubscriptionItem from 'component/suggestedSubscriptionItem';
|
||||
import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import discoverStyle from 'styles/discover';
|
||||
import subscriptionsStyle from 'styles/subscriptions';
|
||||
import Link from 'component/link';
|
||||
import _ from 'lodash';
|
||||
|
||||
const suggestedPageSize = 24;
|
||||
const softLimit = 2400;
|
||||
class SuggestedSubscriptionsGrid extends React.PureComponent {
|
||||
state = {
|
||||
currentPage: 1,
|
||||
options: {},
|
||||
};
|
||||
|
||||
buildClaimSearchOptions() {
|
||||
const { showNsfwContent, subscriptions } = this.props;
|
||||
const { currentPage } = this.state;
|
||||
|
||||
const options = {
|
||||
no_totals: true,
|
||||
page: currentPage,
|
||||
page_size: suggestedPageSize,
|
||||
claim_type: 'channel',
|
||||
order_by: [Constants.ORDER_BY_EFFECTIVE_AMOUNT],
|
||||
};
|
||||
if (!showNsfwContent) {
|
||||
options.not_tags = MATURE_TAGS;
|
||||
}
|
||||
/* if (subscriptions && subscriptions.length > 0) {
|
||||
options.not_channel_ids = subscriptions.map(subscription => subscription.uri.split('#')[1]);
|
||||
} */
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
doClaimSearch() {
|
||||
const { claimSearch } = this.props;
|
||||
const options = this.buildClaimSearchOptions();
|
||||
claimSearch(options);
|
||||
}
|
||||
|
||||
handleVerticalEndReached = () => {
|
||||
// fetch more content
|
||||
const { claimSearchByQuery, lastPageReached } = this.props;
|
||||
|
||||
const options = this.buildClaimSearchOptions();
|
||||
const claimSearchKey = createNormalizedClaimSearchKey(options);
|
||||
const uris = claimSearchByQuery[claimSearchKey];
|
||||
if (
|
||||
lastPageReached[claimSearchKey] ||
|
||||
((uris.length > 0 && uris.length < suggestedPageSize) || uris.length >= softLimit)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({ currentPage: this.state.currentPage + 1 }, () => this.doClaimSearch());
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
const { claimSearch, followedTags, showNsfwContent } = this.props;
|
||||
this.doClaimSearch();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { claimSearchByQuery, suggested, inModal, navigation } = this.props;
|
||||
const options = this.buildClaimSearchOptions();
|
||||
const claimSearchKey = createNormalizedClaimSearchKey(options);
|
||||
const claimSearchUris = claimSearchByQuery[claimSearchKey];
|
||||
|
||||
return (
|
||||
<FlatGrid
|
||||
initialNumToRender={24}
|
||||
maxToRenderPerBatch={48}
|
||||
removeClippedSubviews
|
||||
itemDimension={120}
|
||||
spacing={2}
|
||||
items={claimSearchUris}
|
||||
style={inModal ? subscriptionsStyle.modalScrollContainer : subscriptionsStyle.scrollContainer}
|
||||
contentContainerStyle={
|
||||
inModal ? subscriptionsStyle.modalSuggestedScrollContent : subscriptionsStyle.suggestedScrollContent
|
||||
}
|
||||
renderItem={({ item, index }) => (
|
||||
<SuggestedSubscriptionItem key={item} uri={normalizeURI(item)} navigation={navigation} />
|
||||
)}
|
||||
onEndReached={this.handleVerticalEndReached}
|
||||
onEndReachedThreshold={0.2}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default SuggestedSubscriptionsGrid;
|
||||
@@ -30,7 +30,7 @@ export default class Tag extends React.PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { name, onPress, style, type, truncate } = this.props;
|
||||
const { name, numberOfLines, onPress, style, type, truncate } = this.props;
|
||||
|
||||
let styles = [];
|
||||
if (style) {
|
||||
@@ -50,7 +50,9 @@ export default class Tag extends React.PureComponent {
|
||||
return (
|
||||
<TouchableOpacity style={styles} onPress={onPress || this.onPressDefault}>
|
||||
<View style={tagStyle.content}>
|
||||
<Text style={tagStyle.text}>{truncate ? formatTagName(name) : name}</Text>
|
||||
<Text style={tagStyle.text} numberOfLines={numberOfLines}>
|
||||
{truncate ? formatTagName(name) : name}
|
||||
</Text>
|
||||
{type && <Icon style={tagStyle.icon} name={type === 'add' ? 'plus' : 'times'} size={8} />}
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -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;
|
||||
@@ -64,6 +64,8 @@ const Constants = {
|
||||
ACTION_CLEAR_PUBLISH_FORM_STATE: 'CLEAR_PUBLISH_FORM_STATE',
|
||||
ACTION_CLEAR_CHANNEL_FORM_STATE: 'CLEAR_CHANNEL_FORM_STATE',
|
||||
|
||||
ACTION_SET_EXPLICIT_NAVIGATE_BACK: 'SET_EXPLICIT_NAVIGATE_BACK',
|
||||
|
||||
ACTION_FULLSCREEN_MODE_TOGGLED: 'FULLSCREEN_MODE_TOGGLED',
|
||||
|
||||
ORIENTATION_HORIZONTAL: 'horizontal',
|
||||
|
||||
@@ -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);
|
||||
@@ -173,9 +173,10 @@ class ChannelPage extends React.PureComponent {
|
||||
const { permanent_url: permanentUrl } = claim;
|
||||
navigation.navigate({
|
||||
routeName: Constants.DRAWER_ROUTE_CHANNEL_CREATOR,
|
||||
params: { editChannelUrl: permanentUrl },
|
||||
params: { editChannelUrl: permanentUrl, returnUrl: permanentUrl },
|
||||
});
|
||||
}
|
||||
this.onEditPressed = null;
|
||||
};
|
||||
|
||||
onTipPressed = () => {
|
||||
@@ -210,7 +211,7 @@ class ChannelPage extends React.PureComponent {
|
||||
},
|
||||
},
|
||||
],
|
||||
{ cancelable: true }
|
||||
{ cancelable: true },
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,7 +13,12 @@ import {
|
||||
doToast,
|
||||
} from 'lbry-redux';
|
||||
import { doGetSync } from 'lbryinc';
|
||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import {
|
||||
doPushDrawerStack,
|
||||
doPopDrawerStack,
|
||||
doSetPlayerVisible,
|
||||
doSetExplicitNavigateBack,
|
||||
} from 'redux/actions/drawer';
|
||||
import { doUpdateChannelFormState, doClearChannelFormState } from 'redux/actions/form';
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
import { selectChannelFormState, selectHasChannelFormState } from 'redux/selectors/form';
|
||||
@@ -37,16 +42,17 @@ 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)),
|
||||
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
||||
popDrawerStack: () => dispatch(doPopDrawerStack()),
|
||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||
setExplicitNavigateBack: flag => dispatch(doSetExplicitNavigateBack(flag)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
perform,
|
||||
)(ChannelCreator);
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||
import { navigateBack, navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||
import Button from 'component/button';
|
||||
import ChannelIconItem from 'component/channelIconItem';
|
||||
import ChannelRewardsDriver from 'component/channelRewardsDriver';
|
||||
@@ -37,6 +37,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
|
||||
state = {
|
||||
autoStyle: null,
|
||||
returnUrl: null,
|
||||
canSave: true,
|
||||
claimId: null,
|
||||
creditsInputFocused: false,
|
||||
@@ -77,6 +78,7 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
descriptionFocused: false,
|
||||
websiteFocused: false,
|
||||
emailFocused: false,
|
||||
hasReturnedBack: false,
|
||||
};
|
||||
|
||||
didFocusListener;
|
||||
@@ -118,7 +120,14 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
};
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { currentRoute: prevRoute, drawerStack: prevDrawerStack, notify } = this.props;
|
||||
const {
|
||||
currentRoute: prevRoute,
|
||||
drawerStack: prevDrawerStack,
|
||||
popDrawerStack,
|
||||
setPlayerVisible,
|
||||
navigation,
|
||||
notify,
|
||||
} = this.props;
|
||||
const { currentRoute, drawerStack, updatingChannel, updateChannelError } = nextProps;
|
||||
|
||||
if (Constants.DRAWER_ROUTE_CHANNEL_CREATOR === currentRoute && currentRoute !== prevRoute) {
|
||||
@@ -142,6 +151,11 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
) {
|
||||
// navigated back from the form
|
||||
this.setState({ currentPhase: Constants.PHASE_LIST });
|
||||
if (!this.state.hasReturnedBack && this.state.returnUrl) {
|
||||
this.setState({ hasReturnedBack: true }, () => {
|
||||
navigateBack(navigation, drawerStack, popDrawerStack, setPlayerVisible);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,11 +185,12 @@ export default class ChannelCreator extends React.PureComponent {
|
||||
|
||||
let isEditMode = false;
|
||||
if (navigation.state.params) {
|
||||
const { editChannelUrl, displayForm } = navigation.state.params;
|
||||
const { editChannelUrl, displayForm, returnUrl } = navigation.state.params;
|
||||
if (editChannelUrl) {
|
||||
isEditMode = true;
|
||||
this.setState({ editChannelUrl, currentPhase: Constants.PHASE_CREATE });
|
||||
}
|
||||
this.setState({ returnUrl });
|
||||
}
|
||||
|
||||
if (!isEditMode && hasFormState) {
|
||||
|
||||
+18
-39
@@ -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);
|
||||
@@ -86,8 +63,8 @@ class DiscoverPage extends React.PureComponent {
|
||||
}
|
||||
|
||||
onComponentFocused = () => {
|
||||
const { pushDrawerStack, setPlayerVisible } = this.props;
|
||||
// pushDrawerStack();
|
||||
const { pushDrawerStack, setPlayerVisible, currentRoute } = this.props;
|
||||
pushDrawerStack();
|
||||
|
||||
NativeModules.Firebase.setCurrentScreen('Your tags');
|
||||
setPlayerVisible();
|
||||
@@ -291,25 +268,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)),
|
||||
|
||||
+51
-11
@@ -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) {
|
||||
@@ -328,7 +360,11 @@ class FilePage extends React.PureComponent {
|
||||
|
||||
onEditPressed = () => {
|
||||
const { claim, navigation } = this.props;
|
||||
navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISH, params: { editMode: true, claimToEdit: claim } });
|
||||
const uri = this.state.uri || this.getPurchaseUrl();
|
||||
navigation.navigate({
|
||||
routeName: Constants.DRAWER_ROUTE_PUBLISH,
|
||||
params: { editMode: true, claimToEdit: claim, returnUrl: uri },
|
||||
});
|
||||
};
|
||||
|
||||
onDeletePressed = () => {
|
||||
@@ -574,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;
|
||||
}
|
||||
|
||||
@@ -584,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);
|
||||
|
||||
@@ -666,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';
|
||||
@@ -693,7 +734,6 @@ class FilePage extends React.PureComponent {
|
||||
}
|
||||
|
||||
if (isPlayable) {
|
||||
this.startTime = Date.now();
|
||||
this.setState({ downloadPressed: true, autoPlayMedia: true, stopDownloadConfirmed: false });
|
||||
}
|
||||
if (isViewable) {
|
||||
|
||||
@@ -32,7 +32,7 @@ const select = state => ({
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine(1, 99999, true)),
|
||||
fetchInviteStatus: () => dispatch(doFetchInviteStatus()),
|
||||
inviteNew: email => dispatch(doUserInviteNew(email)),
|
||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_INVITES)),
|
||||
|
||||
@@ -21,6 +21,7 @@ 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 = {
|
||||
@@ -47,7 +48,19 @@ class InvitesPage extends React.PureComponent {
|
||||
pushDrawerStack();
|
||||
setPlayerVisible();
|
||||
NativeModules.Firebase.setCurrentScreen('Invites').then(result => {
|
||||
fetchChannelListMine();
|
||||
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();
|
||||
});
|
||||
};
|
||||
@@ -62,13 +75,15 @@ class InvitesPage extends React.PureComponent {
|
||||
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 { claimId, claimName } = parseURI(channel.permanent_url);
|
||||
const parsedUrl = channel.canonical_url ? parseURI(channel.canonical_url) : parseURI(channel.permanent_url);
|
||||
const { claimId, claimName } = parsedUrl;
|
||||
return `https://lbry.tv/$/invite/${claimName}:${claimId}`;
|
||||
};
|
||||
|
||||
@@ -96,6 +111,7 @@ class InvitesPage extends React.PureComponent {
|
||||
|
||||
if (!this.state.channelName && channels && channels.length > 0) {
|
||||
const firstChannel = channels[0];
|
||||
logPublish(firstChannel);
|
||||
this.setState({ channelName: firstChannel.name, inviteLink: this.getLinkForChannel(firstChannel) });
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ import Tag from 'component/tag';
|
||||
import TagSearch from 'component/tagSearch';
|
||||
import UriBar from 'component/uriBar';
|
||||
import publishStyle from 'styles/publish';
|
||||
import { navigateToUri, logPublish, uploadImageAsset } from 'utils/helper';
|
||||
import { navigateToUri, navigateBack, logPublish, uploadImageAsset } from 'utils/helper';
|
||||
|
||||
const languages = {
|
||||
en: 'English',
|
||||
@@ -141,6 +141,8 @@ class PublishPage extends React.PureComponent {
|
||||
// other
|
||||
publishStarted: false,
|
||||
storagePermissionRequired: false,
|
||||
hasReturnedBack: false,
|
||||
returnUrl: null,
|
||||
};
|
||||
|
||||
didFocusListener;
|
||||
@@ -236,7 +238,7 @@ class PublishPage extends React.PureComponent {
|
||||
let isEditMode = false,
|
||||
vanityUrlSet = false;
|
||||
if (navigation.state.params) {
|
||||
const { displayForm, editMode, claimToEdit, vanityUrl } = navigation.state.params;
|
||||
const { displayForm, editMode, claimToEdit, vanityUrl, returnUrl } = navigation.state.params;
|
||||
if (editMode) {
|
||||
this.prepareEdit(claimToEdit);
|
||||
isEditMode = true;
|
||||
@@ -250,6 +252,7 @@ class PublishPage extends React.PureComponent {
|
||||
vanityUrl: claimName,
|
||||
});
|
||||
}
|
||||
this.setState({ returnUrl });
|
||||
}
|
||||
|
||||
if (!isEditMode && hasFormState) {
|
||||
@@ -472,7 +475,15 @@ class PublishPage extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { currentRoute: prevRoute, drawerStack: prevDrawerStack, notify, updatePublishFormState } = this.props;
|
||||
const {
|
||||
currentRoute: prevRoute,
|
||||
drawerStack: prevDrawerStack,
|
||||
popDrawerStack,
|
||||
setPlayerVisible,
|
||||
navigation,
|
||||
notify,
|
||||
updatePublishFormState,
|
||||
} = this.props;
|
||||
const { currentRoute, drawerStack, publishFormValues } = nextProps;
|
||||
|
||||
if (Constants.DRAWER_ROUTE_PUBLISH === currentRoute && currentRoute !== prevRoute) {
|
||||
@@ -486,6 +497,11 @@ class PublishPage extends React.PureComponent {
|
||||
) {
|
||||
// navigated back from the form
|
||||
this.showSelector();
|
||||
if (!this.state.hasReturnedBack && this.state.returnUrl) {
|
||||
this.setState({ hasReturnedBack: true }, () => {
|
||||
navigateBack(navigation, drawerStack, popDrawerStack, setPlayerVisible);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,18 +25,23 @@ const select = state => ({
|
||||
isSearching: selectIsSearching(state),
|
||||
query: selectSearchValue(state),
|
||||
resolvingUris: selectResolvingUris(state),
|
||||
uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, Constants.DEFAULT_PAGE_SIZE)(state))(state),
|
||||
results: makeSelectResolvedSearchResults(makeSelectQueryWithOptions(null, Constants.DEFAULT_PAGE_SIZE)(state))(state),
|
||||
showNsfwContent: selectShowNsfw(state),
|
||||
uris: makeSelectSearchUris(
|
||||
makeSelectQueryWithOptions(null, { size: Constants.DEFAULT_PAGE_SIZE, isBackgroundSearch: false })(state),
|
||||
)(state),
|
||||
results: makeSelectResolvedSearchResults(
|
||||
makeSelectQueryWithOptions(null, { size: Constants.DEFAULT_PAGE_SIZE, isBackgroundSearch: false })(state),
|
||||
)(state),
|
||||
lastPageReached: makeSelectResolvedSearchResultsLastPageReached(
|
||||
makeSelectQueryWithOptions(null, Constants.DEFAULT_PAGE_SIZE)(state),
|
||||
makeSelectQueryWithOptions(null, { size: Constants.DEFAULT_PAGE_SIZE, isBackgroundSearch: false })(state),
|
||||
)(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));
|
||||
});
|
||||
});
|
||||
}
|
||||
// });
|
||||
|
||||
@@ -7,13 +7,13 @@ import {
|
||||
selectSubscriptionClaims,
|
||||
selectSubscriptions,
|
||||
selectIsFetchingSubscriptions,
|
||||
selectIsFetchingSuggested,
|
||||
selectSuggestedChannels,
|
||||
selectUnreadSubscriptions,
|
||||
selectViewMode,
|
||||
selectFirstRunCompleted,
|
||||
selectShowSuggestedSubs,
|
||||
} from 'lbryinc';
|
||||
import { doToast, selectFetchingClaimSearch } from 'lbry-redux';
|
||||
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { doSetClientSetting, doSetTimeItem } from 'redux/actions/settings';
|
||||
import { makeSelectClientSetting, selectTimeItem } from 'redux/selectors/settings';
|
||||
@@ -24,7 +24,7 @@ import SubscriptionsPage from './view';
|
||||
const select = state => ({
|
||||
currentRoute: selectCurrentRoute(state),
|
||||
loading: selectIsFetchingSubscriptions(state),
|
||||
loadingSuggested: selectIsFetchingSuggested(state),
|
||||
loadingSuggested: selectFetchingClaimSearch(state),
|
||||
subscribedChannels: selectSubscriptions(state),
|
||||
suggestedChannels: selectSuggestedChannels(state),
|
||||
subscriptionsViewMode: makeSelectClientSetting(Constants.SETTING_SUBSCRIPTIONS_VIEW_MODE)(state),
|
||||
@@ -41,6 +41,7 @@ const perform = dispatch => ({
|
||||
doFetchMySubscriptions: () => dispatch(doFetchMySubscriptions()),
|
||||
doFetchRecommendedSubscriptions: () => dispatch(doFetchRecommendedSubscriptions()),
|
||||
doSetViewMode: viewMode => dispatch(doSetViewMode(viewMode)),
|
||||
notify: data => dispatch(doToast(data)),
|
||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SUBSCRIPTIONS)),
|
||||
setClientSetting: (key, value) => dispatch(doSetClientSetting(key, value)),
|
||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||
@@ -49,5 +50,5 @@ const perform = dispatch => ({
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
perform,
|
||||
)(SubscriptionsPage);
|
||||
@@ -28,6 +28,7 @@ import ModalPicker from 'component/modalPicker';
|
||||
import ModalSuggestedSubscriptions from 'component/modalSuggestedSubscriptions';
|
||||
import SubscribedChannelList from 'component/subscribedChannelList';
|
||||
import SuggestedSubscriptions from 'component/suggestedSubscriptions';
|
||||
import SuggestedSubscriptionsGrid from 'component/suggestedSubscriptionsGrid';
|
||||
import UriBar from 'component/uriBar';
|
||||
|
||||
class SubscriptionsPage extends React.PureComponent {
|
||||
@@ -56,6 +57,7 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
|
||||
onComponentFocused = () => {
|
||||
const {
|
||||
currentRoute,
|
||||
doFetchMySubscriptions,
|
||||
doFetchRecommendedSubscriptions,
|
||||
doSetViewMode,
|
||||
@@ -64,12 +66,13 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
subscriptionsViewMode,
|
||||
} = this.props;
|
||||
|
||||
pushDrawerStack();
|
||||
if (currentRoute === Constants.DRAWER_ROUTE_SUBSCRIPTIONS) {
|
||||
pushDrawerStack();
|
||||
}
|
||||
setPlayerVisible();
|
||||
NativeModules.Firebase.setCurrentScreen('Subscriptions');
|
||||
|
||||
doFetchMySubscriptions();
|
||||
doFetchRecommendedSubscriptions();
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
@@ -90,6 +93,15 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
this.setState({ currentSortByItem: item, orderBy: getOrderBy(item), showSortPicker: false });
|
||||
};
|
||||
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
const { showModalSuggestedSubs: prevShowModalSuggestedSubs } = this.state;
|
||||
const { showModalSuggestedSubs } = this.state;
|
||||
if (prevShowModalSuggestedSubs && showModalSuggestedSubs) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
handleTimeItemSelected = item => {
|
||||
const { setTimeItem } = this.props;
|
||||
setTimeItem(item);
|
||||
@@ -138,6 +150,7 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
timeItem,
|
||||
unreadSubscriptions,
|
||||
navigation,
|
||||
notify,
|
||||
} = this.props;
|
||||
const { currentSortByItem, filteredChannels, showModalSuggestedSubs, showSortPicker, showTimePicker } = this.state;
|
||||
|
||||
@@ -164,7 +177,11 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
<View style={subscriptionsStyle.container}>
|
||||
<UriBar navigation={navigation} belowOverlay={this.state.showSortPicker} />
|
||||
<View style={subscriptionsStyle.titleRow}>
|
||||
<Text style={subscriptionsStyle.pageTitle}>{__('Channels you follow')}</Text>
|
||||
<Text style={subscriptionsStyle.pageTitle}>
|
||||
{hasSubscriptions && !this.state.showingSuggestedSubs
|
||||
? __('Channels you follow')
|
||||
: __('Find Channels to follow')}
|
||||
</Text>
|
||||
</View>
|
||||
{!this.state.showingSuggestedSubs && hasSubscriptions && (
|
||||
<View style={subscriptionsStyle.pickerRow}>
|
||||
@@ -190,7 +207,7 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
|
||||
<Link
|
||||
style={subscriptionsStyle.suggestedLink}
|
||||
text={__('Suggested')}
|
||||
text={__('Discover')}
|
||||
onPress={() => this.setState({ showModalSuggestedSubs: true })}
|
||||
/>
|
||||
</View>
|
||||
@@ -220,39 +237,38 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
|
||||
{this.state.showingSuggestedSubs && (
|
||||
<View style={subscriptionsStyle.suggestedSubsContainer}>
|
||||
{!hasSubscriptions && (
|
||||
<View style={subscriptionsStyle.infoArea}>
|
||||
<Text style={subscriptionsStyle.infoText}>
|
||||
{__('You are not subscribed to any channels at the moment.')}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
<View style={subscriptionsStyle.infoArea}>
|
||||
<Text style={subscriptionsStyle.infoText}>
|
||||
{__('LBRY works better if you follow at least 5 creators you like.')}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
{hasSubscriptions && (
|
||||
<View style={subscriptionsStyle.infoArea}>
|
||||
<Text style={subscriptionsStyle.infoText}>
|
||||
You are currently subscribed to {numberOfSubscriptions} channel{numberOfSubscriptions > 1 ? 's' : ''}.
|
||||
</Text>
|
||||
<Button
|
||||
style={subscriptionsStyle.button}
|
||||
text={__('View my subscriptions')}
|
||||
onPress={() => this.setState({ showingSuggestedSubs: false })}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
<View style={subscriptionsStyle.mainSuggested}>
|
||||
<SuggestedSubscriptionsGrid navigation={navigation} />
|
||||
</View>
|
||||
|
||||
<Button
|
||||
style={subscriptionsStyle.suggestedDoneButton}
|
||||
text={
|
||||
numberOfSubscriptions < 5
|
||||
? __('%remaining% more...', { remaining: 5 - numberOfSubscriptions })
|
||||
: __('Done')
|
||||
}
|
||||
onPress={() => {
|
||||
if (!hasSubscriptions) {
|
||||
notify({ message: __('Tap on any channel to follow') });
|
||||
} else {
|
||||
this.setState({ showingSuggestedSubs: false });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
{loadingSuggested && (
|
||||
<View style={subscriptionsStyle.centered}>
|
||||
<ActivityIndicator size="large" colors={Colors.NextLbryGreen} style={subscriptionsStyle.loading} />
|
||||
</View>
|
||||
<ActivityIndicator size="small" color={Colors.White} style={subscriptionsStyle.suggestedLoading} />
|
||||
)}
|
||||
{!loadingSuggested && <SuggestedSubscriptions navigation={navigation} />}
|
||||
</View>
|
||||
)}
|
||||
|
||||
{!showSortPicker && !showTimePicker && !showModalSuggestedSubs && (
|
||||
<FloatingWalletBalance navigation={navigation} />
|
||||
)}
|
||||
{showSortPicker && (
|
||||
<ModalPicker
|
||||
title={__('Sort content by')}
|
||||
|
||||
@@ -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} />
|
||||
|
||||
@@ -2,7 +2,7 @@ import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
|
||||
const reducers = {};
|
||||
const defaultState = {
|
||||
stack: [{ route: Constants.DRAWER_ROUTE_DISCOVER, params: {} }], // Discover is always the first drawer route
|
||||
stack: [{ route: Constants.DRAWER_ROUTE_SUBSCRIPTIONS, params: {} }], // Following is always the first drawer route
|
||||
lastRouteInStack: {},
|
||||
playerVisible: false,
|
||||
playerVisibleByUri: {},
|
||||
@@ -42,6 +42,9 @@ reducers[Constants.ACTION_PUSH_DRAWER_STACK] = (state, action) => {
|
||||
if (lastRoute === Constants.DRAWER_ROUTE_PUBLISH_FORM && routeName === Constants.DRAWER_ROUTE_PUBLISH) {
|
||||
canPushStack = false;
|
||||
}
|
||||
if (routeName === Constants.DRAWER_ROUTE_SUBSCRIPTIONS && newStack.length === 1) {
|
||||
canPushStack = false;
|
||||
}
|
||||
|
||||
let lastRouteInStack;
|
||||
if (canPushStack) {
|
||||
|
||||
@@ -37,12 +37,24 @@ const modalPickerStyle = StyleSheet.create({
|
||||
bottom: 8,
|
||||
position: 'absolute',
|
||||
},
|
||||
wideButtons: {
|
||||
marginTop: 16,
|
||||
left: 8,
|
||||
bottom: 8,
|
||||
right: 8,
|
||||
position: 'absolute',
|
||||
},
|
||||
doneButton: {
|
||||
alignSelf: 'flex-start',
|
||||
backgroundColor: Colors.LbryGreen,
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
},
|
||||
wideDoneButton: {
|
||||
backgroundColor: Colors.LbryGreen,
|
||||
paddingLeft: 16,
|
||||
paddingRight: 16,
|
||||
},
|
||||
});
|
||||
|
||||
export default modalPickerStyle;
|
||||
@@ -38,11 +38,13 @@ const subscriptionsStyle = StyleSheet.create({
|
||||
},
|
||||
infoText: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
fontSize: 16,
|
||||
fontSize: 14,
|
||||
marginTop: 8,
|
||||
marginBottom: 8,
|
||||
},
|
||||
infoArea: {
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
paddingBottom: 4,
|
||||
@@ -188,11 +190,11 @@ const subscriptionsStyle = StyleSheet.create({
|
||||
justifyContent: 'center',
|
||||
},
|
||||
suggestedItem: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
marginBottom: 16,
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
height: 140,
|
||||
},
|
||||
suggestedItemThumbnailContainer: {
|
||||
width: 70,
|
||||
@@ -209,30 +211,37 @@ const subscriptionsStyle = StyleSheet.create({
|
||||
suggestedItemDetails: {
|
||||
marginLeft: 16,
|
||||
marginRight: 16,
|
||||
flex: 0.8,
|
||||
alignItems: 'center',
|
||||
},
|
||||
suggestedItemSubscribe: {
|
||||
backgroundColor: Colors.White,
|
||||
},
|
||||
suggestedItemSubscribeOverlay: {
|
||||
position: 'absolute',
|
||||
left: 0,
|
||||
right: 0,
|
||||
top: 0,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'flex-end',
|
||||
paddingBottom: 4,
|
||||
height: 70,
|
||||
},
|
||||
suggestedItemTitle: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
fontSize: 16,
|
||||
marginBottom: 4,
|
||||
width: '85%',
|
||||
textAlign: 'center',
|
||||
fontSize: 14,
|
||||
marginTop: 4,
|
||||
marginBottom: 2,
|
||||
},
|
||||
suggestedItemName: {
|
||||
fontFamily: 'Inter-SemiBold',
|
||||
fontSize: 14,
|
||||
marginBottom: 4,
|
||||
color: Colors.LbryGreen,
|
||||
width: '95%',
|
||||
},
|
||||
suggestedItemTagList: {
|
||||
flexDirection: 'row',
|
||||
flexWrap: 'wrap',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
suggestedSubTitle: {
|
||||
fontFamily: 'Inter-Regular',
|
||||
@@ -266,6 +275,23 @@ const subscriptionsStyle = StyleSheet.create({
|
||||
modalSuggestedScrollContent: {
|
||||
paddingTop: 16,
|
||||
},
|
||||
suggestedDoneButton: {
|
||||
backgroundColor: Colors.LbryGreen,
|
||||
margin: 16,
|
||||
},
|
||||
mainSuggested: {
|
||||
flex: 1,
|
||||
},
|
||||
suggestedLoading: {
|
||||
position: 'absolute',
|
||||
right: 24,
|
||||
bottom: 22,
|
||||
},
|
||||
modalLoading: {
|
||||
position: 'absolute',
|
||||
right: 7,
|
||||
bottom: 7,
|
||||
},
|
||||
});
|
||||
|
||||
export default subscriptionsStyle;
|
||||
@@ -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;
|
||||
+28
-4
@@ -10,6 +10,7 @@ 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,
|
||||
@@ -170,6 +171,7 @@ export function navigateBack(navigation, drawerStack, popDrawerStack, setPlayerV
|
||||
if (popDrawerStack) {
|
||||
popDrawerStack();
|
||||
}
|
||||
|
||||
if (setPlayerVisible) {
|
||||
setPlayerVisible(false);
|
||||
}
|
||||
@@ -177,6 +179,7 @@ export function navigateBack(navigation, drawerStack, popDrawerStack, setPlayerV
|
||||
const target = drawerStack[drawerStack.length > 1 ? drawerStack.length - 2 : 0];
|
||||
const { route, params } = target;
|
||||
navigation.goBack(navigation.state.key);
|
||||
|
||||
if (!DrawerRoutes.includes(route) && !InnerDrawerRoutes.includes(route) && isURIValid(route)) {
|
||||
navigateToUri(navigation, route, null, true, null, setPlayerVisible);
|
||||
} else {
|
||||
@@ -186,7 +189,7 @@ export function navigateBack(navigation, drawerStack, popDrawerStack, setPlayerV
|
||||
if (Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM === route) {
|
||||
targetRoute = Constants.DRAWER_ROUTE_CHANNEL_CREATOR;
|
||||
} else if (Constants.DRAWER_ROUTE_PUBLISH_FORM === route) {
|
||||
targetRoute = Constants.DRAWER_ROUTE_PUBLISH_FORM;
|
||||
targetRoute = Constants.DRAWER_ROUTE_PUBLISH;
|
||||
}
|
||||
|
||||
if (targetParams) {
|
||||
@@ -201,8 +204,15 @@ export function navigateBack(navigation, drawerStack, popDrawerStack, setPlayerV
|
||||
}
|
||||
|
||||
export function dispatchNavigateBack(dispatch, nav, drawerStack) {
|
||||
if (drawerStack[drawerStack.length - 1].route === Constants.DRAWER_ROUTE_FILE_VIEW) {
|
||||
// inner file_view (web / image view) is handled differently
|
||||
const currentRoute = drawerStack[drawerStack.length - 1].route;
|
||||
if (
|
||||
[
|
||||
Constants.DRAWER_ROUTE_FILE_VIEW,
|
||||
Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM,
|
||||
Constants.DRAWER_ROUTE_PUBLISH_FORM,
|
||||
].includes(currentRoute)
|
||||
) {
|
||||
// inner routes are handled a little differently
|
||||
dispatch(doPopDrawerStack());
|
||||
return;
|
||||
}
|
||||
@@ -223,7 +233,7 @@ export function dispatchNavigateBack(dispatch, nav, drawerStack) {
|
||||
if (Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM === route) {
|
||||
targetRoute = Constants.DRAWER_ROUTE_CHANNEL_CREATOR;
|
||||
} else if (Constants.DRAWER_ROUTE_PUBLISH_FORM === route) {
|
||||
targetRoute = Constants.DRAWER_ROUTE_PUBLISH_FORM;
|
||||
targetRoute = Constants.DRAWER_ROUTE_PUBLISH;
|
||||
}
|
||||
|
||||
if (targetParams) {
|
||||
@@ -400,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