showRequestDialog method

void showRequestDialog(
  1. TUIRequest request
)

Implementation

void showRequestDialog(TUIRequest request) {
  String title = '';
  String message = '';
  String confirmText = '';
  String cancelText = 'doNotOpen'.roomTr;

  if (request.requestAction == TUIRequestAction.requestToOpenRemoteCamera) {
    isCameraInviteDialogShow = true;
    title = 'cameraInviteTitle'.roomTr;
    message = 'cameraInviteMessage'.roomTr;
    confirmText = 'confirmOpenCamera'.roomTr;
  } else if (request.requestAction ==
      TUIRequestAction.requestToOpenRemoteMicrophone) {
    isMicrophoneInviteDialogShow = true;
    title = 'microphoneInviteTitle'.roomTr;
    message = 'microphoneInviteMessage'.roomTr;
    confirmText = 'confirmOpenMicrophone'.roomTr;
  } else if (request.requestAction ==
      TUIRequestAction.requestRemoteUserOnSeat) {
    title = 'takeSeatInviteTitle'.roomTr;
    message = 'takeSeatInviteMessage'.roomTr;
    confirmText = 'agreeTakeSeat'.roomTr;
    cancelText = 'refuse'.roomTr;
  }
  showConferenceDialog(
    title: title,
    message: message,
    cancelText: cancelText,
    confirmText: confirmText,
    onCancel: () {
      RoomEngineManager()
          .getRoomEngine()
          .responseRemoteRequest(request.requestId, false);
      if (request.requestAction ==
          TUIRequestAction.requestToOpenRemoteCamera) {
        isCameraInviteDialogShow = false;
      } else if (request.requestAction ==
          TUIRequestAction.requestToOpenRemoteMicrophone) {
        isMicrophoneInviteDialogShow = false;
      }
    },
    onConfirm: () async {
      var result = await RoomEngineManager()
          .getRoomEngine()
          .responseRemoteRequest(request.requestId, true);
      Get.back();
      if (result.code == TUIError.errFailed) {
        makeToast(msg: 'goOnStageTimeOut'.roomTr);
      } else if (result.code == TUIError.errAllSeatOccupied) {
        makeToast(msg: 'stageMemberReachedLimit'.roomTr);
      }
    },
    barrierDismissible: false,
  );
}