currentCall method

void currentCall()

Implementation

void currentCall() async {
  if (!mounted) {
    return;
  }
  currentRate++;
  if (currentRate == 10 && !localVideoStatus) {
    widget.delegate?.onShowLocalVideo(true, check: false);
  }
  if (currentRate == 20 && !remoteVideoStatus) {
    widget.delegate?.onShowLocalVideo(false, check: false);
  }
  if (matchSoon && match15 && currentRate == widget.videoMatchTime ~/ 3) {
    widget.delegate?.onShowMatchWidget();
  }
  if (match15 && currentRate == widget.videoMatchTime) {
    if (matchSoon) {
      widget.delegate?.onShowToast(3);
      widget.delegate?.showEndView(true);
    } else {
      matchStart();
    }
  }
  if (match15 &&
      !matchSoon &&
      !showTime &&
      currentRate == widget.videoMatchTime + 5) {
    widget.delegate?.onShowToast(3);
    widget.delegate?.showEndView(true);
  }
  if (currentRate % 60 == 0) {
    if (isSoonMoney) {
      int? rate = await widget.delegate?.onCalling(currentRate - 1);
      if ((rate ?? 0) != 0) {
        currentRate = rate!;
      }
      int? size = widget.delegate?.onShowMoney();
      isSoonMoney = size == 0;
    } else {
      widget.delegate?.onCalling();
    }
  }
  if (currentDown > 0) {
    currentDown--;
    widget.delegate?.onCurrentRate(currentDown, down: true);
    if (currentDown == widget.videoMatchDownTime) {
      widget.delegate?.onVideoSetState();
    }
    if (!match15 &&
        currentDown <= widget.videoMatchDownTime &&
        currentRate % 2 == 0) {
      widget.delegate?.onCurrentRate(currentRate, show: true);
    }
  }
  widget.delegate?.onCurrentRate(currentRate);
}