Search in sources :

Example 6 with AppContactService

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);
    }
}
Also used : AppContactService(com.applozic.mobicomkit.contact.AppContactService) Message(com.applozic.mobicomkit.api.conversation.Message) Contact(com.applozic.mobicommons.people.contact.Contact)

Example 7 with AppContactService

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);
}
Also used : AppContactService(com.applozic.mobicomkit.contact.AppContactService) MobiComConversationService(com.applozic.mobicomkit.api.conversation.MobiComConversationService)

Example 8 with AppContactService

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);
}
Also used : Context(android.content.Context) Bitmap(android.graphics.Bitmap) AppContactService(com.applozic.mobicomkit.contact.AppContactService) ImageLoader(com.applozic.mobicommons.commons.image.ImageLoader) Contact(com.applozic.mobicommons.people.contact.Contact)

Example 9 with AppContactService

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;
}
Also used : AppContactService(com.applozic.mobicomkit.contact.AppContactService) ArrayList(java.util.ArrayList) SpannableString(android.text.SpannableString) ChannelUserMapper(com.applozic.mobicommons.people.channel.ChannelUserMapper) ChannelDatabaseService(com.applozic.mobicomkit.channel.database.ChannelDatabaseService) Contact(com.applozic.mobicommons.people.contact.Contact) NonNull(androidx.annotation.NonNull)

Example 10 with AppContactService

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();
    }
}
Also used : AppContactService(com.applozic.mobicomkit.contact.AppContactService) Channel(com.applozic.mobicommons.people.channel.Channel) ApplozicException(com.applozic.mobicomkit.exception.ApplozicException) Contact(com.applozic.mobicommons.people.contact.Contact) MessageDatabaseService(com.applozic.mobicomkit.api.conversation.database.MessageDatabaseService)

Aggregations

AppContactService (com.applozic.mobicomkit.contact.AppContactService)24 Contact (com.applozic.mobicommons.people.contact.Contact)17 Context (android.content.Context)7 Bitmap (android.graphics.Bitmap)7 ImageLoader (com.applozic.mobicommons.commons.image.ImageLoader)7 AlCustomizationSettings (com.applozic.mobicomkit.uiwidgets.AlCustomizationSettings)5 SpannableString (android.text.SpannableString)4 MessageDatabaseService (com.applozic.mobicomkit.api.conversation.database.MessageDatabaseService)4 Channel (com.applozic.mobicommons.people.channel.Channel)4 ArrayList (java.util.ArrayList)4 Intent (android.content.Intent)3 TextView (android.widget.TextView)3 NonNull (androidx.annotation.NonNull)3 Toolbar (androidx.appcompat.widget.Toolbar)3 Message (com.applozic.mobicomkit.api.conversation.Message)3 ChannelDatabaseService (com.applozic.mobicomkit.channel.database.ChannelDatabaseService)3 ProgressDialog (android.app.ProgressDialog)2 IntentFilter (android.content.IntentFilter)2 View (android.view.View)2 ImageView (android.widget.ImageView)2