use of com.applozic.mobicomkit.feed.ChannelFeed in project Applozic-Android-SDK by AppLozic.
the class ConversationService method createConversation.
public synchronized Integer createConversation(Conversation conversation) {
ChannelFeed channelFeed = conversationClientService.createConversation(conversation);
if (channelFeed != null) {
if (conversation.getSupportIds() != null) {
ChannelFeed[] channelFeeds = new ChannelFeed[1];
channelFeeds[0] = channelFeed;
ChannelService.getInstance(context).processChannelFeedList(channelFeeds, false);
;
}
if (channelFeed.getConversationPxy() != null) {
addConversation(channelFeed.getConversationPxy());
return channelFeed.getConversationPxy().getId();
}
}
return null;
}
use of com.applozic.mobicomkit.feed.ChannelFeed in project Applozic-Android-SDK by AppLozic.
the class ChannelClientService method createChannel.
public ChannelFeed createChannel(ChannelInfo channelInfo) {
ChannelFeed channelFeed = null;
try {
String jsonFromObject = GsonUtils.getJsonFromObject(channelInfo, channelInfo.getClass());
String createChannelResponse = httpRequestUtils.postData(getCreateChannelUrl(), "application/json", "application/json", jsonFromObject);
Utils.printLog(context, TAG, "Create channel Response :" + createChannelResponse);
ChannelFeedApiResponse channelFeedApiResponse = (ChannelFeedApiResponse) GsonUtils.getObjectFromJson(createChannelResponse, ChannelFeedApiResponse.class);
if (channelFeedApiResponse != null && channelFeedApiResponse.isSuccess()) {
channelFeed = channelFeedApiResponse.getResponse();
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return channelFeed;
}
use of com.applozic.mobicomkit.feed.ChannelFeed in project Applozic-Android-SDK by AppLozic.
the class ChannelClientService method getMembersFromContactGroupOfType.
public ChannelFeed getMembersFromContactGroupOfType(String contactGroupId, String groupType) {
String response;
if (!TextUtils.isEmpty(contactGroupId) && !TextUtils.isEmpty(groupType)) {
String url = String.format(getMembersFromContactGroupOfTypeUrl() + "?" + GROUPTYPE + "=" + groupType, 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;
}
use of com.applozic.mobicomkit.feed.ChannelFeed in project Applozic-Android-SDK by AppLozic.
the class ChannelService method processChannelList.
public synchronized void processChannelList(List<ChannelFeed> channelFeedList) {
if (channelFeedList != null && channelFeedList.size() > 0) {
for (ChannelFeed channelFeed : channelFeedList) {
Set<String> memberUserIds = channelFeed.getMembersName();
Set<String> userIds = new HashSet<>();
Channel channel = getChannel(channelFeed);
if (channelDatabaseService.isChannelPresent(channel.getKey())) {
channelDatabaseService.updateChannel(channel);
channelDatabaseService.deleteChannelUserMappers(channel.getKey());
} else {
channelDatabaseService.addChannel(channel);
}
if (memberUserIds != null && memberUserIds.size() > 0) {
for (String userId : memberUserIds) {
ChannelUserMapper channelUserMapper = new ChannelUserMapper(channelFeed.getId(), userId);
channelDatabaseService.addChannelUserMapper(channelUserMapper);
if (!baseContactService.isContactExists(userId)) {
userIds.add(userId);
}
}
if (userIds != null && userIds.size() > 0) {
userService.processUserDetailsByUserIds(userIds);
}
}
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());
}
}
}
}
}
}
use of com.applozic.mobicomkit.feed.ChannelFeed in project Applozic-Android-SDK by AppLozic.
the class ChannelService method createGroupOfTwo.
public Channel createGroupOfTwo(ChannelInfo channelInfo) {
if (channelInfo == null) {
return null;
}
if (!TextUtils.isEmpty(channelInfo.getClientGroupId())) {
Channel channel = channelDatabaseService.getChannelByClientGroupId(channelInfo.getClientGroupId());
if (channel != null) {
return channel;
} else {
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 getChannel(channelFeed);
}
} else {
ChannelFeed channelFeed = channelClientService.getChannelInfo(channelInfo.getClientGroupId());
if (channelFeed != null) {
ChannelFeed[] channelFeeds = new ChannelFeed[1];
channelFeeds[0] = channelFeed;
processChannelFeedList(channelFeeds, false);
return getChannel(channelFeed);
}
}
}
}
return null;
}
Aggregations