use of cx.ring.model.Conversation in project ring-client-android by savoirfairelinux.
the class ConversationFacade method parseHistoryCalls.
private void parseHistoryCalls(List<HistoryCall> historyCalls, boolean acceptAllMessages) {
for (HistoryCall call : historyCalls) {
CallContact contact = mContactService.findContact(call.getContactID(), call.getContactKey(), new Uri(call.getNumber()));
String key = contact.getIds().get(0);
String phone = contact.getPhones().get(0).getNumber().getRawUriString();
if (mConversationMap.containsKey(key) || mConversationMap.containsKey(phone)) {
mConversationMap.get(key).addHistoryCall(call);
} else if (acceptAllMessages) {
Conversation conversation = new Conversation(contact);
conversation.addHistoryCall(call);
mConversationMap.put(key, conversation);
}
}
}
use of cx.ring.model.Conversation in project ring-client-android by savoirfairelinux.
the class ConversationFacade method startConversation.
/**
* @return the started new conversation
*/
public Conversation startConversation(CallContact contact) {
Conversation conversation = getConversationByContact(contact);
if (conversation == null) {
conversation = new Conversation(contact);
mConversationMap.put(contact.getIds().get(0), conversation);
Account account = mAccountService.getCurrentAccount();
if (account != null && account.isRing()) {
Uri number = contact.getPhones().get(0).getNumber();
if (number.isRingId()) {
mAccountService.lookupAddress(account.getAccountID(), "", number.getRawRingId());
}
}
setChanged();
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.CONVERSATIONS_CHANGED);
notifyObservers(event);
updateTextNotifications();
}
return conversation;
}
Aggregations