Fix read on non-current tabs

This commit is contained in:
世界 2021-02-07 00:19:28 +08:00
parent 7eac5f48ef
commit 3587c48fec
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
2 changed files with 28 additions and 1 deletions

View File

@ -13647,6 +13647,29 @@ public class MessagesController extends BaseController implements NotificationCe
return clearingHistoryDialogs.get(did) != null;
}
public void loadTabDialogs(MessagesController.DialogFilter dialogFilter) {
sortingDialogFilter = dialogFilter;
Collections.sort(allDialogs, dialogDateComparator);
ArrayList<TLRPC.Dialog> dialogsByFilter = sortingDialogFilter.dialogs;
for (int a = 0, N = allDialogs.size(); a < N; a++) {
TLRPC.Dialog d = allDialogs.get(a);
if (d instanceof TLRPC.TL_dialog) {
int high_id = (int) (d.id >> 32);
int lower_id = (int) d.id;
if (lower_id == 0 && high_id != 0) {
TLRPC.EncryptedChat encryptedChat = getEncryptedChat(high_id);
if (encryptedChat != null) {
lower_id = encryptedChat.user_id;
}
}
if (sortingDialogFilter.includesDialog(getAccountInstance(), lower_id, d)) {
dialogsByFilter.add(d);
}
}
}
}
public void sortDialogs(SparseArray<TLRPC.Chat> chatsDict) {
dialogsServerOnly.clear();
dialogsCanAddUsers.clear();

View File

@ -2228,9 +2228,12 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
showDeleteAlert(dialogFilter);
} else {
if (dialogFilter == null) {
int folderId = tabView.getId() == Integer.MAX_VALUE ? -1 : -1;
int folderId = tabView.getId() == Integer.MAX_VALUE ? 0 : -1;
getMessagesStorage().readAllDialogs(folderId);
} else {
if (dialogFilter.dialogs.isEmpty()) {
getMessagesController().loadTabDialogs(dialogFilter);
}
for (TLRPC.Dialog dialog : dialogFilter.dialogs) {
if (dialog.unread_count == 0 && dialog.unread_mentions_count == 0)
continue;
@ -2244,6 +2247,7 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
});
}
scrollView.addView(linearLayout, LayoutHelper.createScroll(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP));
scrimPopupWindow = new ActionBarPopupWindow(popupLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) {
@Override