Search in sources :

Example 1 with PushMessageTypes

use of com.vodafone360.people.service.io.rpg.PushMessageTypes 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));
    }
}
Also used : EngineId(com.vodafone360.people.engine.EngineManager.EngineId) PushClosedConversationEvent(com.vodafone360.people.datatypes.PushClosedConversationEvent) PushChatConversationEvent(com.vodafone360.people.datatypes.PushChatConversationEvent) PushMessageTypes(com.vodafone360.people.service.io.rpg.PushMessageTypes) PushChatMessageEvent(com.vodafone360.people.datatypes.PushChatMessageEvent)

Aggregations

PushChatConversationEvent (com.vodafone360.people.datatypes.PushChatConversationEvent)1 PushChatMessageEvent (com.vodafone360.people.datatypes.PushChatMessageEvent)1 PushClosedConversationEvent (com.vodafone360.people.datatypes.PushClosedConversationEvent)1 EngineId (com.vodafone360.people.engine.EngineManager.EngineId)1 PushMessageTypes (com.vodafone360.people.service.io.rpg.PushMessageTypes)1