takeSeat method

void takeSeat(
  1. int index
)

Implementation

void takeSeat(int index) {
  if (needRequestToTakeSeat()) {
    viewState.linkStatus.value = LinkStatus.applying;
  }
  TUIRequest request = liveService.takeSeat(
      index,
      timeout,
      TUIRequestCallback(
        onAccepted: (String requestId, String userId) {
          seatState.mySeatApplicationId.value = "";
        },
        onRejected: (String requestId, String userId, String message) {
          seatState.mySeatApplicationId.value = "";
          viewState.linkStatus.value = LinkStatus.none;
          makeToast(msg: LiveKitLocalizations.of(Global.appContext())!.livekit_take_seat_rejected);
        },
        onCancelled: (String requestId, String userId) {
          seatState.mySeatApplicationId.value = "";
          viewState.linkStatus.value = LinkStatus.none;
        },
        onTimeout: (String requestId, String userId) {
          seatState.mySeatApplicationId.value = "";
          viewState.linkStatus.value = LinkStatus.none;
          makeToast(msg: LiveKitLocalizations.of(Global.appContext())!.livekit_take_seat_timeout);
        },
        onError: (String requestId, String userId, TUIError error, String message) {
          seatState.mySeatApplicationId.value = "";
          viewState.linkStatus.value = LinkStatus.none;
          ErrorHandler.onError(error);
        },
      ));
  seatState.mySeatApplicationId.value = request.requestId;
}