use of cx.ring.model.ServiceEvent in project ring-client-android by savoirfairelinux.
the class HistoryService method getCallAndTextAsyncForAccount.
public void getCallAndTextAsyncForAccount(final String accountId) {
mApplicationExecutor.submit(() -> {
try {
List<HistoryCall> historyCalls = getAllForAccount(accountId);
List<HistoryText> historyTexts = getAllTextMessagesForAccount(accountId);
List<DataTransfer> historyTransfers = getHistoryDataTransfers(accountId);
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.HISTORY_LOADED);
event.addEventInput(ServiceEvent.EventInput.HISTORY_CALLS, historyCalls);
event.addEventInput(ServiceEvent.EventInput.HISTORY_TEXTS, historyTexts);
event.addEventInput(ServiceEvent.EventInput.HISTORY_TRANSFERS, historyTransfers);
setChanged();
notifyObservers(event);
} catch (SQLException e) {
Log.e(TAG, "Can't load calls and texts", e);
}
});
}
use of cx.ring.model.ServiceEvent in project ring-client-android by savoirfairelinux.
the class PresenceService method newBuddyNotification.
public void newBuddyNotification(String accountId, String buddyUri, int status, String lineStatus) {
Log.d(TAG, "newBuddyNotification: " + accountId + ", " + buddyUri + ", " + status + ", " + lineStatus);
mPresenceMap.put(CallContact.PREFIX_RING + buddyUri, status == 1);
setChanged();
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.NEW_BUDDY_NOTIFICATION);
event.addEventInput(ServiceEvent.EventInput.ACCOUNT_ID, accountId);
event.addEventInput(ServiceEvent.EventInput.BUDDY_URI, buddyUri);
event.addEventInput(ServiceEvent.EventInput.STATE, status);
event.addEventInput(ServiceEvent.EventInput.LINE_STATE, lineStatus);
notifyObservers(event);
}
use of cx.ring.model.ServiceEvent in project ring-client-android by savoirfairelinux.
the class PresenceService method serverError.
public void serverError(String accountId, String error, String message) {
Log.d(TAG, "serverError: " + accountId + ", " + error + ", " + message);
setChanged();
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.SERVER_ERROR);
event.addEventInput(ServiceEvent.EventInput.ACCOUNT_ID, accountId);
event.addEventInput(ServiceEvent.EventInput.ERROR, error);
event.addEventInput(ServiceEvent.EventInput.MESSAGE, message);
notifyObservers(event);
}
use of cx.ring.model.ServiceEvent in project ring-client-android by savoirfairelinux.
the class CallService method incomingCall.
void incomingCall(String accountId, String callId, String from) {
Log.d(TAG, "incoming call: " + accountId + ", " + callId + ", " + from);
SipCall call = addCall(accountId, callId, from, SipCall.Direction.INCOMING);
setChanged();
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.INCOMING_CALL);
event.addEventInput(ServiceEvent.EventInput.CALL, call);
notifyObservers(event);
}
use of cx.ring.model.ServiceEvent in project ring-client-android by savoirfairelinux.
the class ContactService method loadContacts.
/**
* Load contacts from system and generate a local contact cache
*
* @param loadRingContacts if true, ring contacts will be taken care of
* @param loadSipContacts if true, sip contacts will be taken care of
*/
public void loadContacts(final boolean loadRingContacts, final boolean loadSipContacts, final Account account) {
mApplicationExecutor.submit(() -> {
Settings settings = mPreferencesService.loadSettings();
if (settings.isAllowSystemContacts() && mDeviceRuntimeService.hasContactPermission()) {
mContactList = loadContactsFromSystem(loadRingContacts, loadSipContacts);
}
mContactsRing.clear();
mAccountId = account.getAccountID();
Map<String, CallContact> ringContacts = account.getContacts();
for (CallContact contact : ringContacts.values()) {
mContactsRing.put(contact.getPhones().get(0).getNumber().getRawUriString(), contact);
}
setChanged();
ServiceEvent event = new ServiceEvent(ServiceEvent.EventType.CONTACTS_CHANGED);
notifyObservers(event);
});
}
Aggregations