use of androidx.core.app.NotificationManagerCompat in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationFragment method onResume.
@Override
public void onResume() {
super.onResume();
if (MobiComUserPreference.getInstance(getActivity()).isChannelDeleted()) {
MobiComUserPreference.getInstance(getActivity()).setDeleteChannel(false);
if (getActivity().getSupportFragmentManager() != null) {
getActivity().getSupportFragmentManager().popBackStack();
}
return;
}
((ConversationActivity) getActivity()).setChildFragmentLayoutBGToTransparent();
if (contact != null || channel != null) {
BroadcastService.currentUserId = contact != null ? contact.getContactIds() : String.valueOf(channel.getKey());
BroadcastService.currentConversationId = currentConversationId;
if (BroadcastService.currentUserId != null) {
NotificationManagerCompat nMgr = NotificationManagerCompat.from(getActivity());
if (ApplozicClient.getInstance(getActivity()).isNotificationStacking()) {
nMgr.cancel(NotificationService.NOTIFICATION_ID);
} else {
if (contact != null && !TextUtils.isEmpty(contact.getContactIds())) {
nMgr.cancel(contact.getContactIds().hashCode());
}
if (channel != null) {
nMgr.cancel(String.valueOf(channel.getKey()).hashCode());
}
}
}
if (downloadConversation != null) {
downloadConversation.cancel(true);
}
if (channel != null) {
Channel newChannel = ChannelService.getInstance(getActivity()).getChannelByChannelKey(channel.getKey());
if (newChannel != null && newChannel.getType() != null && Channel.GroupType.OPEN.getValue().equals(newChannel.getType())) {
MobiComUserPreference.getInstance(getActivity()).setNewMessageFlag(true);
}
enableOrDisableChannel(newChannel);
if (ChannelService.isUpdateTitle) {
updateChannelSubTitle(newChannel);
ChannelService.isUpdateTitle = false;
}
}
if (messageList.isEmpty()) {
loadConversation(contact, channel, currentConversationId, null);
} else if (MobiComUserPreference.getInstance(getContext()).getNewMessageFlag()) {
MobiComUserPreference.getInstance(getContext()).setNewMessageFlag(false);
loadNewMessageOnResume(contact, channel, currentConversationId);
} else {
Applozic.subscribeToTyping(getContext(), channel, contact);
}
if (SyncCallService.refreshView) {
SyncCallService.refreshView = false;
}
}
swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
public void onRefresh() {
downloadConversation = new DownloadConversation(recyclerView, false, 1, 1, 1, contact, channel, currentConversationId);
AlTask.execute(downloadConversation);
}
});
activateOrDeactivateChat();
}
Aggregations