Fix wrong tabs after forward

This commit is contained in:
luvletter2333 2021-08-03 18:08:27 +08:00
parent 0fd1f7ba12
commit 32097cc6e0
No known key found for this signature in database
GPG Key ID: BFD68B892BECC1D8
2 changed files with 15 additions and 1 deletions

View File

@ -98,6 +98,8 @@ public class MessagesController extends BaseController implements NotificationCe
public ArrayList<TLRPC.Dialog> dialogsForBlock = new ArrayList<>();
public ArrayList<TLRPC.Dialog> dialogsGroupsOnly = new ArrayList<>();
public DialogFilter[] selectedDialogFilter = new DialogFilter[2];
public DialogFilter[] selectedDialogFilterBackup = new DialogFilter[2];
// Fix tabs after forward, when NekoConfig.showTabsOnForward is enabled
private int dialogsLoadedTillDate = Integer.MAX_VALUE;
public int unreadUnmutedDialogs;
public ConcurrentHashMap<Long, Integer> dialogs_read_inbox_max = new ConcurrentHashMap<>(100, 1.0f, 2);

View File

@ -1847,9 +1847,14 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
}
getNotificationCenter().addObserver(this, NotificationCenter.messagesDeleted);
getNotificationCenter().addObserver(this, NotificationCenter.didClearDatabase);
if (initialDialogsType == 3 && NekoConfig.showTabsOnForward) {
// Fix wrong tabs after forward
getMessagesController().selectedDialogFilterBackup[0] = getMessagesController().selectedDialogFilter[0];
getMessagesController().selectedDialogFilterBackup[1] = getMessagesController().selectedDialogFilter[1];
}
loadDialogs(getAccountInstance());
getMessagesController().loadPinnedDialogs(folderId, 0, null);
return true;
@ -1878,6 +1883,13 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter.
@Override
public void onFragmentDestroy() {
super.onFragmentDestroy();
if (initialDialogsType == 3 && NekoConfig.showTabsOnForward) {
// Fix wrong tabs after forward
getMessagesController().selectedDialogFilter[0] = getMessagesController().selectedDialogFilterBackup[0];
getMessagesController().selectedDialogFilter[1] = getMessagesController().selectedDialogFilterBackup[1];
}
if (searchString == null) {
getNotificationCenter().removeObserver(this, NotificationCenter.dialogsNeedReload);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiLoaded);