mirror of
https://github.com/NekoX-Dev/NekoX.git
synced 2024-12-17 04:29:45 +01:00
Fix forward multi albums
(cherry picked from commit f390eb8340ab681dc58485be29a3fffc0c6ccdd9)
This commit is contained in:
parent
37e5180f14
commit
a20c1f0d1b
@ -8635,7 +8635,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
if (!fromMyName) {
|
||||
AlertsCreator.showSendMediaAlert(getSendMessagesHelper().sendMessage(arrayList, did == 0 ? dialog_id : did, notify, scheduleDate), this);
|
||||
} else {
|
||||
getMessageHelper().processForwardFromMyName(arrayList, did, notify, scheduleDate);
|
||||
getMessageHelper().processForwardFromMyName(arrayList, did == 0 ? dialog_id : did, notify, scheduleDate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class MessageHelper extends BaseController {
|
||||
}
|
||||
|
||||
public void processForwardFromMyName(ArrayList<MessageObject> messages, long did, boolean notify, int scheduleDate) {
|
||||
Long groupId = Utilities.random.nextLong();
|
||||
HashMap<Long, Long> map = new HashMap<>();
|
||||
for (int i = 0; i < messages.size(); i++) {
|
||||
MessageObject messageObject = messages.get(i);
|
||||
ArrayList<TLRPC.MessageEntity> entities;
|
||||
@ -88,13 +88,26 @@ public class MessageHelper extends BaseController {
|
||||
params = new HashMap<>();
|
||||
params.put("parentObject", "sent_" + messageObject.messageOwner.to_id.channel_id + "_" + messageObject.getId());
|
||||
}
|
||||
if (messageObject.messageOwner.grouped_id != 0) {
|
||||
long oldGroupId = messageObject.messageOwner.grouped_id;
|
||||
if (oldGroupId != 0) {
|
||||
if (params == null) {
|
||||
params = new HashMap<>();
|
||||
}
|
||||
params.put("groupId", groupId + "");
|
||||
Long groupId;
|
||||
if (map.containsKey(oldGroupId)) {
|
||||
groupId = map.get(oldGroupId);
|
||||
} else {
|
||||
groupId = Utilities.random.nextLong();
|
||||
map.put(oldGroupId, groupId);
|
||||
}
|
||||
params.put("groupId", String.valueOf(groupId));
|
||||
if (i == messages.size() - 1) {
|
||||
params.put("final", "true");
|
||||
} else {
|
||||
long nextOldGroupId = messages.get(i + 1).messageOwner.grouped_id;
|
||||
if (nextOldGroupId != oldGroupId) {
|
||||
params.put("final", "true");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (messageObject.messageOwner.media.photo instanceof TLRPC.TL_photo) {
|
||||
|
Loading…
Reference in New Issue
Block a user