Search in sources :

Example 1 with ConversationRunnables

use of com.applozic.mobicomkit.ConversationRunnables in project Applozic-Android-SDK by AppLozic.

the class SyncCallService method syncMessageMetadataUpdate.

public synchronized void syncMessageMetadataUpdate(String key, boolean isFromFcm, Message message) {
    Integer groupId = null;
    if (message != null) {
        if (message.getGroupId() != null) {
            groupId = message.getGroupId();
            Channel channel = ChannelService.getInstance(context).getChannel(groupId);
            if (channel != null && channel.isOpenGroup()) {
                if (message.hasAttachment()) {
                    messageDatabaseService.replaceExistingMessage(message);
                }
                BroadcastService.updateMessageMetadata(context, message.getKeyString(), BroadcastService.INTENT_ACTIONS.MESSAGE_METADATA_UPDATE.toString(), null, groupId, true, message.getMetadata());
                return;
            }
        }
    }
    if (!TextUtils.isEmpty(key) && mobiComMessageService.isMessagePresent(key)) {
        if (Utils.isDeviceInIdleState(context)) {
            new ConversationRunnables(context, null, false, false, true);
        } else {
            Utils.printLog(context, TAG, "Syncing updated message metadata from " + (isFromFcm ? "FCM" : "MQTT") + " for message key : " + key);
            ConversationWorker.enqueueWorkMessageMetadataUpdate(context);
        }
    }
}
Also used : Channel(com.applozic.mobicommons.people.channel.Channel) ConversationRunnables(com.applozic.mobicomkit.ConversationRunnables)

Aggregations

ConversationRunnables (com.applozic.mobicomkit.ConversationRunnables)1 Channel (com.applozic.mobicommons.people.channel.Channel)1