show blocked message for blacklisted content

This commit is contained in:
Akinwale Ariwodola 2018-09-24 14:19:34 +01:00
parent d921347d73
commit 51fcf04b0b
5 changed files with 184 additions and 134 deletions

View file

@ -10,6 +10,7 @@ import {
} from 'react-native'; } from 'react-native';
import { import {
Lbry, Lbry,
blacklistReducer,
claimsReducer, claimsReducer,
costInfoReducer, costInfoReducer,
fileInfoReducer, fileInfoReducer,
@ -68,6 +69,7 @@ const navigatorReducer = (state = initialNavState, action) => {
const reducers = combineReducers({ const reducers = combineReducers({
auth: authReducer, auth: authReducer,
blacklist: blacklistReducer,
claims: claimsReducer, claims: claimsReducer,
costInfo: costInfoReducer, costInfo: costInfoReducer,
fileInfo: fileInfoReducer, fileInfo: fileInfoReducer,

View file

@ -329,6 +329,31 @@ class FilePage extends React.PureComponent {
<ChannelPage uri={uri} navigation={navigation} /> <ChannelPage uri={uri} navigation={navigation} />
); );
} else if (claim) { } else if (claim) {
let isClaimBlackListed = false;
if (blackListedOutpoints) {
for (let i = 0; i < blackListedOutpoints.length; i += 1) {
const outpoint = blackListedOutpoints[i];
if (outpoint.txid === claim.txid && outpoint.nout === claim.nout) {
isClaimBlackListed = true;
break;
}
}
}
if (isClaimBlackListed) {
innerContent = (
<View style={filePageStyle.pageContainer}>
<View style={filePageStyle.dmcaContainer}>
<Text style={filePageStyle.dmcaText}>
In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.
</Text>
<Link style={filePageStyle.dmcaLink} href="https://lbry.io/faq/dmca" text="Read More" />
</View>
<UriBar value={uri} navigation={navigation} />
</View>
);
} else {
const completed = fileInfo && fileInfo.completed; const completed = fileInfo && fileInfo.completed;
const title = metadata.title; const title = metadata.title;
const isRewardContent = rewardedContentClaimIds.includes(claim.claim_id); const isRewardContent = rewardedContentClaimIds.includes(claim.claim_id);
@ -468,6 +493,7 @@ class FilePage extends React.PureComponent {
</View> </View>
); );
} }
}
return innerContent; return innerContent;
} }

View file

@ -1,5 +1,5 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doBalanceSubscribe, doNotify } from 'lbry-redux'; import { doBalanceSubscribe, doBlackListedOutpointsSubscribe, doNotify } from 'lbry-redux';
import { import {
doAuthenticate, doAuthenticate,
doFetchRewardedContent, doFetchRewardedContent,
@ -20,6 +20,7 @@ const select = state => ({
const perform = dispatch => ({ const perform = dispatch => ({
authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)), authenticate: (appVersion, os) => dispatch(doAuthenticate(appVersion, os)),
balanceSubscribe: () => dispatch(doBalanceSubscribe()), balanceSubscribe: () => dispatch(doBalanceSubscribe()),
blacklistedOutpointsSubscribe: () => dispatch(doBlackListedOutpointsSubscribe()),
deleteCompleteBlobs: () => dispatch(doDeleteCompleteBlobs()), deleteCompleteBlobs: () => dispatch(doDeleteCompleteBlobs()),
fetchRewardedContent: () => dispatch(doFetchRewardedContent()), fetchRewardedContent: () => dispatch(doFetchRewardedContent()),
notify: data => dispatch(doNotify(data)), notify: data => dispatch(doNotify(data)),

View file

@ -144,11 +144,13 @@ class SplashScreen extends React.PureComponent {
const { const {
authenticate, authenticate,
balanceSubscribe, balanceSubscribe,
blacklistedOutpointsSubscribe,
navigation, navigation,
notify notify
} = this.props; } = this.props;
balanceSubscribe(); balanceSubscribe();
blacklistedOutpointsSubscribe();
NativeModules.VersionInfo.getAppVersion().then(appVersion => { NativeModules.VersionInfo.getAppVersion().then(appVersion => {
this.setState({ shouldAuthenticate: true }); this.setState({ shouldAuthenticate: true });
authenticate(appVersion, Platform.OS); authenticate(appVersion, Platform.OS);

View file

@ -165,6 +165,25 @@ const filePageStyle = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
flexDirection: 'row' flexDirection: 'row'
}, },
dmcaContainer: {
flex: 1,
alignItems: 'flex-start',
justifyContent: 'center',
paddingLeft: 24,
paddingRight: 24
},
dmcaText: {
fontFamily: 'Metropolis-Regular',
fontSize: 18,
lineHeight: 24
},
dmcaLink: {
color: Colors.LbryGreen,
fontFamily: 'Metropolis-Regular',
fontSize: 18,
lineHeight: 24,
marginTop: 24
},
infoText: { infoText: {
fontFamily: 'Metropolis-Regular', fontFamily: 'Metropolis-Regular',
fontSize: 20, fontSize: 20,