Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
5.1 kB
1
Indexable
Never
// Customizable Area Start
// channel name vibe_chat_id

import { IBlock } from '../../../../framework/src/IBlock';
import { Message } from '../../../../framework/src/Message';
import { BlockComponent } from '../../../../framework/src/BlockComponent';
import MessageEnum, {
  getName,
} from '../../../../framework/src/Messages/MessageEnum';
import { runEngine } from '../../../../framework/src/RunEngine';

export const configJSON = require('../config');

export interface Props {
  navigation: any;
  id: string;
  // Customizable Area Start
  // Customizable Area End
}

interface S {
  // Customizable Area Start
  conversations: any;
  profileName: string;
  profileImage: string;
  delete:boolean;
  block:boolean;
  block_confirmed:boolean;
  report:boolean;
  help:boolean;
  report_reason:boolean;

  // Customizable Area End
}
let isFound = false;
interface SS {
  // Customizable Area Start
  id: any;
  // Customizable Area End
}

export default class SenderInfoScreenController extends BlockComponent<
  Props,
  S,
  SS
> {
  // Customizable Area Start
  apiEmailLoginCallId: string = '';

  // Customizable Area End

  constructor(props: Props) {
    super(props);
    this.receive = this.receive.bind(this);

    // Customizable Area Start
    this.subScribedMessages = [
      getName(MessageEnum.CountryCodeMessage),
      getName(MessageEnum.RestAPIResponceMessage),
      getName(MessageEnum.ReciveUserCredentials),
    ];

    this.state = {
      conversations: [],
      profileImage: '',
      profileName: '',
      delete:false,
      block : false,
      block_confirmed:false,
      report:false,
      help:false,
      report_reason:false
    };

    // Customizable Area End

    runEngine.attachBuildingBlock(this as IBlock, this.subScribedMessages);
  }
  componentDidUpdate() {}

  async componentDidMount() {
    this._fetchdetails()
    console.log('componentDidMount', this.props.navigation.state.params);
  }

  _fetchdetails = async() => {
    this.setState({profileImage:this.props.navigation.state.params?.profilePhoto,profileName:this.props.navigation.state.params?.profileName})

  }

  // Customizable Area End

  async receive(from: string, message: Message) {
    // Customizable Area Start
    // if (
    //   getName(MessageEnum.RestAPIResponceMessage) === message.id &&
    //   this.getAllChatsData != null &&
    //   this.getAllChatsData === message.getData(getName(MessageEnum.RestAPIResponceDataMessage))
    // ) {
    //   var responseJson = message.getData(
    //     getName(MessageEnum.RestAPIResponceSuccessMessage)
    //   );
    //   if (responseJson !== undefined && responseJson?.errors === undefined) {
    //     console.log(JSON.stringify(responseJson))
    //     this.setState({ chatsData: responseJson.data, isLoading: false })
    //     console.log("back from chat detail ---------------------", responseJson)
    //   } else {
    //     var errorReponse = message.getData(
    //       getName(MessageEnum.RestAPIResponceErrorMessage)
    //     );
    //     console.log("eeefenwenfiewnf", errorReponse)
    //     console.log(responseJson)
    //     // this.parseApiCatchErrorResponse(errorReponse);
    //   }
    // }
    // if (
    //   getName(MessageEnum.RestAPIResponceMessage) === message.id &&
    //   this.fetchTokenApi != null &&
    //   this.fetchTokenApi === message.getData(getName(MessageEnum.RestAPIResponceDataMessage))
    // ) {
    //   var responseJson = message.getData(
    //     getName(MessageEnum.RestAPIResponceSuccessMessage)
    //   );
    //   // console.log("nwenfiewnf", responseJson)
    //   if (responseJson !== undefined && responseJson?.errors === undefined) {
    //     this.setState({ token: responseJson.token })
    //     this.initChatFunction(responseJson.token)
    //     // this.setState({chatsData:responseJson.data})
    //   } else {
    //     var errorReponse = message.getData(
    //       getName(MessageEnum.RestAPIResponceErrorMessage)
    //     );
    //     console.log("eeefenwenfiewnf", errorReponse)
    //     console.log(responseJson)
    //     // this.parseApiCatchErrorResponse(errorReponse);
    //   }
    // }
    // Customizable Area End
  }

  // playPauseSong = () => {
  //   if (this.context?.playSongData?.songMediaUrl !== '' && this.context?.playSongData?.songMediaUrl !== undefined && this.context?.playSongData?.songMediaUrl !== null) {
  //     if (this.context.isplay === false) {
  //       this.context.playData(true)
  //       SoundPlayer.pause()
  //     } else if (this.context.isplay === true) {
  //       if (this.state.progress > 0.9) {
  //         this.context.playData(false)
  //         console.log("eneneprger", this.context?.playSongData)
  //         SoundPlayer.playUrl(this.context?.playSongData?.songMediaUrl)
  //       } else if (this.state.progress < 0.9) {
  //         SoundPlayer.resume()
  //         this.context.playData(false)
  //       }
  //     }
  //   } else {
  //    // alert("Song value is empty")
  //     this.context.playData(true)
  //   }
  // }

  getReportListApi = () => {
    console.log('report')
  }
}

// Customizable Area End