use of im.actor.core.api.rpc.RequestLoadArchived in project actor-platform by actorapp.
the class ArchivedDialogsActor method onLoadMore.
private void onLoadMore(boolean init, RpcCallback<ResponseLoadArchived> callback) {
if (init || isLoading) {
//
if (lastCallback != null) {
lastCallback.onError(new RpcException(TAG, 0, "callback replaced", false, null));
}
}
lastCallback = callback;
if (isLoading && !init) {
return;
}
if (init) {
if (lastRequest != -1) {
cancelRequest(lastRequest);
}
nextOffset = null;
}
isLoading = true;
Log.d(TAG, "Loading archived dialogs");
api(new RequestLoadArchived(nextOffset, LIMIT, ApiSupportConfiguration.OPTIMIZATIONS)).chain(r -> updates().applyRelatedData(r.getUsers(), r.getGroups())).chain(r -> updates().loadRequiredPeers(r.getUserPeers(), r.getGroupPeers())).then(r -> onLoadedMore(r)).failure(e -> lastCallback.onError((RpcException) e));
}
Aggregations