Search in sources :

Example 1 with RequestGetHashTagList

use of com.fanap.podchat.chat.hashtag.model.RequestGetHashTagList in project pod-chat-android-sdk by FanapSoft.

the class ChatActivity method getHashTagHistory.

// public void getHashTagList() {
// RequestGetHashTagList request = new RequestGetHashTagList
// .Builder(TEST_THREAD_ID)
// .offset(0)
// .count(25)
// .setHashtag("ahmad")
// .build();
// 
// presenter.getHashTagLIst(request, null);
// }
public void getHashTagHistory() {
    RequestGetHashTagList request = new RequestGetHashTagList.Builder(TEST_THREAD_ID).setHashtag("test2").offset(0).count(25).build();
    presenter.getHashTagList(request, null);
}
Also used : RequestGetHashTagList(com.fanap.podchat.chat.hashtag.model.RequestGetHashTagList) GsonBuilder(com.google.gson.GsonBuilder)

Example 2 with RequestGetHashTagList

use of com.fanap.podchat.chat.hashtag.model.RequestGetHashTagList in project pod-chat-android-sdk by FanapSoft.

the class HashTagCacheTest method populateHashTagListFromServer.

public void populateHashTagListFromServer(long threadId) {
    threadHashTagMessagesListInServer.clear();
    chatListeners = new ChatListener() {

        @Override
        public void onGetHashTagList(ChatResponse<ResultHistory> response) {
            if (!response.isCache()) {
                System.out.println("Received HashTag Message List Server: " + response.getJson());
                threadHashTagMessagesListInServer.addAll(response.getResult().getHistory().stream().filter(messageVO -> messageVO.getMessage() != null).collect(Collectors.toList()));
                chat.removeListener(chatListeners);
                resumeProcess();
            }
        }
    };
    chat.setListener(chatListeners);
    RequestGetHashTagList request = new RequestGetHashTagList.Builder(threadId).offset(0).count(25).setHashtag("test").build();
    presenter.getHashTagList(request, null);
    pauseProcess();
    System.out.println("Received HashTag Message List Server: " + threadHashTagMessagesListInServer.size());
}
Also used : ResultThreads(com.fanap.podchat.model.ResultThreads) Context(android.content.Context) ResultNewMessage(com.fanap.podchat.model.ResultNewMessage) RequestConnect(com.fanap.podchat.requestobject.RequestConnect) BeforeClass(org.junit.BeforeClass) Mock(org.mockito.Mock) Date(java.util.Date) Thread(com.fanap.podchat.mainmodel.Thread) RunWith(org.junit.runner.RunWith) ChatPresenter(com.example.chat.application.chatexample.ChatPresenter) ChatContract(com.example.chat.application.chatexample.ChatContract) ChatResponse(com.fanap.podchat.model.ChatResponse) ArrayList(java.util.ArrayList) R(com.fanap.podchat.example.R) ResultHistory(com.fanap.podchat.model.ResultHistory) Looper(android.os.Looper) BaseApplication(com.example.chat.application.chatexample.BaseApplication) ChatActivity(com.example.chat.application.chatexample.ChatActivity) RequestThread(com.fanap.podchat.requestobject.RequestThread) RequestMessage(com.fanap.podchat.requestobject.RequestMessage) Before(org.junit.Before) CHAT_READY(com.fanap.podchat.util.ChatStateType.ChatSateConstant.CHAT_READY) ActivityTestRule(android.support.test.rule.ActivityTestRule) Test(org.junit.Test) InstrumentationRegistry(android.support.test.InstrumentationRegistry) AndroidJUnit4(android.support.test.runner.AndroidJUnit4) ChatListener(com.fanap.podchat.chat.ChatListener) RequestGetMentionList(com.fanap.podchat.chat.mention.model.RequestGetMentionList) MessageVO(com.fanap.podchat.mainmodel.MessageVO) Collectors(java.util.stream.Collectors) RequestGetHashTagList(com.fanap.podchat.chat.hashtag.model.RequestGetHashTagList) Mockito(org.mockito.Mockito) APP_ID(com.example.chat.application.chatexample.ChatActivity.APP_ID) Rule(org.junit.Rule) TextMessageType(com.fanap.podchat.util.TextMessageType) Assert(org.junit.Assert) Activity(android.app.Activity) Chat(com.fanap.podchat.chat.Chat) RequestGetHashTagList(com.fanap.podchat.chat.hashtag.model.RequestGetHashTagList) ChatListener(com.fanap.podchat.chat.ChatListener) ResultHistory(com.fanap.podchat.model.ResultHistory)

Example 3 with RequestGetHashTagList

use of com.fanap.podchat.chat.hashtag.model.RequestGetHashTagList in project pod-chat-android-sdk by FanapSoft.

the class HashTagCacheTest method populateHashTagListFromCache.

