use of cx.ring.model.CallContact in project ring-client-android by savoirfairelinux.
the class CallService method incomingAccountMessage.
public void incomingAccountMessage(String accountId, String from, StringMap messages) {
mHistoryService.incomingMessage(accountId, null, from, messages);
CallContact contact = mAccountService.getCurrentAccount().getContact(from);
if (!mHistoryService.hasAnHistory(accountId, from) && contact == null) {
mAccountService.incomingTrustRequest(accountId, from, "", System.currentTimeMillis());
}
}
use of cx.ring.model.CallContact in project ring-client-android by savoirfairelinux.
the class CallService method parseCallState.
private SipCall parseCallState(String callId, String newState) {
int callState = SipCall.stateFromString(newState);
SipCall sipCall = currentCalls.get(callId);
if (sipCall != null) {
sipCall.setCallState(callState);
sipCall.setDetails(Ringservice.getCallDetails(callId).toNative());
} else if (callState != SipCall.State.OVER) {
Map<String, String> callDetails = Ringservice.getCallDetails(callId).toNative();
sipCall = new SipCall(callId, callDetails);
sipCall.setCallState(callState);
CallContact contact = mContactService.findContact(sipCall.getNumberUri());
String registeredName = callDetails.get("REGISTERED_NAME");
if (registeredName != null && !registeredName.isEmpty()) {
contact.setUsername(registeredName);
}
sipCall.setContact(contact);
currentCalls.put(callId, sipCall);
}
return sipCall;
}
use of cx.ring.model.CallContact in project ring-client-android by savoirfairelinux.
the class ContactService method findContactById.
/**
* Searches a contact in the local cache and then in the system repository
* In the last case, the contact is created and added to the local cache
*
* @return The found/created contact
*/
public CallContact findContactById(long id, String key) {
if (id <= CallContact.DEFAULT_ID) {
return null;
}
Settings settings = mPreferencesService.loadSettings();
CallContact contact = mContactList.get(id);
if (contact == null && (settings.isAllowSystemContacts() && mDeviceRuntimeService.hasContactPermission())) {
Log.w(TAG, "getContactById : cache miss for " + id);
contact = findContactByIdFromSystem(id, key);
if (contact != null) {
mContactList.put(id, contact);
}
}
return contact;
}
use of cx.ring.model.CallContact in project ring-client-android by savoirfairelinux.
the class ContactService method updateContactUserName.
public void updateContactUserName(Uri contactId, String userName) {
CallContact callContact = getContact(contactId);
callContact.setUsername(userName);
}
use of cx.ring.model.CallContact in project ring-client-android by savoirfairelinux.
the class ContactService method getContactsDaemon.
public Collection<CallContact> getContactsDaemon() {
List<CallContact> contacts = new ArrayList<>(mContactsRing.values());
Iterator<CallContact> it = contacts.iterator();
while (it.hasNext()) {
CallContact contact = it.next();
if (contact.isBanned()) {
it.remove();
}
}
return contacts;
}
Aggregations