Search in sources :

Example 6 with RequestGetContact

use of com.fanap.podchat.requestobject.RequestGetContact in project pod-chat-android-sdk by FanapSoft.

the class AssistantCacheTest method populateContactsFromServer.

public void populateContactsFromServer() {
    chatListeners = new ChatListener() {

        @Override
        public void onGetContacts(String content, ChatResponse<ResultContact> response) {
            if (!response.isCache()) {
                print("Received List: " + content);
                contacts.addAll(response.getResult().getContacts());
                chat.removeListener(chatListeners);
                resumeProcess();
            }
        }
    };
    chat.setListener(chatListeners);
    RequestGetContact request = new RequestGetContact.Builder().count(50).offset(0).build();
    chat.getContacts(request, null);
    pauseProcess();
    print("Received Contact List: " + contacts.size());
}
Also used : ResultContact(com.fanap.podchat.model.ResultContact) ChatListener(com.fanap.podchat.chat.ChatListener) RequestGetContact(com.fanap.podchat.requestobject.RequestGetContact)

Example 7 with RequestGetContact

use of com.fanap.podchat.requestobject.RequestGetContact in project pod-chat-android-sdk by FanapSoft.

the class ContactCacheTest method populateContactsFromCache.

public void populateContactsFromCache() {
    chatListeners = new ChatListener() {

        @Override
        public void onGetContacts(String content, ChatResponse<ResultContact> response) {
            if (response.isCache()) {
                System.out.println("Received Cache List: " + content);
                cacheContacts.addAll(response.getResult().getContacts());
                chat.removeListener(chatListeners);
                resumeProcess();
            }
        }
    };
    chat.setListener(chatListeners);
    RequestGetContact request = new RequestGetContact.Builder().count(50).offset(0).build();
    chat.getContacts(request, null);
    pauseProcess();
    System.out.println("Received Cache List: " + cacheContacts.size());
}
Also used : ResultContact(com.fanap.podchat.model.ResultContact) ChatListener(com.fanap.podchat.chat.ChatListener) RequestGetContact(com.fanap.podchat.requestobject.RequestGetContact)

Aggregations

RequestGetContact (com.fanap.podchat.requestobject.RequestGetContact)7 ChatListener (com.fanap.podchat.chat.ChatListener)4 ResultContact (com.fanap.podchat.model.ResultContact)4 LargeTest (android.support.test.filters.LargeTest)1 RequestPinThread (com.fanap.podchat.chat.pin.pin_thread.model.RequestPinThread)1 RequestCreatePublicThread (com.fanap.podchat.chat.thread.public_thread.RequestCreatePublicThread)1 RequestJoinPublicThread (com.fanap.podchat.chat.thread.public_thread.RequestJoinPublicThread)1 ResultJoinPublicThread (com.fanap.podchat.chat.thread.public_thread.ResultJoinPublicThread)1 RequestCreateThread (com.fanap.podchat.requestobject.RequestCreateThread)1 RequestThread (com.fanap.podchat.requestobject.RequestThread)1 GsonBuilder (com.google.gson.GsonBuilder)1 Test (org.junit.Test)1