use of com.fanap.podchat.chat.ChatListener in project pod-chat-android-sdk by FanapSoft.
the class AssistantCacheTest method createChat.
@Before
public void createChat() {
view = Mockito.mock(ChatContract.view.class);
chatActivity = chatActivityRule.getActivity();
presenter = new ChatPresenter(appContext, view, chatActivity);
RequestConnect rc = new RequestConnect.Builder(socketAddress, APP_ID, serverName, TOKEN, ssoHost, platformHost, fileServer, "podSpaceServer").build();
chatListeners = new ChatListener() {
@Override
public void onChatState(String state) {
if (state.equals(CHAT_READY)) {
resumeProcess();
}
}
};
chat.addListener(chatListeners);
chat.connect(rc);
chat.isCacheables(CACHE);
pauseProcess();
}
use of com.fanap.podchat.chat.ChatListener in project pod-chat-android-sdk by FanapSoft.
the class ChatTest method chatListeners.
@Test
public void chatListeners() {
ChatListener listener1 = new ChatListener() {
@Override
public void onSent(String content, ChatResponse<ResultMessage> response) {
}
};
chat.addListener(listener1);
ChatListener listener2 = new ChatListener() {
@Override
public void onSent(String content, ChatResponse<ResultMessage> response) {
}
};
chat.addListener(listener2);
ChatListener listener3 = new ChatListener() {
@Override
public void onSent(String content, ChatResponse<ResultMessage> response) {
}
};
chat.addListener(listener3);
chat.removeListener(listener2);
Assert.assertFalse(chat.getListeners().contains(listener2));
}
use of com.fanap.podchat.chat.ChatListener in project pod-chat-android-sdk by FanapSoft.
the class ChatTest method createChat.
@Before
public void createChat() {
Looper.prepare();
view = Mockito.mock(ChatContract.view.class);
chatActivity = chatActivityRule.getActivity();
presenter = new ChatPresenter(appContext, view, chatActivity);
RequestConnect rc = new RequestConnect.Builder(socketAddress, APP_ID, serverName, TOKEN, ssoHost, platformHost, fileServer, "podSpaceServer").build();
chatListeners = new ChatListener() {
@Override
public void onChatState(String state) {
if (state.equals(CHAT_READY)) {
resumeProcess();
}
}
};
chat.addListener(chatListeners);
chat.connect(rc);
chat.isCacheables(CACHE);
pauseProcess();
}
use of com.fanap.podchat.chat.ChatListener in project pod-chat-android-sdk by FanapSoft.
the class ChatTestIntegration method getAssistantTest.
@Test
@LargeTest
public void getAssistantTest() {
long startTime = System.currentTimeMillis();
ChatListener historyListeners = new ChatListener() {
@Override
public void onGetAssistants(ChatResponse<List<AssistantVo>> response) {
System.out.println("onGetAssistants: " + response);
Assert.assertTrue(true);
resumeProcess();
}
};
chat.addListener(historyListeners);
getAssistants();
}
use of com.fanap.podchat.chat.ChatListener in project pod-chat-android-sdk by FanapSoft.
the class NetworkPingSender method setStateListener.
public void setStateListener(Chat chat) {
chat.addListener(new ChatListener() {
@Override
public void onChatState(String state) {
Log.d(TAG, "CHAT STATE CHANGED: " + state);
switch(state) {
case ChatStateType.ChatSateConstant.CLOSING:
case ChatStateType.ChatSateConstant.CLOSED:
{
connected = false;
isConnecting = false;
break;
}
}
}
});
}
Aggregations