raiseHandAction method

void raiseHandAction()

Implementation

void raiseHandAction() {
  if (_store.currentUser.isOnSeat.value) {
    return;
  }
  if (!isRequestingTakeSeat.value) {
    isRequestingTakeSeat.value = true;
    if (RoomStore.to.currentUser.userRole.value != TUIRole.administrator) {
      makeToast(
        msg: 'joinStageApplicationSent'.roomTr,
      );
    }
    _takeSeatRequestId = _engineManager
        .takeSeat(
          _seatIndex,
          _reqTimeout,
          TUIRequestCallback(
            onAccepted: (requestId, userId) {
              makeToast(
                msg: 'takeSeatRequestAgreed'.roomTr,
              );
              isRequestingTakeSeat.value = false;
            },
            onRejected: (requestId, userId, message) {
              makeToast(
                msg: 'takeSeatRequestRejected'.roomTr,
              );
              isRequestingTakeSeat.value = false;
            },
            onCancelled: (requestId, userId) {
              isRequestingTakeSeat.value = false;
            },
            onTimeout: (requestId, userId) {
              isRequestingTakeSeat.value = false;
            },
            onError: (requestId, userId, error, message) {
              isRequestingTakeSeat.value = false;
            },
          ),
        )
        .requestId;
  } else {
    _engineManager.cancelRequest(_takeSeatRequestId);
    _takeSeatRequestId = '';

    makeToast(
      msg: 'joinStageApplicationCancelled'.roomTr,
    );
    isRequestingTakeSeat.value = false;
  }
}