Search in sources :

Example 1 with MessageClientService

use of com.applozic.mobicomkit.api.conversation.MessageClientService in project Applozic-Android-SDK by AppLozic.

the class UserIntentService method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    messageClientService = new MessageClientService(getApplicationContext());
    mobiComConversationService = new MobiComConversationService(getApplicationContext());
}
Also used : MessageClientService(com.applozic.mobicomkit.api.conversation.MessageClientService) MobiComConversationService(com.applozic.mobicomkit.api.conversation.MobiComConversationService)

Example 2 with MessageClientService

use of com.applozic.mobicomkit.api.conversation.MessageClientService in project Applozic-Android-SDK by AppLozic.

the class UserWorker method checkAndSaveLoggedUserDeletedDataToSharedPref.

// Cleanup: private
public void checkAndSaveLoggedUserDeletedDataToSharedPref() {
    String userId = MobiComUserPreference.getInstance(getApplicationContext()).getUserId();
    if (TextUtils.isEmpty(userId)) {
        return;
    }
    UserDetail[] userDetails = new MessageClientService(getApplicationContext()).getUserDetails(userId);
    if (userDetails == null) {
        return;
    }
    for (UserDetail userDetail : userDetails) {
        if (userId.equals(userDetail.getUserId()) && userDetail.getDeletedAtTime() != null) {
            // this will add a user deleted entry to MobicomUserPreferences
            SyncCallService.getInstance(getApplicationContext()).processLoggedUserDelete();
        }
    }
}
Also used : UserDetail(com.applozic.mobicomkit.api.account.user.UserDetail) MessageClientService(com.applozic.mobicomkit.api.conversation.MessageClientService)

Example 3 with MessageClientService

use of com.applozic.mobicomkit.api.conversation.MessageClientService in project Applozic-Android-SDK by AppLozic.

the class MobiComConversationFragment method sendProductMessage.

public void sendProductMessage(final String messageToSend, final FileMeta fileMeta, final Contact contact, final short messageContentType) {
    final Message message = new Message();
    new Thread(new Runnable() {

        @Override
        public void run() {
            String topicId;
            MobiComConversationService conversationService = new MobiComConversationService(getActivity());
            MobiComUserPreference userPreferences = MobiComUserPreference.getInstance(getActivity());
            topicId = new MessageClientService(getActivity()).getTopicId(currentConversationId);
            if (getChannel() != null) {
                message.setGroupId(channelKey);
            } else {
                message.setContactIds(contact.getUserId());
                message.setTo(contact.getUserId());
            }
            message.setMessage(messageToSend);
            message.setRead(Boolean.TRUE);
            message.setStoreOnDevice(Boolean.TRUE);
            message.setSendToDevice(Boolean.FALSE);
            message.setContentType(messageContentType);
            message.setType(Message.MessageType.MT_OUTBOX.getValue());
            message.setDeviceKeyString(userPreferences.getDeviceKeyString());
            message.setSource(Message.Source.MT_MOBILE_APP.getValue());
            message.setTopicId(messageToSend);
            message.setCreatedAtTime(System.currentTimeMillis() + userPreferences.getDeviceTimeOffset());
            message.setTopicId(topicId);
            message.setConversationId(currentConversationId);
            message.setFileMetas(fileMeta);
            conversationService.sendMessage(message, userDisplayName);
        }
    }).start();
}
Also used : AlRichMessage(com.applozic.mobicomkit.uiwidgets.conversation.richmessaging.AlRichMessage) Message(com.applozic.mobicomkit.api.conversation.Message) MobiComUserPreference(com.applozic.mobicomkit.api.account.user.MobiComUserPreference) MessageClientService(com.applozic.mobicomkit.api.conversation.MessageClientService) MobiComConversationService(com.applozic.mobicomkit.api.conversation.MobiComConversationService)

Aggregations

MessageClientService (com.applozic.mobicomkit.api.conversation.MessageClientService)3 MobiComConversationService (com.applozic.mobicomkit.api.conversation.MobiComConversationService)2 MobiComUserPreference (com.applozic.mobicomkit.api.account.user.MobiComUserPreference)1 UserDetail (com.applozic.mobicomkit.api.account.user.UserDetail)1 Message (com.applozic.mobicomkit.api.conversation.Message)1 AlRichMessage (com.applozic.mobicomkit.uiwidgets.conversation.richmessaging.AlRichMessage)1