use of im.actor.core.api.ApiGroup in project actor-platform by actorapp.
the class Group method editMembersCount.
public Group editMembersCount(int membersCount) {
ApiGroup w = getWrapped();
ApiGroup res = new ApiGroup(w.getId(), w.getAccessHash(), w.getTitle(), w.getAvatar(), membersCount, w.isMember(), w.isHidden(), w.getGroupType(), w.getPermissions(), w.isDeleted(), w.getExt());
res.setUnmappedObjects(w.getUnmappedObjects());
return new Group(res, getWrappedExt());
}
use of im.actor.core.api.ApiGroup in project actor-platform by actorapp.
the class Group method editIsDeleted.
public Group editIsDeleted(boolean isDeleted) {
ApiGroup w = getWrapped();
ApiGroup res = new ApiGroup(w.getId(), w.getAccessHash(), w.getTitle(), w.getAvatar(), w.getMembersCount(), w.isMember(), w.isHidden(), w.getGroupType(), w.getPermissions(), isDeleted, w.getExt());
res.setUnmappedObjects(w.getUnmappedObjects());
return new Group(res, getWrappedExt());
}
use of im.actor.core.api.ApiGroup in project actor-platform by actorapp.
the class Group method editMembers.
public Group editMembers(List<ApiMember> added, List<Integer> removed, int count) {
ApiGroupFull fullExt = null;
if (getWrappedExt() != null) {
ApiGroupFull e = getWrappedExt();
ArrayList<ApiMember> nMembers = new ArrayList<>(e.getMembers());
// Remove members
for (Integer i : removed) {
for (ApiMember m : nMembers) {
if (m.getUid() == i) {
nMembers.remove(m);
break;
}
}
}
// Adding members
for (ApiMember a : added) {
for (ApiMember m : nMembers) {
if (m.getUid() == a.getUid()) {
nMembers.remove(m);
break;
}
}
nMembers.add(a);
}
fullExt = new ApiGroupFull(e.getId(), e.getCreateDate(), e.getOwnerUid(), nMembers, e.getTheme(), e.getAbout(), e.getExt(), e.isAsyncMembers(), e.isSharedHistory(), e.getShortName(), e.getPermissions());
fullExt.setUnmappedObjects(e.getUnmappedObjects());
}
ApiGroup w = getWrapped();
ApiGroup res = new ApiGroup(w.getId(), w.getAccessHash(), w.getTitle(), w.getAvatar(), count, w.isMember(), w.isHidden(), w.getGroupType(), w.getPermissions(), w.isDeleted(), w.getExt());
return new Group(res, fullExt);
}
use of im.actor.core.api.ApiGroup in project actor-platform by actorapp.
the class Group method editMembers.
//
// Members
//
public Group editMembers(List<ApiMember> members) {
ApiGroupFull fullExt = null;
if (getWrappedExt() != null) {
ApiGroupFull e = getWrappedExt();
fullExt = new ApiGroupFull(e.getId(), e.getCreateDate(), e.getOwnerUid(), members, e.getTheme(), e.getAbout(), e.getExt(), e.isAsyncMembers(), e.isSharedHistory(), e.getShortName(), e.getPermissions());
fullExt.setUnmappedObjects(e.getUnmappedObjects());
}
ApiGroup w = getWrapped();
ApiGroup res = new ApiGroup(w.getId(), w.getAccessHash(), w.getTitle(), w.getAvatar(), members.size(), w.isMember(), w.isHidden(), w.getGroupType(), w.getPermissions(), w.isDeleted(), w.getExt());
return new Group(res, fullExt);
}
use of im.actor.core.api.ApiGroup in project actor-platform by actorapp.
the class SequenceHandlerActor method onDifferenceUpdate.
private Promise<Void> onDifferenceUpdate(@NotNull List<ApiUser> users, @NotNull List<ApiGroup> groups, @NotNull List<ApiUserOutPeer> userOutPeers, @NotNull List<ApiGroupOutPeer> groupOutPeers, @NotNull List<Update> updates) {
if (updates.size() > 0) {
String command = "Difference updates:";
for (Update u : updates) {
command += "\n| " + u;
}
Log.d(TAG, command);
}
beginUpdates();
// Related Users
Promise<Void> currentPromise = updates().applyRelatedData(users, groups);
// Loading missing peers
currentPromise = currentPromise.chain(v -> updates().loadRequiredPeers(userOutPeers, groupOutPeers));
// Apply Diff
long applyStart = im.actor.runtime.Runtime.getCurrentTime();
currentPromise = currentPromise.chain(v -> processor.applyDifferenceUpdate(updates)).then(v -> {
Log.d(TAG, "Difference applied in " + (im.actor.runtime.Runtime.getCurrentTime() - applyStart) + " ms");
endUpdates();
});
return currentPromise;
}
Aggregations