use of cx.ring.services.PresenceService in project ring-client-android by savoirfairelinux.
the class ServiceInjectionModule method providePresenceService.
@Provides
@Singleton
PresenceService providePresenceService() {
PresenceService presenceService = new PresenceService();
mRingApplication.getRingInjectionComponent().inject(presenceService);
return presenceService;
}
use of cx.ring.services.PresenceService in project ring-client-android by savoirfairelinux.
the class SmartListPresenter method update.
@Override
public void update(Observable observable, ServiceEvent event) {
if (event == null) {
return;
}
switch(event.getEventType()) {
case REGISTERED_NAME_FOUND:
String name = event.getEventInput(ServiceEvent.EventInput.NAME, String.class);
if (mLastBlockchainQuery != null && (mLastBlockchainQuery.equals("") || !mLastBlockchainQuery.equals(name))) {
return;
}
String address = event.getEventInput(ServiceEvent.EventInput.ADDRESS, String.class);
int state = event.getEventInput(ServiceEvent.EventInput.STATE, Integer.class);
parseEventState(name, address, state);
break;
case REGISTRATION_STATE_CHANGED:
refreshConnectivity();
break;
case CONTACTS_CHANGED:
loadConversations();
break;
}
if (observable instanceof HistoryService) {
switch(event.getEventType()) {
case INCOMING_MESSAGE:
TextMessage txt = event.getEventInput(ServiceEvent.EventInput.MESSAGE, TextMessage.class);
if (txt.getAccount().equals(mAccountService.getCurrentAccount().getAccountID())) {
loadConversations();
getView().scrollToTop();
}
return;
case HISTORY_MODIFIED:
loadConversations();
getView().scrollToTop();
return;
}
}
if (observable instanceof CallService) {
switch(event.getEventType()) {
case INCOMING_CALL:
SipCall call = event.getEventInput(ServiceEvent.EventInput.CALL, SipCall.class);
updateIncomingCall(call.getNumber());
return;
}
}
if (observable instanceof PresenceService) {
switch(event.getEventType()) {
case NEW_BUDDY_NOTIFICATION:
updatePresence();
return;
default:
}
}
}
Aggregations