Search in sources :

Example 1 with ChannelFeed

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

the class ChannelClientService method getChannelInfoByParameters.

public ChannelFeed getChannelInfoByParameters(String parameters) {
    String response = "";
    try {
        response = httpRequestUtils.getResponse(getChannelInfoUrl() + "?" + parameters, "application/json", "application/json");
        ChannelFeedApiResponse channelFeedApiResponse = (ChannelFeedApiResponse) GsonUtils.getObjectFromJson(response, ChannelFeedApiResponse.class);
        Utils.printLog(context, TAG, "Channel info response  is :" + response);
        if (channelFeedApiResponse != null && channelFeedApiResponse.isSuccess()) {
            ChannelFeed channelFeed = channelFeedApiResponse.getResponse();
            return channelFeed;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
Also used : SyncChannelFeed(com.applozic.mobicomkit.sync.SyncChannelFeed) ChannelFeed(com.applozic.mobicomkit.feed.ChannelFeed) MultipleChannelFeedApiResponse(com.applozic.mobicomkit.MultipleChannelFeedApiResponse) ChannelFeedApiResponse(com.applozic.mobicomkit.feed.ChannelFeedApiResponse)

Example 2 with ChannelFeed

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

the class ChannelClientService method getMembersFromContactGroup.

public ChannelFeed getMembersFromContactGroup(String contactGroupId) {
    String response;
    if (!TextUtils.isEmpty(contactGroupId)) {
        String url = String.format(getMembersFromContactGroupUrl(), contactGroupId);
        response = httpRequestUtils.getResponse(url, "application/json", "application/json");
        ChannelFeedApiResponse channelFeedApiResponse = (ChannelFeedApiResponse) GsonUtils.getObjectFromJson(response, ChannelFeedApiResponse.class);
        if (channelFeedApiResponse != null && channelFeedApiResponse.isSuccess()) {
            ChannelFeed channelFeed = channelFeedApiResponse.getResponse();
            return channelFeed;
        }
    }
    return null;
}
Also used : SyncChannelFeed(com.applozic.mobicomkit.sync.SyncChannelFeed) ChannelFeed(com.applozic.mobicomkit.feed.ChannelFeed) MultipleChannelFeedApiResponse(com.applozic.mobicomkit.MultipleChannelFeedApiResponse) ChannelFeedApiResponse(com.applozic.mobicomkit.feed.ChannelFeedApiResponse)

Example 3 with ChannelFeed

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

the class ChannelClientService method createMultipleChannels.

public List<ChannelFeed> createMultipleChannels(List<ChannelInfo> channels) {
    List<ChannelFeed> channelFeeds = null;
    try {
        String jsonFromObject = GsonUtils.getJsonFromObject(channels, new TypeToken<List<ChannelInfo>>() {
        }.getType());
        String createChannelResponse = httpRequestUtils.postData(getCreateMultipleChannelUrl(), "application/json", "application/json", jsonFromObject);
        Utils.printLog(context, TAG, "Create Multiple channel Response :" + createChannelResponse);
        MultipleChannelFeedApiResponse channelFeedApiResponse = (MultipleChannelFeedApiResponse) GsonUtils.getObjectFromJson(createChannelResponse, MultipleChannelFeedApiResponse.class);
        if (channelFeedApiResponse != null && channelFeedApiResponse.isSuccess()) {
            channelFeeds = channelFeedApiResponse.getResponse();
        }
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
    return channelFeeds;
}
Also used : TypeToken(com.google.gson.reflect.TypeToken) ChannelInfo(com.applozic.mobicomkit.api.people.ChannelInfo) SyncChannelFeed(com.applozic.mobicomkit.sync.SyncChannelFeed) ChannelFeed(com.applozic.mobicomkit.feed.ChannelFeed) MultipleChannelFeedApiResponse(com.applozic.mobicomkit.MultipleChannelFeedApiResponse)

Example 4 with ChannelFeed

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

the class ChannelService method getMembersFromContactGroupList.

public ChannelFeed[] getMembersFromContactGroupList(List<String> groupIdList, List<String> groupNames, String groupType) {
    List<ChannelFeed> channelFeedList;
    ChannelFeedListResponse channelFeedListResponse = channelClientService.getMemebersFromContactGroupIds(groupIdList, groupNames, groupType);
    if (channelFeedListResponse != null && channelFeedListResponse.getStatus().equals(ChannelFeedListResponse.SUCCESS)) {
        channelFeedList = channelFeedListResponse.getResponse();
        processChannelFeedList(channelFeedList.toArray(new ChannelFeed[channelFeedList.size()]), false);
        return channelFeedList.toArray(new ChannelFeed[channelFeedList.size()]);
    }
    return null;
}
Also used : ChannelFeedListResponse(com.applozic.mobicomkit.feed.ChannelFeedListResponse) SyncChannelFeed(com.applozic.mobicomkit.sync.SyncChannelFeed) ChannelFeed(com.applozic.mobicomkit.feed.ChannelFeed)

Example 5 with ChannelFeed

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

the class ChannelService method getChannelInfo.

public Channel getChannelInfo(String clientGroupId) {
    if (TextUtils.isEmpty(clientGroupId)) {
        return null;
    }
    Channel channel = channelDatabaseService.getChannelByClientGroupId(clientGroupId);
    if (channel == null) {
        ChannelFeed channelFeed = channelClientService.getChannelInfo(clientGroupId);
        if (channelFeed != null) {
            channelFeed.setUnreadCount(0);
            ChannelFeed[] channelFeeds = new ChannelFeed[1];
            channelFeeds[0] = channelFeed;
            processChannelFeedList(channelFeeds, false);
            channel = getChannel(channelFeed);
            return channel;
        }
    }
    return channel;
}
Also used : Channel(com.applozic.mobicommons.people.channel.Channel) SyncChannelFeed(com.applozic.mobicomkit.sync.SyncChannelFeed) ChannelFeed(com.applozic.mobicomkit.feed.ChannelFeed)

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