From 39bdc34eb942f79343491bcc1baa182f0bf4383f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Wed, 5 Nov 2025 08:38:35 +0100 Subject: [PATCH] chore: Follow up threads --- lib/pages/chat/chat_emoji_picker.dart | 2 + lib/pages/chat/chat_view.dart | 43 ++++++++++++------- .../filtered_timeline_extension.dart | 3 +- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/lib/pages/chat/chat_emoji_picker.dart b/lib/pages/chat/chat_emoji_picker.dart index d20dac9a4..b661367ff 100644 --- a/lib/pages/chat/chat_emoji_picker.dart +++ b/lib/pages/chat/chat_emoji_picker.dart @@ -77,6 +77,8 @@ class ChatEmojiPicker extends StatelessWidget { 'url': sticker.url.toString(), }, type: EventTypes.Sticker, + threadRootEventId: controller.activeThreadId, + threadLastEventId: controller.threadLastEventId, ); controller.hideEmojiPicker(); }, diff --git a/lib/pages/chat/chat_view.dart b/lib/pages/chat/chat_view.dart index 137eb7170..071f952eb 100644 --- a/lib/pages/chat/chat_view.dart +++ b/lib/pages/chat/chat_view.dart @@ -166,7 +166,9 @@ class ChatView extends StatelessWidget { final accountConfig = Matrix.of(context).client.applicationAccountConfig; return PopScope( - canPop: controller.selectedEvents.isEmpty && !controller.showEmojiPicker, + canPop: controller.selectedEvents.isEmpty && + !controller.showEmojiPicker && + controller.activeThreadId == null, onPopInvokedWithResult: (pop, _) async { if (pop) return; if (controller.selectedEvents.isNotEmpty) { @@ -215,20 +217,30 @@ class ChatView extends StatelessWidget { tooltip: L10n.of(context).close, color: theme.colorScheme.onTertiaryContainer, ) - : FluffyThemes.isColumnMode(context) - ? null - : StreamBuilder( - stream: - Matrix.of(context).client.onSync.stream.where( + : activeThreadId != null + ? IconButton( + icon: const Icon(Icons.close), + onPressed: controller.closeThread, + tooltip: L10n.of(context).backToMainChat, + color: theme.colorScheme.onSecondaryContainer, + ) + : FluffyThemes.isColumnMode(context) + ? null + : StreamBuilder( + stream: Matrix.of(context) + .client + .onSync + .stream + .where( (syncUpdate) => syncUpdate.hasRoomUpdate, ), - builder: (context, _) => UnreadRoomsBadge( - filter: (r) => r.id != controller.roomId, - badgePosition: - BadgePosition.topEnd(end: 8, top: 4), - child: const Center(child: BackButton()), - ), - ), + builder: (context, _) => UnreadRoomsBadge( + filter: (r) => r.id != controller.roomId, + badgePosition: + BadgePosition.topEnd(end: 8, top: 4), + child: const Center(child: BackButton()), + ), + ), titleSpacing: FluffyThemes.isColumnMode(context) ? 24 : 0, title: ChatAppBarTitle(controller), actions: _appBarActions(context), @@ -242,9 +254,10 @@ class ChatView extends StatelessWidget { height: ChatAppBarListTile.fixedHeight, child: Center( child: TextButton.icon( - onPressed: controller.closeThread, - label: Text(L10n.of(context).backToMainChat), + onPressed: () => + controller.scrollToEventId(activeThreadId), icon: const Icon(Icons.message), + label: Text(L10n.of(context).replyInThread), ), ), ), diff --git a/lib/utils/matrix_sdk_extensions/filtered_timeline_extension.dart b/lib/utils/matrix_sdk_extensions/filtered_timeline_extension.dart index 18c664b00..1ab307021 100644 --- a/lib/utils/matrix_sdk_extensions/filtered_timeline_extension.dart +++ b/lib/utils/matrix_sdk_extensions/filtered_timeline_extension.dart @@ -9,7 +9,8 @@ extension VisibleInGuiExtension on List { }) => where( (event) { - if (threadId != null) { + if (threadId != null && + event.relationshipType != RelationshipTypes.reaction) { if ((event.relationshipType != RelationshipTypes.thread || event.relationshipEventId != threadId) && event.eventId != threadId) {