Files
simplex-chat/apps
Narasimha-sc f0f6f7e017 android, desktop: fix pop chat collector reading the primary chat list
PopChatCollector is created per ChatsContext, but it was a nested class
taking the context as a constructor parameter, so only its init block held
a reference to it. popCollectedChats() is a separate method, and a nested
class has no enclosing instance, so the unqualified getChat() and chats in
it did not resolve to ChatsContext - they resolved outward to the ChatModel
object, whose chats is the primary list. The method therefore built a
reordered copy of the primary chat list, and init installed it as the
secondary context's list.

With a group reports view or a member support chat open, receiving a
message from one chat, then another, then the first again gives the first
chat a non-zero position in the secondary list, which schedules a pop; two
seconds later the secondary context's chat list is replaced by the primary
one. ChatView derives the unread count of the open chat from that list, so
the reports or member support view then shows the count of the group's main
chat.

Make the class inner. getChat and chats then resolve to the context that
owns the collector, and the same mistake cannot be reintroduced by adding
another method to it. Nothing changes for the primary context, where the
two lists are the same.
2026-08-20 14:42:40 +00:00
..
2026-08-20 13:43:59 +01:00