From fb5b6598d2079a4fe47a11b306739fae54129fce Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 27 Sep 2019 18:57:29 +0100 Subject: [PATCH 1/3] check nsfw flag when retrieving trending channels --- src/component/suggestedSubscriptions/index.js | 2 ++ src/component/suggestedSubscriptions/view.js | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/component/suggestedSubscriptions/index.js b/src/component/suggestedSubscriptions/index.js index 9228cea..4d940cc 100644 --- a/src/component/suggestedSubscriptions/index.js +++ b/src/component/suggestedSubscriptions/index.js @@ -1,6 +1,7 @@ import { connect } from 'react-redux'; import { doClaimSearch, selectFetchingClaimSearch, selectClaimSearchByQuery, selectFollowedTags } from 'lbry-redux'; import { selectSuggestedChannels, selectIsFetchingSuggested } from 'lbryinc'; +import { selectShowNsfw } from 'redux/selectors/settings'; import SuggestedSubscriptions from './view'; const select = state => ({ @@ -8,6 +9,7 @@ const select = state => ({ suggested: selectSuggestedChannels(state), loading: selectIsFetchingSuggested(state) || selectFetchingClaimSearch(state), claimSearchByQuery: selectClaimSearchByQuery(state), + showNsfwContent: selectShowNsfw(state), }); const perform = dispatch => ({ diff --git a/src/component/suggestedSubscriptions/view.js b/src/component/suggestedSubscriptions/view.js index 4afc2a3..e61a074 100644 --- a/src/component/suggestedSubscriptions/view.js +++ b/src/component/suggestedSubscriptions/view.js @@ -1,6 +1,6 @@ import React from 'react'; 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 SubscribeButton from 'component/subscribeButton'; import SuggestedSubscriptionItem from 'component/suggestedSubscriptionItem'; @@ -16,13 +16,16 @@ class SuggestedSubscriptions extends React.PureComponent { }; componentDidMount() { - const { claimSearch, followedTags } = this.props; + const { claimSearch, followedTags, showNsfwContent } = this.props; const options = { any_tags: _.shuffle(followedTags.map(tag => tag.name)).slice(0, 3), page: 1, no_totals: true, claim_type: 'channel', }; + if (!showNsfwContent) { + options.not_tags = MATURE_TAGS; + } this.setState({ options }); claimSearch(options); } -- 2.45.2 From 5fc6bc50c3af8267c8fb6ebb5656c1f5272e550c Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 27 Sep 2019 19:18:40 +0100 Subject: [PATCH 2/3] rename 'Tags you follow' to 'Suggested channels' --- src/component/suggestedSubscriptions/view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/component/suggestedSubscriptions/view.js b/src/component/suggestedSubscriptions/view.js index e61a074..d59074c 100644 --- a/src/component/suggestedSubscriptions/view.js +++ b/src/component/suggestedSubscriptions/view.js @@ -38,7 +38,7 @@ class SuggestedSubscriptions extends React.PureComponent { const suggestedUris = suggested ? suggested.map(suggested => suggested.uri) : []; return [ { - title: __('Tags you follow'), + title: __('Suggested channels'), data: claimSearchUris ? claimSearchUris.filter(uri => !suggestedUris.includes(uri)) : [], }, { -- 2.45.2 From 6958cdcfcb744b9d72b3b50d3c53e501812857e8 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Mon, 30 Sep 2019 12:23:00 +0100 Subject: [PATCH 3/3] implement suggested subscriptions modal --- .../modalSuggestedSubscriptions/index.js | 4 ++ .../modalSuggestedSubscriptions/view.js | 26 ++++++++++ src/component/suggestedSubscriptions/view.js | 10 ++-- src/page/subscriptions/view.js | 47 ++++++++++++------ src/styles/modal.js | 48 +++++++++++++++++++ src/styles/subscriptions.js | 21 +++++++- 6 files changed, 137 insertions(+), 19 deletions(-) create mode 100644 src/component/modalSuggestedSubscriptions/index.js create mode 100644 src/component/modalSuggestedSubscriptions/view.js create mode 100644 src/styles/modal.js diff --git a/src/component/modalSuggestedSubscriptions/index.js b/src/component/modalSuggestedSubscriptions/index.js new file mode 100644 index 0000000..6eef7f4 --- /dev/null +++ b/src/component/modalSuggestedSubscriptions/index.js @@ -0,0 +1,4 @@ +import { connect } from 'react-redux'; +import ModalSuggestedSubscriptions from './view'; + +export default connect()(ModalSuggestedSubscriptions); diff --git a/src/component/modalSuggestedSubscriptions/view.js b/src/component/modalSuggestedSubscriptions/view.js new file mode 100644 index 0000000..0c8765e --- /dev/null +++ b/src/component/modalSuggestedSubscriptions/view.js @@ -0,0 +1,26 @@ +import React from 'react'; +import { ScrollView, Text, TouchableOpacity, View } from 'react-native'; +import modalStyle from 'styles/modal'; +import subscriptionsStyle from 'styles/subscriptions'; +import Button from 'component/button'; +import Colors from 'styles/colors'; +import SuggestedSubscriptions from 'component/suggestedSubscriptions'; +import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api +import Icon from 'react-native-vector-icons/FontAwesome5'; + +export default class ModalSuggestedSubcriptions extends React.PureComponent { + render() { + const { navigation, onDonePress, onOverlayPress } = this.props; + + return ( + + + + +