public void populateHashTagListFromCache(long threadId) {
    threadHashTagMessagesListInCache.clear();
    chatListeners = new ChatListener() {

        @Override
        public void onGetHashTagList(ChatResponse<ResultHistory> response) {
            if (response.isCache()) {
                System.out.println("Received HashTag Message List Server: " + response.getJson());
                threadHashTagMessagesListInCache.addAll(response.getResult().getHistory().stream().filter(messageVO -> messageVO.getMessage() != null).collect(Collectors.toList()));
                chat.removeListener(chatListeners);
                resumeProcess();
            } else {
                Assert.assertEquals(5, 10);
                resumeProcess();
            }
        }
    };
    chat.setListener(chatListeners);
    RequestGetHashTagList request = new RequestGetHashTagList.Builder(threadId).offset(0).count(25).setHashtag("test").build();
    presenter.getHashTagList(request, null);
    pauseProcess();
    System.out.println("Received HashTag Message List Server: " + threadHashTagMessagesListInCache.size());
}
Also used : ResultThreads(com.fanap.podchat.model.ResultThreads) Context(android.content.Context) ResultNewMessage(com.fanap.podchat.model.ResultNewMessage) RequestConnect(com.fanap.podchat.requestobject.RequestConnect) BeforeClass(org.junit.BeforeClass) Mock(org.mockito.Mock) Date(java.util.Date) Thread(com.fanap.podchat.mainmodel.Thread) RunWith(org.junit.runner.RunWith) ChatPresenter(com.example.chat.application.chatexample.ChatPresenter) ChatContract(com.example.chat.application.chatexample.ChatContract) ChatResponse(com.fanap.podchat.model.ChatResponse) ArrayList(java.util.ArrayList) R(com.fanap.podchat.example.R) ResultHistory(com.fanap.podchat.model.ResultHistory) Looper(android.os.Looper) BaseApplication(com.example.chat.application.chatexample.BaseApplication) ChatActivity(com.example.chat.application.chatexample.ChatActivity) RequestThread(com.fanap.podchat.requestobject.RequestThread) RequestMessage(com.fanap.podchat.requestobject.RequestMessage) Before(org.junit.Before) CHAT_READY(com.fanap.podchat.util.ChatStateType.ChatSateConstant.CHAT_READY) ActivityTestRule(android.support.test.rule.ActivityTestRule) Test(org.junit.Test) InstrumentationRegistry(android.support.test.InstrumentationRegistry) AndroidJUnit4(android.support.test.runner.AndroidJUnit4) ChatListener(com.fanap.podchat.chat.ChatListener) RequestGetMentionList(com.fanap.podchat.chat.mention.model.RequestGetMentionList) MessageVO(com.fanap.podchat.mainmodel.MessageVO) Collectors(java.util.stream.Collectors) RequestGetHashTagList(com.fanap.podchat.chat.hashtag.model.RequestGetHashTagList) Mockito(org.mockito.Mockito) APP_ID(com.example.chat.application.chatexample.ChatActivity.APP_ID) Rule(org.junit.Rule) TextMessageType(com.fanap.podchat.util.TextMessageType) Assert(org.junit.Assert) Activity(android.app.Activity) Chat(com.fanap.podchat.chat.Chat) RequestGetHashTagList(com.fanap.podchat.chat.hashtag.model.RequestGetHashTagList) ChatListener(com.fanap.podchat.chat.ChatListener) ResultHistory(com.fanap.podchat.model.ResultHistory)

Example 4 with RequestGetHashTagList

use of com.fanap.podchat.chat.hashtag.model.RequestGetHashTagList in project pod-chat-android-sdk by FanapSoft.

the class ChatTestIntegration method getThreadHistory.

public void getThreadHistory(long threadId) {
    threadId = 8093;
    RequestGetHashTagList request = new RequestGetHashTagList.Builder(threadId).setHashtag("test").offset(0).count(25).build();
    presenter.getHashTagList(request, new ChatHandler() {

        @Override
        public void onGetHistory(String uniqueId) {
            super.onGetHistory(uniqueId);
        }
    });
}
Also used : RequestGetHashTagList(com.fanap.podchat.chat.hashtag.model.RequestGetHashTagList) ChatHandler(com.fanap.podchat.chat.ChatHandler)

Aggregations

RequestGetHashTagList (com.fanap.podchat.chat.hashtag.model.RequestGetHashTagList)4 Activity (android.app.Activity)2 Context (android.content.Context)2 Looper (android.os.Looper)2 InstrumentationRegistry (android.support.test.InstrumentationRegistry)2 ActivityTestRule (android.support.test.rule.ActivityTestRule)2 AndroidJUnit4 (android.support.test.runner.AndroidJUnit4)2 BaseApplication (com.example.chat.application.chatexample.BaseApplication)2 ChatActivity (com.example.chat.application.chatexample.ChatActivity)2 APP_ID (com.example.chat.application.chatexample.ChatActivity.APP_ID)2 ChatContract (com.example.chat.application.chatexample.ChatContract)2 ChatPresenter (com.example.chat.application.chatexample.ChatPresenter)2 Chat (com.fanap.podchat.chat.Chat)2 ChatListener (com.fanap.podchat.chat.ChatListener)2 RequestGetMentionList (com.fanap.podchat.chat.mention.model.RequestGetMentionList)2 R (com.fanap.podchat.example.R)2 MessageVO (com.fanap.podchat.mainmodel.MessageVO)2 Thread (com.fanap.podchat.mainmodel.Thread)2 ChatResponse (com.fanap.podchat.model.ChatResponse)2 ResultHistory (com.fanap.podchat.model.ResultHistory)2