示例#1
0
 /** 下载 */
 @Override
 public void onDownloadMessageComplete(ECError e, ECMessage message) {
   if (e.errorCode == SdkErrorCode.REQUEST_SUCCESS) {
     if (message == null) return;
     // 处理发送文件IM消息的时候进度回调
     LogUtil.d(TAG, "[onDownloadMessageComplete] msgId:" + message.getMsgId());
     postDowloadMessageResult(message);
   } else {
     // 重试下载3次
     SyncMsgEntry remove = syncMessage.remove(message.getMsgId());
     if (remove == null) {
       return;
     }
     LogUtil.d(TAG, "[onDownloadMessageComplete] download fail , retry :" + remove.retryCount);
     retryDownload(remove);
   }
 }
示例#2
0
 /** 收到新的IM文本和附件消息 */
 @Override
 public void OnReceivedMessage(ECMessage msg) {
   LogUtil.d(TAG, "[OnReceivedMessage] show notice true");
   if (msg == null) {
     return;
   }
   postReceiveMessage(msg, true);
 }
示例#3
0
 @Override
 public void onProgress(String msgId, int totalByte, int progressByte) {
   // 处理发送文件IM消息的时候进度回调
   LogUtil.d(
       TAG,
       "[IMChattingHelper - onProgress] msgId: "
           + msgId
           + " , totalByte: "
           + totalByte
           + " , progressByte:"
           + progressByte);
 }
示例#4
0
 @Override
 public void onReceiveOfflineMessage(List<ECMessage> msgs) {
   // 离线消息的处理可以参考 void OnReceivedMessage(ECMessage msg)方法
   // 处理逻辑完全一样
   // 参考 IMChattingHelper.java
   LogUtil.d(TAG, "[onReceiveOfflineMessage] show notice false");
   if (msgs != null && !msgs.isEmpty() && !isFirstSync) isFirstSync = true;
   for (ECMessage msg : msgs) {
     mOfflineMsg = msg;
     postReceiveMessage(msg, false);
   }
 }
示例#5
0
 @Override
 public void onProgress(String msgId, int total, int progress) {
   // 处理发送文件IM消息的时候进度回调
   LogUtil.d(
       TAG,
       "[IMChattingHelper - onProgress] msgId:"
           + msgId
           + " ,total:"
           + total
           + " ,progress:"
           + progress);
 }
示例#6
0
 public void getPersonInfo() {
   LogUtil.d(TAG, "[getPersonInfo] currentVersion :");
   final ClientUser clientUser = CCPAppManager.getClientUser();
   if (clientUser == null) {
     return;
   }
   LogUtil.d(
       TAG,
       "[getPersonInfo] currentVersion :"
           + clientUser.getpVersion()
           + " ,ServerVersion: "
           + mServicePersonVersion);
   if (clientUser.getpVersion() < mServicePersonVersion) {
     SDKCoreHelper.getECChatManager()
         .getPersonInfo(
             new ECChatManager.OnGetPersonInfoListener() {
               @Override
               public void onGetPersonInfoComplete(ECError e, PersonInfo p) {
                 clientUser.setpVersion(p.getVersion());
                 clientUser.setSex(p.getSex());
                 clientUser.setUserName(p.getNickName());
                 if (!TextUtils.isEmpty(p.getBirth())) {
                   clientUser.setBirth(DateUtil.getActiveTimelong(p.getBirth()));
                 }
                 String newVersion = clientUser.toString();
                 LogUtil.d(TAG, "[getPersonInfo -result] ClientUser :" + newVersion);
                 try {
                   ECPreferences.savePreference(
                       ECPreferenceSettings.SETTINGS_REGIST_AUTO, newVersion, true);
                 } catch (InvalidClassException e1) {
                   e1.printStackTrace();
                 }
               }
             });
   }
 }