diff --git a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java index 117ac6022..a484627ec 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java @@ -527,6 +527,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter public void processLoadedUserPhotos(final TLRPC.photos_Photos res, final int uid, final int offset, final int count, final long max_id, final boolean fromCache, final int classGuid) { if (!fromCache) { + MessagesStorage.getInstance().putUsersAndChats(res.users, null, true, true); MessagesStorage.getInstance().putUserPhotos(uid, res); } else if (res == null || res.photos.isEmpty()) { loadUserPhotos(uid, offset, count, max_id, false, classGuid); @@ -535,6 +536,16 @@ public class MessagesController implements NotificationCenter.NotificationCenter Utilities.RunOnUIThread(new Runnable() { @Override public void run() { + for (TLRPC.User user : res.users) { + if (fromCache) { + users.putIfAbsent(user.id, user); + } else { + users.put(user.id, user); + if (user.id == UserConfig.getClientUserId()) { + UserConfig.setCurrentUser(user); + } + } + } NotificationCenter.getInstance().postNotificationName(userPhotosLoaded, uid, offset, count, fromCache, classGuid, res.photos); } }); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java index d8f4aa583..cde0be595 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java @@ -115,6 +115,8 @@ public class ChatBaseCell extends BaseCell { private CheckForLongPress pendingCheckForLongPress = null; private CheckForTap pendingCheckForTap = null; + private int last_send_state = 0; + private final class CheckForTap implements Runnable { public void run() { if (pendingCheckForLongPress == null) { @@ -212,6 +214,10 @@ public class ChatBaseCell extends BaseCell { if (currentMessageObject == null || currentUser == null) { return false; } + if (last_send_state != currentMessageObject.messageOwner.send_state) { + return true; + } + TLRPC.User newUser = MessagesController.getInstance().users.get(currentMessageObject.messageOwner.from_id); TLRPC.FileLocation newPhoto = null; @@ -242,6 +248,7 @@ public class ChatBaseCell extends BaseCell { public void setMessageObject(MessageObject messageObject) { currentMessageObject = messageObject; + last_send_state = messageObject.messageOwner.send_state; isPressed = false; isCheckPressed = true; isAvatarVisible = false; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 2232f493f..8a5d152a6 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -2836,10 +2836,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (messageObject.messageOwner.media.photo instanceof TLRPC.TL_photo) { MessagesController.getInstance().sendMessage((TLRPC.TL_photo)messageObject.messageOwner.media.photo, null, did); } else if (messageObject.messageOwner.media.audio instanceof TLRPC.TL_audio) { + messageObject.messageOwner.media.audio.path = messageObject.messageOwner.attachPath; MessagesController.getInstance().sendMessage((TLRPC.TL_audio)messageObject.messageOwner.media.audio, did); } else if (messageObject.messageOwner.media.video instanceof TLRPC.TL_video) { + messageObject.messageOwner.media.video.path = messageObject.messageOwner.attachPath; MessagesController.getInstance().sendMessage((TLRPC.TL_video)messageObject.messageOwner.media.video, null, did); } else if (messageObject.messageOwner.media.document instanceof TLRPC.TL_document) { + messageObject.messageOwner.media.document.path = messageObject.messageOwner.attachPath; MessagesController.getInstance().sendMessage((TLRPC.TL_document)messageObject.messageOwner.media.document, null, did); } else if (messageObject.messageOwner.media.geo instanceof TLRPC.TL_geoPoint) { MessagesController.getInstance().sendMessage(messageObject.messageOwner.media.geo.lat, messageObject.messageOwner.media.geo._long, did);