Files
simplex-chat/apps
Narasimha-sc 9b4c626d4b 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, and the secondary context's chat list is then 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 so do they in any method added to it later.
Nothing changes for the primary context, where the two lists are the
same.
2026-10-19 10:36:26 +00:00
..
2026-10-17 19:23:53 +01:00