use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.
the class SmartListPresenter method subscribePresence.
private void subscribePresence() {
if (mAccountService.getCurrentAccount() == null || mSmartListViewModels == null || mSmartListViewModels.isEmpty()) {
return;
}
String accountId = mAccountService.getCurrentAccount().getAccountID();
for (SmartListViewModel smartListViewModel : mSmartListViewModels) {
String ringId = smartListViewModel.getUuid();
Uri uri = new Uri(ringId);
if (uri.isRingId()) {
mPresenceService.subscribeBuddy(accountId, ringId, true);
} else {
Log.i(TAG, "Trying to subscribe to an invalid uri " + ringId);
}
}
}
use of cx.ring.model.Uri in project ring-client-android by savoirfairelinux.
the class ContactRequestsPresenter method contactRequestClicked.
public void contactRequestClicked(String contactId) {
String rawUriString = new Uri(contactId).getRawUriString();
getView().goToConversation(mAccountService.getCurrentAccount().getAccountID(), rawUriString);
}
use of cx.ring.model.Uri 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.Uri 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