Commit 6b053089 authored by Juan Manuel Solaro's avatar Juan Manuel Solaro
Browse files

(feat) ability to report blogs

parent 7536cdc2
Loading
Loading
Loading
Loading
+10 −5
Original line number Original line Diff line number Diff line
@@ -155,11 +155,10 @@ export default class BlogsViewScreen extends Component {
    const image = blog.getBannerSource();
    const image = blog.getBannerSource();


    const actionSheet = this.getActionSheet();
    const actionSheet = this.getActionSheet();
    const optMenu = featuresService.has('allow-comments-toggle') ?
    const optMenu = <View style={styles.rightToolbar}>
      (<View style={styles.rightToolbar}>
        <Icon name="more-vert"  onPress={() => this.showActionSheet()} size={26} style={styles.icon}/>
        <Icon name="more-vert"  onPress={() => this.showActionSheet()} size={26} style={styles.icon}/>
        {actionSheet}
        {actionSheet}
      </View>) : (null);
      </View>
    return (
    return (
      <View style={styles.screen}>
      <View style={styles.screen}>
        <FastImage source={image} resizeMode={FastImage.resizeMode.cover} style={styles.image} />
        <FastImage source={image} resizeMode={FastImage.resizeMode.cover} style={styles.image} />
@@ -190,8 +189,10 @@ export default class BlogsViewScreen extends Component {
  }
  }


  getActionSheet() {
  getActionSheet() {
    let options = [ i18n.t('cancel') ];
    let options = [ i18n.t('report'), i18n.t('cancel') ];
    if (featuresService.has('allow-comments-toggle')) {
      options.push(this.props.blogsView.blog.allow_comments ? i18n.t('disableComments') : i18n.t('enableComments'));
      options.push(this.props.blogsView.blog.allow_comments ? i18n.t('disableComments') : i18n.t('enableComments'));
    }
    return (
    return (
      <ActionSheet
      <ActionSheet
        ref={o => this.ActionSheet = o}
        ref={o => this.ActionSheet = o}
@@ -208,6 +209,9 @@ export default class BlogsViewScreen extends Component {
  
  
  async handleActionSheetSelection(option) {
  async handleActionSheetSelection(option) {
    switch(option) {
    switch(option) {
      case i18n.t('report'):
        this.props.navigation.navigate('Report', { entity: this.props.blogsView.blog });
        break;
      case i18n.t('disableComments'):
      case i18n.t('disableComments'):
      case i18n.t('enableComments'):
      case i18n.t('enableComments'):
        try {
        try {
@@ -216,6 +220,7 @@ export default class BlogsViewScreen extends Component {
          console.error(err);
          console.error(err);
          this.showError();
          this.showError();
        }
        }
        break;
        
        
    }
    }
  }
  }