Search in sources :

Example 1 with PresenceService

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;
}
Also used : PresenceService(cx.ring.services.PresenceService) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Example 2 with 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:
        }
    }
}
Also used : SipCall(cx.ring.model.SipCall) HistoryService(cx.ring.services.HistoryService) PresenceService(cx.ring.services.PresenceService) TextMessage(cx.ring.model.TextMessage) CallService(cx.ring.services.CallService)

Aggregations

PresenceService (cx.ring.services.PresenceService)2 SipCall (cx.ring.model.SipCall)1 TextMessage (cx.ring.model.TextMessage)1 CallService (cx.ring.services.CallService)1 HistoryService (cx.ring.services.HistoryService)1 Provides (dagger.Provides)1 Singleton (javax.inject.Singleton)1