getClassInfoFromServer method

Future<ClassInfo?> getClassInfoFromServer(
  1. String from
)

Implementation

Future<ClassInfo?> getClassInfoFromServer(String from) async {
  var classId = _config.classId;
  var body = GetClassInfoBody(classId: classId, allTask: 0);
  var data = await networkService.getClassInfo(body);
  if (data != null) {
    if (data.errorCode == 0) {
      _classInfoObs.updateClassInfo(data.classInfo);
      _taskController.initTasks(lastTaskSeq: data.classInfo.roomInfo.lastTaskSeq, tasks: data.classInfo.roomInfo.tasks);
      _eventbus.fire(MainEvent(type: EventTypeEnum.getClassInfoSuccess, data: data.classInfo));
      final maxRtcMember = data.classInfo.roomInfo.maxRtcMember;
      if (maxRtcMember > 1) {
        _loopStageObs.updateLoopStateEnabled(true);
        _loopStageObs.updateMaxMemberNumber(maxRtcMember);
        _loopStageObs.updateMemberNumber(maxRtcMember, needEvent: false);
      } else {
        _loopStageObs.updateLoopStateEnabled(false);
      }
      TCICLog.info('getClassInfoFromServer success from $from', actionModule: ActionModule.tcicController.name, actionName: ActionName.getClassInfoFromServer.name);
      return data.classInfo;
    }
  }
  TCICLog.error('getClassInfoFromServer failed from $from', actionModule: ActionModule.tcicController.name, actionName: ActionName.getClassInfoFromServer.name);
  return null;
}