enterVoiceRoomPage method

Future<bool> enterVoiceRoomPage(
  1. BuildContext context,
  2. LiveInfo liveInfo
)

Implementation

Future<bool> enterVoiceRoomPage(BuildContext context, LiveInfo liveInfo) async {
  if (isRepeatClick) {
    return false;
  }
  isRepeatClick = true;
  GlobalFloatWindowManager floatWindowManager = GlobalFloatWindowManager.instance;
  GlobalFloatWindowState state = floatWindowManager.state;
  if (floatWindowManager.isFloating()) {
    if (state.ownerId.value == TUIRoomEngine.getSelfInfo().userId) {
      isRepeatClick = false;
      makeToast(context, LiveKitLocalizations.of(Global.appContext())!.livelist_exit_float_window_tip,
          type: ToastType.warning);
      return false;
    }
    if (state.roomId.value == liveInfo.liveID) {
      isRepeatClick = false;
      floatWindowManager.switchToFullScreenMode();
      return false;
    } else {
      floatWindowManager.overlayManager.closeOverlay();
    }
  }
  Navigator.push(
      getContext(),
      MaterialPageRoute(
        settings: const RouteSettings(name: routeVoiceRoomAudience),
        builder: (context) {
          bool isOwner = liveInfo.liveOwner.userID == TUIRoomEngine.getSelfInfo().userId;
          if (floatWindowManager.isEnableFloatWindowFeature()) {
            return TUIVoiceRoomOverlay(
                roomId: liveInfo.liveID, behavior: isOwner ? RoomBehavior.autoCreate : RoomBehavior.join);
          } else {
            return TUIVoiceRoomWidget(
                roomId: liveInfo.liveID, behavior: isOwner ? RoomBehavior.autoCreate : RoomBehavior.join);
          }
        },
      ));
  isRepeatClick = false;
  return true;
}