Search in sources :

Example 1 with PushAvailabilityEvent

use of com.vodafone360.people.datatypes.PushAvailabilityEvent 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());
    }
}
Also used : PushAvailabilityEvent(com.vodafone360.people.datatypes.PushAvailabilityEvent) PushClosedConversationEvent(com.vodafone360.people.datatypes.PushClosedConversationEvent) PushChatMessageEvent(com.vodafone360.people.datatypes.PushChatMessageEvent)

Aggregations

PushAvailabilityEvent (com.vodafone360.people.datatypes.PushAvailabilityEvent)1 PushChatMessageEvent (com.vodafone360.people.datatypes.PushChatMessageEvent)1 PushClosedConversationEvent (com.vodafone360.people.datatypes.PushClosedConversationEvent)1