use of com.applozic.mobicommons.people.channel.Channel 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());
}
}
}
}
use of com.applozic.mobicommons.people.channel.Channel in project Applozic-Android-SDK by AppLozic.
the class NotificationIntentService method onHandleWork.
@Override
protected void onHandleWork(@NonNull Intent intent) {
if (intent != null) {
final String action = intent.getAction();
if (ACTION_AL_NOTIFICATION.equals(action)) {
String messageKey = intent.getStringExtra(MobiComKitConstants.AL_MESSAGE_KEY);
Message message = messageDatabaseService.getMessage(messageKey);
if (message != null) {
int notificationId = Utils.getLauncherIcon(getApplicationContext());
final NotificationService notificationService = new NotificationService(notificationId == 0 ? resourceArray[0] : notificationId, NotificationIntentService.this, resourceArray[1], resourceArray[2], resourceArray[3]);
if (MobiComUserPreference.getInstance(NotificationIntentService.this).isLoggedIn()) {
Channel channel = ChannelService.getInstance(NotificationIntentService.this).getChannelInfo(message.getGroupId());
Contact contact = null;
if (message.getConversationId() != null) {
ConversationService.getInstance(NotificationIntentService.this).getConversation(message.getConversationId());
}
if (message.getGroupId() == null) {
contact = appContactService.getContactById(message.getContactIds());
}
if (ApplozicClient.getInstance(NotificationIntentService.this).isNotificationStacking()) {
notificationService.notifyUser(contact, channel, message);
} else {
notificationService.notifyUserForNormalMessage(contact, channel, message);
}
}
}
}
}
}
use of com.applozic.mobicommons.people.channel.Channel in project Applozic-Android-SDK by AppLozic.
the class UserIntentService method onHandleWork.
@Override
protected void onHandleWork(@NonNull Intent intent) {
Integer unreadCount = intent.getIntExtra(UNREAD_COUNT, 0);
boolean singleMessageRead = intent.getBooleanExtra(SINGLE_MESSAGE_READ, false);
Contact contact = (Contact) intent.getSerializableExtra(CONTACT);
Channel channel = (Channel) intent.getSerializableExtra(CHANNEL);
if (unreadCount != 0 || singleMessageRead) {
messageClientService.updateReadStatus(contact, channel);
} else {
String userId = intent.getStringExtra(USER_ID);
if (!TextUtils.isEmpty(userId)) {
SyncCallService.getInstance(UserIntentService.this).processUserStatus(userId);
} else if (intent.getBooleanExtra(USER_LAST_SEEN_AT_STATUS, false)) {
mobiComConversationService.processLastSeenAtStatus();
}
}
}
use of com.applozic.mobicommons.people.channel.Channel in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationFragment method updateTitleForOpenGroup.
public void updateTitleForOpenGroup() {
try {
if (channel != null) {
Channel newChannel = ChannelService.getInstance(getActivity()).getChannelByChannelKey(channel.getKey());
((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(newChannel.getName());
}
updateChannelSubTitle();
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.applozic.mobicommons.people.channel.Channel in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationFragment method updateChannelTitle.
public void updateChannelTitle() {
if (!Channel.GroupType.GROUPOFTWO.getValue().equals(channel.getType())) {
Channel newChannel = ChannelService.getInstance(getActivity()).getChannelByChannelKey(channel.getKey());
if (newChannel != null && !TextUtils.isEmpty(channel.getName()) && !channel.getName().equals(newChannel.getName())) {
title = ChannelUtils.getChannelTitleName(newChannel, MobiComUserPreference.getInstance(getActivity()).getUserId());
channel = newChannel;
((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(title);
}
}
}
Aggregations