Search in sources :

Example 1 with RequestGetContact

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

the class CallPresenter method getContact.

@Override
public void getContact() {
    if (chat.isChatReady()) {
        view.hideFabContactButton();
        RequestGetContact request = new RequestGetContact.Builder().count(50).offset(0).build();
        callUniqueIds.add(chat.getContacts(request, null));
    }
}
Also used : RequestGetContact(com.fanap.podchat.requestobject.RequestGetContact)

Example 2 with RequestGetContact

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

the class IntegrationTest method getContacts.

@Test
public void getContacts() {
    chatListeners = new ChatListener() {

        @Override
        public void onGetContacts(String content, ChatResponse<ResultContact> response) {
            System.out.println("Received contact: " + content);
            contactContent = content;
            resumeProcess();
        }
    };
    chat.addListener(chatListeners);
    RequestGetContact request = new RequestGetContact.Builder().count(50).offset(0).build();
    chat.getContacts(request, null);
    pauseProcess();
    System.out.println("Received contact: " + contactContent);
}
Also used : ResultContact(com.fanap.podchat.model.ResultContact) ChatListener(com.fanap.podchat.chat.ChatListener) RequestGetContact(com.fanap.podchat.requestobject.RequestGetContact) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest)

Example 3 with RequestGetContact

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

the class ChatPresenter method getContact.

@Override
public void getContact() {
    if (chat.isChatReady()) {
        view.onLoadingContactsStarted();
        RequestGetContact request = new RequestGetContact.Builder().count(50).offset(0).build();
        uniqueIds.add(chat.getContacts(request, null));
    }
}
Also used : RequestGetContact(com.fanap.podchat.requestobject.RequestGetContact)

Example 4 with RequestGetContact

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

the class ChatActivity method getContacts.

private void getContacts() {
    new Thread(() -> {
        RequestGetContact request = new RequestGetContact.Builder().count(50).offset(0).build();
        // presenter.getContact(0, 0L, null);
        presenter.getContact(request);
    }).start();
    try {
        Thread.sleep(10000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    new Thread(() -> {
        RequestGetContact request2 = new RequestGetContact.Builder().count(10).offset(0).build();
        // presenter.getContact(0, 0L, null);
        presenter.getContact(request2);
    // offset = offset + 50;
    }).start();
}
Also used : GsonBuilder(com.google.gson.GsonBuilder) RequestGetContact(com.fanap.podchat.requestobject.RequestGetContact) RequestCreatePublicThread(com.fanap.podchat.chat.thread.public_thread.RequestCreatePublicThread) ResultJoinPublicThread(com.fanap.podchat.chat.thread.public_thread.ResultJoinPublicThread) RequestJoinPublicThread(com.fanap.podchat.chat.thread.public_thread.RequestJoinPublicThread) RequestThread(com.fanap.podchat.requestobject.RequestThread) RequestPinThread(com.fanap.podchat.chat.pin.pin_thread.model.RequestPinThread) RequestCreateThread(com.fanap.podchat.requestobject.RequestCreateThread)

Example 5 with RequestGetContact

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

the class ContactCacheTest method populateContactsFromServer.

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

        @Override
        public void onGetContacts(String content, ChatResponse<ResultContact> response) {
            if (!response.isCache()) {
                System.out.println("Received List: " + content);
                serverContacts.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 List: " + serverContacts.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