Search in sources :

Example 16 with ChannelFeed

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

the class ChannelService method createChannel.

public synchronized Channel createChannel(final ChannelInfo channelInfo) {
    Channel channel = null;
    ChannelFeed channelFeed = channelClientService.createChannel(channelInfo);
    if (channelFeed != null) {
        ChannelFeed[] channelFeeds = new ChannelFeed[1];
        channelFeeds[0] = channelFeed;
        processChannelFeedList(channelFeeds, true);
        channel = getChannel(channelFeed);
    }
    return channel;
}
Also used : Channel(com.applozic.mobicommons.people.channel.Channel) SyncChannelFeed(com.applozic.mobicomkit.sync.SyncChannelFeed) ChannelFeed(com.applozic.mobicomkit.feed.ChannelFeed)

Example 17 with ChannelFeed

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

the class ChannelService method createChannelWithResponse.

public ChannelFeedApiResponse createChannelWithResponse(ChannelInfo channelInfo) {
    ChannelFeedApiResponse channelFeedApiResponse = channelClientService.createChannelWithResponse(channelInfo);
    if (channelFeedApiResponse == null) {
        return null;
    }
    if (channelFeedApiResponse.isSuccess()) {
        ChannelFeed channelFeed = channelFeedApiResponse.getResponse();
        if (channelFeed != null) {
            ChannelFeed[] channelFeeds = new ChannelFeed[1];
            channelFeeds[0] = channelFeed;
            processChannelFeedList(channelFeeds, true);
        }
    }
    return channelFeedApiResponse;
}
Also used : SyncChannelFeed(com.applozic.mobicomkit.sync.SyncChannelFeed) ChannelFeed(com.applozic.mobicomkit.feed.ChannelFeed) ChannelFeedApiResponse(com.applozic.mobicomkit.feed.ChannelFeedApiResponse)

Example 18 with ChannelFeed

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

the class ChannelService method processChannelFeedList.

public void processChannelFeedList(ChannelFeed[] channelFeeds, boolean isUserDetails) {
    if (channelFeeds != null && channelFeeds.length > 0) {
        for (ChannelFeed channelFeed : channelFeeds) {
            Set<String> memberUserIds = channelFeed.getMembersName();
            Set<String> userIds = new HashSet<>();
            Channel channel = getChannel(channelFeed);
            if (channelDatabaseService.isChannelPresent(channel.getKey())) {
                channelDatabaseService.updateChannel(channel);
            } else {
                channelDatabaseService.addChannel(channel);
            }
            if (channelFeed.getConversationPxy() != null) {
                channelFeed.getConversationPxy().setGroupId(channelFeed.getId());
                ConversationService.getInstance(context).addConversation(channelFeed.getConversationPxy());
            }
            if (memberUserIds != null && memberUserIds.size() > 0) {
                for (String userId : memberUserIds) {
                    ChannelUserMapper channelUserMapper = new ChannelUserMapper(channelFeed.getId(), userId);
                    if (channelDatabaseService.isChannelUserPresent(channelFeed.getId(), userId)) {
                        channelDatabaseService.updateChannelUserMapper(channelUserMapper);
                    } else {
                        channelDatabaseService.addChannelUserMapper(channelUserMapper);
                    }
                }
            }
            if (channelFeed.getGroupUsers() != null && channelFeed.getGroupUsers().size() > 0) {
                for (ChannelUsersFeed channelUsers : channelFeed.getGroupUsers()) {
                    if (channelUsers.getRole() != null) {
                        channelDatabaseService.updateRoleInChannelUserMapper(channelFeed.getId(), channelUsers.getUserId(), channelUsers.getRole());
                    }
                }
            }
            if (isUserDetails) {
                userService.processUserDetail(channelFeed.getUsers());
            }
        }
    }
}
Also used : ChannelUsersFeed(com.applozic.mobicomkit.feed.ChannelUsersFeed) Channel(com.applozic.mobicommons.people.channel.Channel) SyncChannelFeed(com.applozic.mobicomkit.sync.SyncChannelFeed) ChannelFeed(com.applozic.mobicomkit.feed.ChannelFeed) ChannelUserMapper(com.applozic.mobicommons.people.channel.ChannelUserMapper) HashSet(java.util.HashSet)

Aggregations

ChannelFeed (com.applozic.mobicomkit.feed.ChannelFeed)18 SyncChannelFeed (com.applozic.mobicomkit.sync.SyncChannelFeed)14 ChannelFeedApiResponse (com.applozic.mobicomkit.feed.ChannelFeedApiResponse)7 Channel (com.applozic.mobicommons.people.channel.Channel)7 MultipleChannelFeedApiResponse (com.applozic.mobicomkit.MultipleChannelFeedApiResponse)5 HashSet (java.util.HashSet)3 ChannelFeedListResponse (com.applozic.mobicomkit.feed.ChannelFeedListResponse)2 ChannelUsersFeed (com.applozic.mobicomkit.feed.ChannelUsersFeed)2 ChannelUserMapper (com.applozic.mobicommons.people.channel.ChannelUserMapper)2 Intent (android.content.Intent)1 MobiComUserPreference (com.applozic.mobicomkit.api.account.user.MobiComUserPreference)1 UserDetail (com.applozic.mobicomkit.api.account.user.UserDetail)1 FileClientService (com.applozic.mobicomkit.api.attachment.FileClientService)1 ChannelInfo (com.applozic.mobicomkit.api.people.ChannelInfo)1 ApplozicException (com.applozic.mobicomkit.exception.ApplozicException)1 ErrorResponseFeed (com.applozic.mobicomkit.feed.ErrorResponseFeed)1 AnnotationExclusionStrategy (com.applozic.mobicommons.json.AnnotationExclusionStrategy)1 ArrayAdapterFactory (com.applozic.mobicommons.json.ArrayAdapterFactory)1 Conversation (com.applozic.mobicommons.people.channel.Conversation)1 Contact (com.applozic.mobicommons.people.contact.Contact)1