Keep chat reading position during sync, selection and app switches

- Room chats: keep the visible message in place when synced messages arrive,
  don't pull a scrolling reader back to the bottom, and keep loaded older
  pages while the chat is open.
- Selecting messages no longer jumps to the newest message.
- Focus returning after a sheet, dialog or app switch no longer counts as
  opening the keyboard.
This commit is contained in:
zjs81 committed 2026-11-20 16:37:51 -07:00
1 parent 34ea0cb7ca
commit ffbb61bc3d
11 files changed
+1431 -10

No files matched your search

+7 -2
View File
@@ -9191,8 +9191,13 @@ class MeshCoreConnector extends ChangeNotifier {
}
messages.add(message);
if (messages.length > _messageWindowSize) {
final trimCount = messages.length - _messageWindowSize;
// The open chat keeps the older pages its reader scrolled back to;
// trimming them would pull the history out from under the reader.
final windowSize = pubKeyHex == _activeContactKey
? MessageStore.maxStoredMessages
: _messageWindowSize;
if (messages.length > windowSize) {
final trimCount = messages.length - windowSize;
_messageStore.archive(pubKeyHex, messages.sublist(0, trimCount));
messages.removeRange(0, trimCount);
}