mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 14:35:03 +01:00
Bug fixes
This commit is contained in:
parent
f00aef78bd
commit
1122ab85d1
3 changed files with 50 additions and 45 deletions
|
@ -1548,13 +1548,13 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
dialog.unread_count = 0;
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
}
|
||||
HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>();
|
||||
dialogsToUpdate.put(dialog_id, 0);
|
||||
NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>();
|
||||
dialogsToUpdate.put(dialog_id, 0);
|
||||
NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true);
|
||||
}
|
||||
if (req.max_id != Integer.MAX_VALUE) {
|
||||
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
|
||||
|
@ -1634,15 +1634,14 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
dialog.unread_count = 0;
|
||||
NotificationCenter.getInstance().postNotificationName(dialogsNeedReload);
|
||||
}
|
||||
HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>();
|
||||
dialogsToUpdate.put(dialog_id, 0);
|
||||
NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
HashMap<Long, Integer> dialogsToUpdate = new HashMap<Long, Integer>();
|
||||
dialogsToUpdate.put(dialog_id, 0);
|
||||
NotificationsController.getInstance().processDialogsUpdateRead(dialogsToUpdate, true);
|
||||
|
||||
if (chat.ttl > 0 && was) {
|
||||
int serverTime = Math.max(ConnectionsManager.getInstance().getCurrentTime(), max_date);
|
||||
MessagesStorage.getInstance().createTaskForDate(chat.id, serverTime, serverTime, 0);
|
||||
|
@ -2488,15 +2487,15 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
public void run(TLObject response, TLRPC.TL_error error) {
|
||||
if (newMsgObj != null) {
|
||||
if (error == null) {
|
||||
TLRPC.messages_SentEncryptedMessage res = (TLRPC.messages_SentEncryptedMessage) response;
|
||||
final TLRPC.messages_SentEncryptedMessage res = (TLRPC.messages_SentEncryptedMessage) response;
|
||||
newMsgObj.messageOwner.date = res.date;
|
||||
if (res.file instanceof TLRPC.TL_encryptedFile) {
|
||||
processSentMessage(newMsgObj.messageOwner, null, res.file, req, originalPath);
|
||||
}
|
||||
MessagesStorage.getInstance().updateMessageStateAndId(newMsgObj.messageOwner.random_id, newMsgObj.messageOwner.id, newMsgObj.messageOwner.id, res.date, true);
|
||||
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MessagesStorage.getInstance().updateMessageStateAndId(newMsgObj.messageOwner.random_id, newMsgObj.messageOwner.id, newMsgObj.messageOwner.id, res.date, false);
|
||||
Utilities.RunOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -2528,7 +2527,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
public void run(TLObject response, TLRPC.TL_error error) {
|
||||
if (error == null) {
|
||||
final int oldId = newMsgObj.messageOwner.id;
|
||||
ArrayList<TLRPC.Message> sentMessages = new ArrayList<TLRPC.Message>();
|
||||
final ArrayList<TLRPC.Message> sentMessages = new ArrayList<TLRPC.Message>();
|
||||
|
||||
if (response instanceof TLRPC.TL_messages_sentMessage) {
|
||||
TLRPC.TL_messages_sentMessage res = (TLRPC.TL_messages_sentMessage) response;
|
||||
|
@ -2603,19 +2602,17 @@ public class MessagesController implements NotificationCenter.NotificationCenter
|
|||
}
|
||||
}
|
||||
}
|
||||
MessagesStorage.getInstance().updateMessageStateAndId(newMsgObj.messageOwner.random_id, oldId, newMsgObj.messageOwner.id, 0, true);
|
||||
if (!sentMessages.isEmpty()) {
|
||||
MessagesStorage.getInstance().putMessages(sentMessages, true, true);
|
||||
}
|
||||
MessagesStorage.getInstance().storageQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MessagesStorage.getInstance().updateMessageStateAndId(newMsgObj.messageOwner.random_id, oldId, newMsgObj.messageOwner.id, 0, false);
|
||||
MessagesStorage.getInstance().putMessages(sentMessages, true, false);
|
||||
Utilities.RunOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
newMsgObj.messageOwner.send_state = MESSAGE_SEND_STATE_SENT;
|
||||
NotificationCenter.getInstance().postNotificationName(messageReceivedByServer, oldId, newMsgObj.messageOwner.id, newMsgObj);
|
||||
sendingMessages.remove(oldId); //TODO CHECK THIS!!!
|
||||
sendingMessages.remove(oldId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -475,7 +475,7 @@ public class NotificationsController {
|
|||
if (messageObjects.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
notifyCheck = isLast;
|
||||
boolean added = false;
|
||||
|
||||
int oldCount = popupMessages.size();
|
||||
HashMap<Long, Boolean> settingsCache = new HashMap<Long, Boolean>();
|
||||
|
@ -487,9 +487,10 @@ public class NotificationsController {
|
|||
continue;
|
||||
}
|
||||
long dialog_id = messageObject.getDialogId();
|
||||
if (dialog_id == openned_dialog_id) {
|
||||
if (dialog_id == openned_dialog_id && ApplicationLoader.isScreenOn) {
|
||||
continue;
|
||||
}
|
||||
added = true;
|
||||
|
||||
Boolean value = settingsCache.get(dialog_id);
|
||||
boolean isChat = (int)dialog_id < 0;
|
||||
|
@ -508,6 +509,10 @@ public class NotificationsController {
|
|||
}
|
||||
}
|
||||
|
||||
if (added) {
|
||||
notifyCheck = isLast;
|
||||
}
|
||||
|
||||
if (!popupMessages.isEmpty() && oldCount != popupMessages.size()) {
|
||||
if (ApplicationLoader.mainInterfacePaused || !ApplicationLoader.isScreenOn) {
|
||||
MessageObject messageObject = messageObjects.get(0);
|
||||
|
|
|
@ -2860,38 +2860,40 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
}
|
||||
}
|
||||
|
||||
private void forwardSelectedMessages(long did, boolean fromMyName) {
|
||||
if (forwaringMessage != null) {
|
||||
if (forwaringMessage.messageOwner.id > 0) {
|
||||
if (!fromMyName) {
|
||||
MessagesController.getInstance().sendMessage(forwaringMessage, did);
|
||||
} else {
|
||||
processForwardFromMe(forwaringMessage, did);
|
||||
}
|
||||
}
|
||||
forwaringMessage = null;
|
||||
} else {
|
||||
ArrayList<Integer> ids = new ArrayList<Integer>(selectedMessagesIds.keySet());
|
||||
Collections.sort(ids);
|
||||
for (Integer id : ids) {
|
||||
if (id > 0) {
|
||||
if (!fromMyName) {
|
||||
MessagesController.getInstance().sendMessage(selectedMessagesIds.get(id), did);
|
||||
} else {
|
||||
processForwardFromMe(selectedMessagesIds.get(id), did);
|
||||
}
|
||||
}
|
||||
}
|
||||
selectedMessagesCanCopyIds.clear();
|
||||
selectedMessagesIds.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void didSelectDialog(MessagesActivity activity, long did, boolean param) {
|
||||
if (dialog_id != 0 && (forwaringMessage != null || !selectedMessagesIds.isEmpty())) {
|
||||
if (forwaringMessage != null) {
|
||||
if (forwaringMessage.messageOwner.id > 0) {
|
||||
if (!param) {
|
||||
MessagesController.getInstance().sendMessage(forwaringMessage, did);
|
||||
} else {
|
||||
processForwardFromMe(forwaringMessage, did);
|
||||
}
|
||||
}
|
||||
forwaringMessage = null;
|
||||
} else {
|
||||
ArrayList<Integer> ids = new ArrayList<Integer>(selectedMessagesIds.keySet());
|
||||
Collections.sort(ids);
|
||||
for (Integer id : ids) {
|
||||
if (id > 0) {
|
||||
if (!param) {
|
||||
MessagesController.getInstance().sendMessage(selectedMessagesIds.get(id), did);
|
||||
} else {
|
||||
processForwardFromMe(selectedMessagesIds.get(id), did);
|
||||
}
|
||||
}
|
||||
}
|
||||
selectedMessagesCanCopyIds.clear();
|
||||
selectedMessagesIds.clear();
|
||||
}
|
||||
|
||||
if (did != dialog_id) {
|
||||
int lower_part = (int)did;
|
||||
if (lower_part != 0) {
|
||||
activity.removeSelfFromStack();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("scrollToTopOnResume", scrollToTopOnResume);
|
||||
if (lower_part > 0) {
|
||||
|
@ -2899,14 +2901,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
} else if (lower_part < 0) {
|
||||
args.putInt("chat_id", -lower_part);
|
||||
}
|
||||
presentFragment(new ChatActivity(args));
|
||||
|
||||
presentFragment(new ChatActivity(args), true);
|
||||
removeSelfFromStack();
|
||||
forwardSelectedMessages(did, param);
|
||||
} else {
|
||||
activity.finishFragment();
|
||||
}
|
||||
} else {
|
||||
activity.finishFragment();
|
||||
forwardSelectedMessages(did, param);
|
||||
chatListView.setSelectionFromTop(messages.size() - 1, -100000 - chatListView.getPaddingTop());
|
||||
scrollToTopOnResume = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue