Suggested subscriptions improvements #49

Merged
akinwale merged 3 commits from suggested-subs into master 2019-10-02 11:36:33 +02:00
2 changed files with 7 additions and 2 deletions
Showing only changes of commit fb5b6598d2 - Show all commits

View file

@ -1,6 +1,7 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doClaimSearch, selectFetchingClaimSearch, selectClaimSearchByQuery, selectFollowedTags } from 'lbry-redux'; import { doClaimSearch, selectFetchingClaimSearch, selectClaimSearchByQuery, selectFollowedTags } from 'lbry-redux';
import { selectSuggestedChannels, selectIsFetchingSuggested } from 'lbryinc'; import { selectSuggestedChannels, selectIsFetchingSuggested } from 'lbryinc';
import { selectShowNsfw } from 'redux/selectors/settings';
import SuggestedSubscriptions from './view'; import SuggestedSubscriptions from './view';
const select = state => ({ const select = state => ({
@ -8,6 +9,7 @@ const select = state => ({
suggested: selectSuggestedChannels(state), suggested: selectSuggestedChannels(state),
loading: selectIsFetchingSuggested(state) || selectFetchingClaimSearch(state), loading: selectIsFetchingSuggested(state) || selectFetchingClaimSearch(state),
claimSearchByQuery: selectClaimSearchByQuery(state), claimSearchByQuery: selectClaimSearchByQuery(state),
showNsfwContent: selectShowNsfw(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({

View file

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import { ActivityIndicator, FlatList, SectionList, Text, View } from 'react-native'; import { ActivityIndicator, FlatList, SectionList, Text, View } from 'react-native';
import { createNormalizedClaimSearchKey, normalizeURI } from 'lbry-redux'; import { MATURE_TAGS, createNormalizedClaimSearchKey, normalizeURI } from 'lbry-redux';
import { __, navigateToUri } from 'utils/helper'; import { __, navigateToUri } from 'utils/helper';
import SubscribeButton from 'component/subscribeButton'; import SubscribeButton from 'component/subscribeButton';
import SuggestedSubscriptionItem from 'component/suggestedSubscriptionItem'; import SuggestedSubscriptionItem from 'component/suggestedSubscriptionItem';
@ -16,13 +16,16 @@ class SuggestedSubscriptions extends React.PureComponent {
}; };
componentDidMount() { componentDidMount() {
const { claimSearch, followedTags } = this.props; const { claimSearch, followedTags, showNsfwContent } = this.props;
const options = { const options = {
any_tags: _.shuffle(followedTags.map(tag => tag.name)).slice(0, 3), any_tags: _.shuffle(followedTags.map(tag => tag.name)).slice(0, 3),
page: 1, page: 1,
no_totals: true, no_totals: true,
claim_type: 'channel', claim_type: 'channel',
}; };
if (!showNsfwContent) {
options.not_tags = MATURE_TAGS;
}
this.setState({ options }); this.setState({ options });
claimSearch(options); claimSearch(options);
} }