本文整理汇总了Java中com.quickblox.chat.model.QBChatMessage.getDialogId方法的典型用法代码示例。如果您正苦于以下问题:Java QBChatMessage.getDialogId方法的具体用法?Java QBChatMessage.getDialogId怎么用?Java QBChatMessage.getDialogId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.quickblox.chat.model.QBChatMessage
的用法示例。
在下文中一共展示了QBChatMessage.getDialogId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkForSendingNotification
import com.quickblox.chat.model.QBChatMessage; //导入方法依赖的package包/类
protected void checkForSendingNotification(boolean ownMessage, QBChatMessage qbChatMessage, QMUser user,
boolean isPrivateChat) {
String dialogId = qbChatMessage.getDialogId();
if (qbChatMessage.getId() == null || dialogId == null) {
return;
}
if (!ownMessage) {
sendNotificationBroadcast(QBServiceConsts.GOT_CHAT_MESSAGE, qbChatMessage, user, dialogId, isPrivateChat);
}
if (currentDialog != null) {
if (!ownMessage && !currentDialog.getDialogId().equals(dialogId)) {
sendNotificationBroadcast(QBServiceConsts.GOT_CHAT_MESSAGE_LOCAL, qbChatMessage, user, dialogId, isPrivateChat);
}
} else if (!ownMessage) {
sendNotificationBroadcast(QBServiceConsts.GOT_CHAT_MESSAGE_LOCAL, qbChatMessage, user, dialogId,
isPrivateChat);
}
}
示例2: updateGroupDialogByNotification
import com.quickblox.chat.model.QBChatMessage; //导入方法依赖的package包/类
private void updateGroupDialogByNotification(QBChatMessage qbChatMessage) {
String dialogId = qbChatMessage.getDialogId();
QBChatDialog qbDialog = dataManager.getQBChatDialogDataManager().getByDialogId(dialogId);
if (qbDialog == null) {
qbDialog = ChatNotificationUtils.parseDialogFromQBMessage(context, qbChatMessage, QBDialogType.GROUP);
}
ChatNotificationUtils.updateDialogFromQBMessage(context, dataManager, qbChatMessage, qbDialog);
DbUtils.saveDialogToCache(dataManager, qbDialog);
notifyUpdatingDialog();
}
示例3: friendRequestMessageReceived
import com.quickblox.chat.model.QBChatMessage; //导入方法依赖的package包/类
private void friendRequestMessageReceived(QBChatMessage qbChatMessage, DialogNotification.Type notificationType) {
String dialogId = qbChatMessage.getDialogId();
Message message = parseReceivedMessage(qbChatMessage);
if (!QMUserService.getInstance().getUserCache().exists((long) qbChatMessage.getSenderId())) {
QBRestHelper.loadAndSaveUser(qbChatMessage.getSenderId());
}
DialogNotification dialogNotification = ChatUtils.convertMessageToDialogNotification(message);
dialogNotification.setType(notificationType);
QBChatDialog chatDialog = dataManager.getQBChatDialogDataManager().getByDialogId(dialogId);
if (chatDialog == null) {
QBChatDialog newChatDialog = ChatNotificationUtils.parseDialogFromQBMessage(context, qbChatMessage, QBDialogType.PRIVATE);
ArrayList<Integer> occupantsIdsList = ChatUtils.createOccupantsIdsFromPrivateMessage(chatCreator.getId(), qbChatMessage.getSenderId());
newChatDialog.setOccupantsIds(occupantsIdsList);
DbUtils.saveDialogToCache(dataManager, newChatDialog, false);
}
DialogOccupant dialogOccupant = dataManager.getDialogOccupantDataManager().getDialogOccupant(dialogId, qbChatMessage.getSenderId());
DbUtils.saveDialogNotificationToCache(context, dataManager, dialogOccupant, qbChatMessage, false);
if (dialogOccupant != null) {
checkForSendingNotification(false, qbChatMessage, dialogOccupant.getUser(), true);
}
}
示例4: parseDialogFromQBMessage
import com.quickblox.chat.model.QBChatMessage; //导入方法依赖的package包/类
public static QBChatDialog parseDialogFromQBMessage(Context context, QBChatMessage qbChatMessage, QBDialogType qbDialogType) {
String dialogId = qbChatMessage.getDialogId();
String currentOccupantsIdsString = (String) qbChatMessage.getProperty(PROPERTY_ROOM_CURRENT_OCCUPANTS_IDS);
String addedOccupantsIdsString = (String) qbChatMessage.getProperty(PROPERTY_ROOM_ADDED_OCCUPANTS_IDS);
String dialogName = (String) qbChatMessage.getProperty(PROPERTY_ROOM_NAME);
String photoUrl = (String) qbChatMessage.getProperty(PROPERTY_ROOM_PHOTO);
long dateSent = ChatUtils.getMessageDateSent(qbChatMessage);
String updatedAtString = (String) qbChatMessage.getProperty(PROPERTY_ROOM_UPDATED_AT);
String roomJid = ChatUtils.getRoomJid(dialogId);
QBChatDialog qbDialog = new QBChatDialog(dialogId);
qbDialog.setRoomJid(roomJid);
qbDialog.setPhoto(photoUrl);
qbDialog.setType(qbDialogType);
qbDialog.setName(dialogName);
if (!TextUtils.isEmpty(currentOccupantsIdsString)) {
qbDialog.setOccupantsIds((ArrayList<Integer>) ChatUtils.getOccupantsIdsListFromString(currentOccupantsIdsString));
} else if (!TextUtils.isEmpty(addedOccupantsIdsString)) {
qbDialog.setOccupantsIds((ArrayList<Integer>) ChatUtils.getOccupantsIdsListFromString(addedOccupantsIdsString));
}
if (!CollectionUtils.isEmpty(qbChatMessage.getAttachments())) {
qbDialog.setLastMessage(context.getString(R.string.dlg_attached_last_message));
} else if (!TextUtils.isEmpty(qbChatMessage.getBody())) {
qbDialog.setLastMessage(qbChatMessage.getBody());
}
qbDialog.setLastMessageDateSent(dateSent);
qbDialog.setUnreadMessageCount(ConstsCore.ZERO_INT_VALUE);
if (!TextUtils.isEmpty(updatedAtString)) {
qbDialog.setUpdatedAt(new Date(Long.parseLong(updatedAtString)));
}
return qbDialog;
}
示例5: parseReceivedMessage
import com.quickblox.chat.model.QBChatMessage; //导入方法依赖的package包/类
protected Message parseReceivedMessage(QBChatMessage qbChatMessage) {
long dateSent = ChatUtils.getMessageDateSent(qbChatMessage);
String attachUrl = ChatUtils.getAttachUrlIfExists(qbChatMessage);
String dialogId = qbChatMessage.getDialogId();
Message message = new Message();
message.setMessageId(qbChatMessage.getId());
message.setBody(qbChatMessage.getBody());
message.setCreatedDate(dateSent);
message.setState(State.DELIVERED);
DialogOccupant dialogOccupant = dataManager.getDialogOccupantDataManager().getDialogOccupant(dialogId, qbChatMessage.getSenderId());
if (dialogOccupant == null) {
dialogOccupant = new DialogOccupant();
QBChatDialog chatDialog = dataManager.getQBChatDialogDataManager().getByDialogId(dialogId);
if (chatDialog != null) {
dialogOccupant.setDialog(DialogTransformUtils.createLocalDialog(chatDialog));
}
QMUser user = QMUserService.getInstance().getUserCache().get((long) qbChatMessage.getSenderId());
if (user != null) {
dialogOccupant.setUser(user);
}
}
message.setDialogOccupant(dialogOccupant);
if (qbChatMessage.getAttachments() != null && !qbChatMessage.getAttachments().isEmpty()) {
Attachment attachment = new Attachment();
// if (getAttachmentType(qbChatMessage.getAttachments()).equalsIgnoreCase(Attachment.Type.LOCATION.toString())) {
// attachment.setType(Attachment.Type.LOCATION);
// } else {
// attachment.setType(Attachment.Type.IMAGE);
// }
if (getAttachmentType(qbChatMessage.getAttachments()).equalsIgnoreCase(QBAttachment.PHOTO_TYPE)) {
attachment.setType(Attachment.Type.IMAGE);
} else {
attachment.setType(Attachment.Type.valueOf(getAttachmentType(qbChatMessage.getAttachments()).toUpperCase()));
}
attachment.setRemoteUrl(attachUrl);
message.setAttachment(attachment);
}
return message;
}