use of com.applozic.mobicomkit.api.account.user.MobiComUserPreference in project Applozic-Android-SDK by AppLozic.
the class VideoCallNotificationHelper method getVideoCallStatusMessage.
@NonNull
private Message getVideoCallStatusMessage(Contact contact) {
Message notificationMessage = new Message();
MobiComUserPreference userPreferences = MobiComUserPreference.getInstance(context);
notificationMessage.setContactIds(contact.getContactIds());
notificationMessage.setTo(contact.getContactIds());
notificationMessage.setCreatedAtTime(System.currentTimeMillis());
notificationMessage.setStoreOnDevice(Boolean.TRUE);
notificationMessage.setSendToDevice(Boolean.TRUE);
notificationMessage.setContentType(Message.ContentType.VIDEO_CALL_STATUS_MSG.getValue());
notificationMessage.setDeviceKeyString(userPreferences.getDeviceKeyString());
return notificationMessage;
}
use of com.applozic.mobicomkit.api.account.user.MobiComUserPreference in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationFragment method sendBroadcastMessage.
public void sendBroadcastMessage(String message, String path) {
MobiComUserPreference userPreferences = MobiComUserPreference.getInstance(getActivity());
if (channelUserMapperList != null && channelUserMapperList.size() > 0) {
for (ChannelUserMapper channelUserMapper : channelUserMapperList) {
if (!userPreferences.getUserId().equals(channelUserMapper.getUserKey())) {
Message messageToSend = new Message();
messageToSend.setTo(channelUserMapper.getUserKey());
messageToSend.setContactIds(channelUserMapper.getUserKey());
messageToSend.setRead(Boolean.TRUE);
messageToSend.setStoreOnDevice(Boolean.TRUE);
if (messageToSend.getCreatedAtTime() == null) {
messageToSend.setCreatedAtTime(System.currentTimeMillis() + userPreferences.getDeviceTimeOffset());
}
if (currentConversationId != null && currentConversationId != 0) {
messageToSend.setConversationId(currentConversationId);
}
messageToSend.setSendToDevice(Boolean.FALSE);
messageToSend.setType(sendType.getSelectedItemId() == 1 ? Message.MessageType.MT_OUTBOX.getValue() : Message.MessageType.OUTBOX.getValue());
messageToSend.setTimeToLive(getTimeToLive());
messageToSend.setMessage(message);
messageToSend.setDeviceKeyString(userPreferences.getDeviceKeyString());
messageToSend.setScheduledAt(scheduledTimeHolder.getTimestamp());
messageToSend.setSource(Message.Source.MT_MOBILE_APP.getValue());
if (!TextUtils.isEmpty(path)) {
List<String> filePaths = new ArrayList<String>();
filePaths.add(path);
messageToSend.setFilePaths(filePaths);
}
conversationService.sendMessage(messageToSend, MessageIntentService.class);
if (selfDestructMessageSpinner != null) {
selfDestructMessageSpinner.setSelection(0);
}
attachmentLayout.setVisibility(View.GONE);
}
}
}
}
use of com.applozic.mobicomkit.api.account.user.MobiComUserPreference 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, MessageIntentService.class);
}
}).start();
}
Aggregations