use of drift.com.drift.wrappers.APICallbackWrapper 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.wrappers.APICallbackWrapper 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