use of im.actor.core.api.rpc.RequestLoadFullGroups in project actor-platform by actorapp.
the class GroupRouter method onRequestLoadFullGroup.
private void onRequestLoadFullGroup(int gid) {
if (requestedFullGroups.contains(gid)) {
return;
}
requestedFullGroups.add(gid);
freeze();
groups().getValueAsync(gid).flatMap(new Function<Group, Promise<Group>>() {
@Override
public Promise<Group> apply(Group group) {
if (!group.isHaveExtension()) {
ArrayList<ApiGroupOutPeer> groups = new ArrayList<>();
groups.add(new ApiGroupOutPeer(gid, group.getAccessHash()));
return api(new RequestLoadFullGroups(groups)).map(r -> group.updateExt(r.getGroups().get(0)));
} else {
return Promise.failure(new RuntimeException("Already loaded"));
}
}
}).then(r -> groups().addOrUpdateItem(r)).after((r, e) -> unfreeze());
}
Aggregations