Search in sources :

Example 1 with ConversationFacade

use of cx.ring.facades.ConversationFacade in project ring-client-android by savoirfairelinux.

the class ConversationPresenter method update.

@Override
public void update(Observable observable, ServiceEvent event) {
    if (observable instanceof AccountService && event != null) {
        if (event.getEventType() == ServiceEvent.EventType.REGISTERED_NAME_FOUND) {
            final String name = event.getEventInput(ServiceEvent.EventInput.NAME, String.class);
            final String address = event.getEventInput(ServiceEvent.EventInput.ADDRESS, String.class);
            final int state = event.getEventInput(ServiceEvent.EventInput.STATE, Integer.class);
            getView().updateView(address, name, state);
        }
    } else if (observable instanceof ConversationFacade && event != null) {
        switch(event.getEventType()) {
            case DATA_TRANSFER:
                getView().refreshView(mConversation);
                getView().scrollToEnd();
                break;
            case DATA_TRANSFER_UPDATE:
                {
                    DataTransfer transfer = event.getEventInput(ServiceEvent.EventInput.TRANSFER_INFO, DataTransfer.class);
                    getView().updateTransfer(transfer);
                    break;
                }
            case INCOMING_MESSAGE:
                getView().refreshView(mConversation);
                getView().scrollToEnd();
                break;
            case CONVERSATIONS_CHANGED:
                loadHistory();
                break;
        }
    }
}
Also used : DataTransfer(cx.ring.model.DataTransfer) ConversationFacade(cx.ring.facades.ConversationFacade) AccountService(cx.ring.services.AccountService)

Example 2 with ConversationFacade

use of cx.ring.facades.ConversationFacade in project ring-client-android by savoirfairelinux.

the class ServiceInjectionModule method provideConversationFacade.

@Provides
@Singleton
ConversationFacade provideConversationFacade(ContactService contactService, HistoryService historyService, CallService callService, AccountService accountService) {
    ConversationFacade conversationFacade = new ConversationFacade(historyService, callService, contactService, accountService);
    mRingApplication.getRingInjectionComponent().inject(conversationFacade);
    return conversationFacade;
}
Also used : ConversationFacade(cx.ring.facades.ConversationFacade) Singleton(javax.inject.Singleton) Provides(dagger.Provides)

Aggregations

ConversationFacade (cx.ring.facades.ConversationFacade)2 DataTransfer (cx.ring.model.DataTransfer)1 AccountService (cx.ring.services.AccountService)1 Provides (dagger.Provides)1 Singleton (javax.inject.Singleton)1