mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-11-29 22:07:46 +03:00
Merge pull request #664 from esteemapp/feature/nsfw
Fixed nsfw requirements
This commit is contained in:
commit
a4ded84f3e
BIN
src/assets/nsfw.png
Normal file
BIN
src/assets/nsfw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
@ -82,9 +82,11 @@ class PostCardContainer extends PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { content, isHideImage } = this.props;
|
||||
const { content, isHideImage, nsfw } = this.props;
|
||||
const { _content } = this.state;
|
||||
|
||||
const isNsfwPost = nsfw === '1';
|
||||
|
||||
return (
|
||||
<PostCardView
|
||||
handleOnUserPress={this._handleOnUserPress}
|
||||
@ -93,6 +95,7 @@ class PostCardContainer extends PureComponent {
|
||||
fetchPost={this._fetchPost}
|
||||
content={_content || content}
|
||||
isHideImage={isHideImage}
|
||||
isNsfwPost={isNsfwPost}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -100,6 +103,7 @@ class PostCardContainer extends PureComponent {
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
currentAccount: state.account.currentAccount,
|
||||
nsfw: state.application.nsfw,
|
||||
});
|
||||
|
||||
export default withNavigation(connect(mapStateToProps)(PostCardContainer));
|
||||
|
@ -18,6 +18,7 @@ import styles from './postCardStyles';
|
||||
|
||||
// Defaults
|
||||
import DEFAULT_IMAGE from '../../../assets/no_image.png';
|
||||
import NSFW_IMAGE from '../../../assets/nsfw.png';
|
||||
|
||||
class PostCardView extends Component {
|
||||
/* Props
|
||||
@ -56,11 +57,22 @@ class PostCardView extends Component {
|
||||
handleOnVotersPress(content.active_votes);
|
||||
};
|
||||
|
||||
_getPostImage = (content, isNsfwPost) => {
|
||||
if (content && content.image) {
|
||||
if (isNsfwPost && content.nsfw) {
|
||||
return NSFW_IMAGE;
|
||||
}
|
||||
return { uri: content.image, priority: FastImage.priority.high };
|
||||
}
|
||||
return DEFAULT_IMAGE;
|
||||
};
|
||||
|
||||
render() {
|
||||
const { content, isHideImage, fetchPost } = this.props;
|
||||
const _image = content && content.image
|
||||
? { uri: content.image, priority: FastImage.priority.high }
|
||||
: DEFAULT_IMAGE;
|
||||
const {
|
||||
content, isHideImage, fetchPost, isNsfwPost,
|
||||
} = this.props;
|
||||
|
||||
const _image = this._getPostImage(content, isNsfwPost);
|
||||
const reblogedBy = content.reblogged_by && content.reblogged_by[0];
|
||||
|
||||
return (
|
||||
|
@ -3,7 +3,7 @@ export default (posts, option) => {
|
||||
if (option === '1') {
|
||||
posts.map((post) => {
|
||||
if (post.parent_permlink === 'nsfw' || post.json_metadata.tags.includes('nsfw')) {
|
||||
post.image = 'https://steemitimages.com/p/Zskj9C56UonWToSX7uRkL8H89BqdWqSPnzP84oDpA65G4PfbZk688V2cRYbWszK7zoMMj35CfbJfcXuJSSwTvasK4pPKfHMy2xjGJSkmqs8gLQnoddR8?format=match&mode=fit&width=600&height=600';
|
||||
post.nsfw = true;
|
||||
}
|
||||
});
|
||||
return posts;
|
||||
|
Loading…
Reference in New Issue
Block a user