use of com.vodafone360.people.datatypes.PushChatMessageEvent in project 360-Engine-for-Android by 360.
the class HessianDecoder method parsePushPayload.
private void parsePushPayload(RpgPushMessage msg, List<BaseDataType> list) {
// convert push msg type string to PushMsgType
PushMessageTypes type = msg.mType;
EngineId engineId = EngineId.UNDEFINED;
if (type != null) {
switch(type) {
case CHAT_MESSAGE:
LogUtils.logV("Parse incomming chat_message");
engineId = EngineId.PRESENCE_ENGINE;
list.add(new PushChatMessageEvent(msg, engineId));
return;
case AVAILABILITY_STATE_CHANGE:
LogUtils.logV("Parse availability state change:");
engineId = EngineId.PRESENCE_ENGINE;
list.add(PushAvailabilityEvent.createPushEvent(msg, engineId));
return;
case START_CONVERSATION:
LogUtils.logV("Parse new conversation event:");
engineId = EngineId.PRESENCE_ENGINE;
list.add(new PushChatConversationEvent(msg, engineId));
return;
case CLOSED_CONVERSATION:
LogUtils.logV("Parse closed conversation event:");
engineId = EngineId.PRESENCE_ENGINE;
list.add(new PushClosedConversationEvent(msg, engineId));
return;
case CONVERSATION_END:
break;
// API events create push message type
case PROFILE_CHANGE:
engineId = EngineId.SYNCME_ENGINE;
break;
case CONTACTS_CHANGE:
engineId = EngineId.CONTACT_SYNC_ENGINE;
break;
case TIMELINE_ACTIVITY_CHANGE:
case STATUS_ACTIVITY_CHANGE:
engineId = EngineId.ACTIVITIES_ENGINE;
break;
case FRIENDSHIP_REQUEST_RECEIVED:
break;
case IDENTITY_CHANGE:
engineId = EngineId.IDENTITIES_ENGINE;
break;
case IDENTITY_NETWORK_CHANGE:
engineId = EngineId.IDENTITIES_ENGINE;
break;
case SYSTEM_NOTIFICATION:
LogUtils.logE("SYSTEM_NOTIFICATION push msg:" + msg.mHash);
list.add(SystemNotification.createFromHashtable(msg.mHash, engineId));
return;
default:
}
list.add(PushEvent.createPushEvent(msg, engineId));
}
}
use of com.vodafone360.people.datatypes.PushChatMessageEvent in project 360-Engine-for-Android by 360.
the class PresenceEngine method handlePushEvent.
private void handlePushEvent(PushEvent event) {
switch(event.mMessageType) {
case AVAILABILITY_STATE_CHANGE:
PushAvailabilityEvent pa = (PushAvailabilityEvent) event;
updatePresenceDatabase(pa.mChanges);
break;
case CHAT_MESSAGE:
PushChatMessageEvent pc = (PushChatMessageEvent) event;
// update the DB with an incoming message
updateChatDatabase(pc.getChatMsg(), TimelineSummaryItem.Type.INCOMING);
break;
case CLOSED_CONVERSATION:
PushClosedConversationEvent pcc = (PushClosedConversationEvent) event;
// delete the conversation in DB
if (pcc.getConversation() != null) {
ChatDbUtils.deleteConversationById(pcc.getConversation(), mDbHelper);
}
break;
default:
LogUtils.logE("PresenceEngine.handleServerResponse():" + " push message type was not recognized:" + event.getType());
}
}
Aggregations