Commit a2a18680 authored by DrKLO's avatar DrKLO

Bug fixes

parent 1a9632e0
......@@ -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);
}
});
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment