Ejemplo n.º 1
0
  public void onRepNormalGroupList(IMGroup.IMNormalGroupListRsp normalGroupListRsp) {
    logger.i("group#onRepNormalGroupList");
    int groupSize = normalGroupListRsp.getGroupVersionListCount();
    logger.i("group#onRepNormalGroupList cnt:%d", groupSize);
    List<IMBaseDefine.GroupVersionInfo> versionInfoList =
        normalGroupListRsp.getGroupVersionListList();

    /** 对比DB中的version字段 */
    // 这块对比的可以抽离出来
    List<IMBaseDefine.GroupVersionInfo> needInfoList = new ArrayList<>();

    for (IMBaseDefine.GroupVersionInfo groupVersionInfo : versionInfoList) {
      int groupId = groupVersionInfo.getGroupId();
      int version = groupVersionInfo.getVersion();
      if (groupMap.containsKey(groupId) && groupMap.get(groupId).getVersion() == version) {
        continue;
      }
      IMBaseDefine.GroupVersionInfo versionInfo =
          IMBaseDefine.GroupVersionInfo.newBuilder().setVersion(0).setGroupId(groupId).build();
      needInfoList.add(versionInfo);
    }

    // 事件触发的时候需要注意 todo
    if (needInfoList.size() > 0) {
      reqGetGroupDetailInfo(needInfoList);
    }
  }
Ejemplo n.º 2
0
 public void reqGroupDetailInfo(int groupId) {
   IMBaseDefine.GroupVersionInfo groupVersionInfo =
       IMBaseDefine.GroupVersionInfo.newBuilder().setGroupId(groupId).setVersion(0).build();
   ArrayList<IMBaseDefine.GroupVersionInfo> list = new ArrayList<>();
   list.add(groupVersionInfo);
   reqGetGroupDetailInfo(list);
 }
Ejemplo n.º 3
0
  /** 1. 加载本地信息 2. 从session中获取 群组信息,从本地中获取这些群组的version信息 3. 合并上述的merge结果, version groupId 请求 */
  private void loadSessionGroupInfo() {
    logger.i("group#loadSessionGroupInfo");

    List<SessionEntity> sessionInfoList = IMSessionManager.instance().getRecentSessionList();

    List<IMBaseDefine.GroupVersionInfo> needReqList = new ArrayList<>();
    for (SessionEntity sessionInfo : sessionInfoList) {
      int version = 0;
      if (sessionInfo.getPeerType() == DBConstant.SESSION_TYPE_GROUP
      /** 群组 */
      ) {
        if (groupMap.containsKey(sessionInfo.getPeerId())) {
          version = groupMap.get(sessionInfo.getPeerId()).getVersion();
        }

        IMBaseDefine.GroupVersionInfo versionInfo =
            IMBaseDefine.GroupVersionInfo.newBuilder()
                .setVersion(version)
                .setGroupId(sessionInfo.getPeerId())
                .build();
        needReqList.add(versionInfo);
      }
    }
    // 事件触发的时候需要注意
    if (needReqList.size() > 0) {
      reqGetGroupDetailInfo(needReqList);
      return;
    }
  }