use of com.applozic.mobicomkit.contact.AppContactService in project Applozic-Android-SDK by AppLozic.
the class VideoCallNotificationHelper method buildVideoCallNotification.
public static void buildVideoCallNotification(Context context, Message message, int index) {
Map<String, String> metaDataMap = message.getMetadata();
Contact contact = new AppContactService(context).getContactById(message.getContactIds());
String audioORVideoCallPrefix = Boolean.valueOf(metaDataMap.get(CALL_AUDIO_ONLY)) ? "audio call " : "video call ";
if (metaDataMap.get(VideoCallNotificationHelper.MSG_TYPE).equals(VideoCallNotificationHelper.CALL_MISSED)) {
Message message1 = new Message(message);
message1.setMessage("You missed " + audioORVideoCallPrefix + " from " + contact.getDisplayName());
BroadcastService.sendNotificationBroadcast(context, message1, index);
}
}
use of com.applozic.mobicomkit.contact.AppContactService in project Applozic-Android-SDK by AppLozic.
the class VideoCallNotificationHelper method init.
public void init() {
this.conversationService = new MobiComConversationService(context);
this.baseContactService = new AppContactService(context);
}
use of com.applozic.mobicomkit.contact.AppContactService in project Applozic-Android-SDK by AppLozic.
the class UserProfileFragment method onCreate.
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
baseContactService = new AppContactService(getActivity());
final Context context = getActivity().getApplicationContext();
contactImageLoader = new ImageLoader(context, ImageUtils.getLargestScreenDimension((Activity) getContext())) {
@Override
protected Bitmap processBitmap(Object data) {
return baseContactService.downloadContactImage(context, (Contact) data);
}
};
contactImageLoader.setLoadingImage(R.drawable.applozic_ic_contact_picture_180_holo_light);
contactImageLoader.addImageCache((getActivity()).getSupportFragmentManager(), 0.1f);
contactImageLoader.setImageFadeIn(false);
}
use of com.applozic.mobicomkit.contact.AppContactService in project Applozic-Android-SDK by AppLozic.
the class MentionHelper method getMentionsListForChannel.
@NonNull
public static List<Mention> getMentionsListForChannel(Context context, Integer channelKey) {
ChannelDatabaseService channelDatabaseService = ChannelDatabaseService.getInstance(context);
List<ChannelUserMapper> channelUserMapperList = channelDatabaseService.getChannelUserList(channelKey);
if (channelUserMapperList == null) {
return new ArrayList<>();
}
List<Mention> mentionUsersList = new ArrayList<>();
AppContactService appContactService = new AppContactService(context);
String currentUserId = MobiComUserPreference.getInstance(context).getUserId();
for (ChannelUserMapper channelUserMapper : channelUserMapperList) {
Contact contact = appContactService.getContactById(channelUserMapper.getUserKey());
if (channelUserMapper.getUserKey().equals(currentUserId)) {
continue;
}
if (contact != null && !TextUtils.isEmpty(contact.getUserId())) {
mentionUsersList.add(new Mention(contact.getUserId(), contact.getDisplayName(), !TextUtils.isEmpty(contact.getLocalImageUrl()) ? contact.getLocalImageUrl() : contact.getImageURL()));
} else {
mentionUsersList.add(new Mention(channelUserMapper.getUserKey()));
}
}
return mentionUsersList;
}
use of com.applozic.mobicomkit.contact.AppContactService in project Applozic-Android-SDK by AppLozic.
the class ApplozicConversation method markAsRead.
/**
* Mark a conversation as read. Either one of the <i>userId</i> or the <i>groupId</i> can be null.
*
* @param pairedMessageKey not used. pass null
* @param userId for one-to-one conversation
* @param groupId for group conversation
*/
public static void markAsRead(@NonNull Context context, @Nullable String pairedMessageKey, @Nullable String userId, @Nullable Integer groupId) {
try {
int unreadCount = 0;
Contact contact = null;
Channel channel = null;
if (userId != null) {
contact = new AppContactService(context).getContactById(userId);
unreadCount = contact.getUnreadCount();
new MessageDatabaseService(context).updateReadStatusForContact(userId);
} else if (groupId != null && groupId != 0) {
channel = ChannelService.getInstance(context).getChannelByChannelKey(groupId);
unreadCount = channel.getUnreadCount();
new MessageDatabaseService(context).updateReadStatusForChannel(String.valueOf(groupId));
}
UserWorker.enqueueWork(context, null, contact, channel, pairedMessageKey, unreadCount, false);
} catch (Exception exception) {
exception.printStackTrace();
}
}
Aggregations