示例#1
0
 private void onMessage(
     final AVIMTypedMessage message, final AVIMConversation conversation, AVIMClient imClient) {
   if (message == null || message.getMessageId() == null) {
     LogUtils.d("may be SDK Bug, message or message id is null");
     return;
   }
   if (!ConversationHelper.isValidConversation(conversation)) {
     LogUtils.d("receive msg from invalid conversation");
   }
   if (lookUpConversationById(conversation.getConversationId()) == null) {
     registerConversation(conversation);
   }
   LogUtils.d("receive message, content :", message.getContent());
   roomsTable.insertRoom(message.getConversationId());
   roomsTable.increaseUnreadCount(message.getConversationId());
   MessageEvent messageEvent = new MessageEvent(message, MessageEvent.Type.Come);
   eventBus.post(messageEvent);
   if (currentChattingConvid == null
       || !currentChattingConvid.equals(message.getConversationId())) {
     chatManagerAdapter.shouldShowNotification(context, selfId, conversation, message);
   }
 }
示例#2
0
 /**
  * 请在登录之后,进入 MainActivity 之前,调用此函数,因为此时可以拿到当前登录用户的 ID
  *
  * @param userId 应用用户系统当前用户的 userId
  */
 public void setupManagerWithUserId(String userId) {
   this.selfId = userId;
   roomsTable = RoomsTable.getInstanceByUserId(userId);
 }