use of drift.com.drift.model.ConversationExtra in project drift-sdk-android by Driftt.
the class ConversationListActivity method refreshData.
@Override
public void refreshData() {
super.refreshData();
networkAvailabilityBar.setVisibility(View.GONE);
final Auth auth = Auth.getInstance();
if (auth != null && auth.endUser != null) {
UserManager.getInstance().getUsers(auth.endUser.orgId, new UserManagerCallback() {
@Override
public void didLoadUsers(Boolean success) {
if (success) {
ConversationManager.getInstance().getConversationsForEndUser(auth.endUser.id, new APICallbackWrapper<ArrayList<ConversationExtra>>() {
@Override
public void onResponse(ArrayList<ConversationExtra> response) {
if (response != null) {
progressBar.setVisibility(View.GONE);
LoggerHelper.logMessage(TAG, response.toString());
if (response.isEmpty()) {
emptyState.setVisibility(View.VISIBLE);
} else {
emptyState.setVisibility(View.GONE);
}
conversationListAdapter.updateDate(response);
} else {
Alert.showAlert(ConversationListActivity.this, "Error", "Failed to load conversations", "Retry", new Runnable() {
@Override
public void run() {
refreshData();
}
});
}
}
});
} else {
LoggerHelper.logMessage(TAG, "Failed to load users");
}
}
});
}
}
use of drift.com.drift.model.ConversationExtra in project drift-sdk-android by Driftt.
the class PresentationManager method showMessagePopupFromManager.
private void showMessagePopupFromManager() {
// /Check for unread conversation extras
ArrayList<Message> unreadMessages = new ArrayList<>();
int unreadMessageCount = -1;
for (ConversationExtra conversationExtra : ConversationManager.getInstance().getConversations()) {
if (conversationExtra.unreadMessages != 0) {
if (conversationExtra.lastAgentMessage != null) {
unreadMessages.add(conversationExtra.lastAgentMessage);
unreadMessageCount += conversationExtra.unreadMessages;
}
}
}
if (!unreadMessages.isEmpty()) {
showPopupForMessage(unreadMessages.get(0), unreadMessageCount);
}
}
use of drift.com.drift.model.ConversationExtra in project drift-sdk-android by Driftt.
the class PresentationManager method checkForUnreadMessagesToShow.
public void checkForUnreadMessagesToShow(int orgId, final int endUserId) {
LoggerHelper.logMessage(TAG, "Checking for Messages to show");
UserManager.getInstance().getUsersIfWeNeedTo(orgId, new UserManagerCallback() {
@Override
public void didLoadUsers(Boolean success) {
ConversationManager.getInstance().getConversationsForEndUser(endUserId, new APICallbackWrapper<ArrayList<ConversationExtra>>() {
@Override
public void onResponse(ArrayList<ConversationExtra> response) {
if (response != null) {
showMessagePopupFromManager();
} else {
LoggerHelper.logMessage(TAG, "Failed to get conversation extras");
}
}
});
}
});
}
Aggregations