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;
}
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;
}
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());
}
}
}
}
Aggregations