chore: Follow up threads

This commit is contained in:
Christian Kußowski 2025-11-05 08:38:35 +01:00
commit 39bdc34eb9
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
3 changed files with 32 additions and 16 deletions

View file

@ -77,6 +77,8 @@ class ChatEmojiPicker extends StatelessWidget {
'url': sticker.url.toString(), 'url': sticker.url.toString(),
}, },
type: EventTypes.Sticker, type: EventTypes.Sticker,
threadRootEventId: controller.activeThreadId,
threadLastEventId: controller.threadLastEventId,
); );
controller.hideEmojiPicker(); controller.hideEmojiPicker();
}, },

View file

@ -166,7 +166,9 @@ class ChatView extends StatelessWidget {
final accountConfig = Matrix.of(context).client.applicationAccountConfig; final accountConfig = Matrix.of(context).client.applicationAccountConfig;
return PopScope( return PopScope(
canPop: controller.selectedEvents.isEmpty && !controller.showEmojiPicker, canPop: controller.selectedEvents.isEmpty &&
!controller.showEmojiPicker &&
controller.activeThreadId == null,
onPopInvokedWithResult: (pop, _) async { onPopInvokedWithResult: (pop, _) async {
if (pop) return; if (pop) return;
if (controller.selectedEvents.isNotEmpty) { if (controller.selectedEvents.isNotEmpty) {
@ -215,20 +217,30 @@ class ChatView extends StatelessWidget {
tooltip: L10n.of(context).close, tooltip: L10n.of(context).close,
color: theme.colorScheme.onTertiaryContainer, color: theme.colorScheme.onTertiaryContainer,
) )
: FluffyThemes.isColumnMode(context) : activeThreadId != null
? null ? IconButton(
: StreamBuilder<Object>( icon: const Icon(Icons.close),
stream: onPressed: controller.closeThread,
Matrix.of(context).client.onSync.stream.where( tooltip: L10n.of(context).backToMainChat,
color: theme.colorScheme.onSecondaryContainer,
)
: FluffyThemes.isColumnMode(context)
? null
: StreamBuilder<Object>(
stream: Matrix.of(context)
.client
.onSync
.stream
.where(
(syncUpdate) => syncUpdate.hasRoomUpdate, (syncUpdate) => syncUpdate.hasRoomUpdate,
), ),
builder: (context, _) => UnreadRoomsBadge( builder: (context, _) => UnreadRoomsBadge(
filter: (r) => r.id != controller.roomId, filter: (r) => r.id != controller.roomId,
badgePosition: badgePosition:
BadgePosition.topEnd(end: 8, top: 4), BadgePosition.topEnd(end: 8, top: 4),
child: const Center(child: BackButton()), child: const Center(child: BackButton()),
), ),
), ),
titleSpacing: FluffyThemes.isColumnMode(context) ? 24 : 0, titleSpacing: FluffyThemes.isColumnMode(context) ? 24 : 0,
title: ChatAppBarTitle(controller), title: ChatAppBarTitle(controller),
actions: _appBarActions(context), actions: _appBarActions(context),
@ -242,9 +254,10 @@ class ChatView extends StatelessWidget {
height: ChatAppBarListTile.fixedHeight, height: ChatAppBarListTile.fixedHeight,
child: Center( child: Center(
child: TextButton.icon( child: TextButton.icon(
onPressed: controller.closeThread, onPressed: () =>
label: Text(L10n.of(context).backToMainChat), controller.scrollToEventId(activeThreadId),
icon: const Icon(Icons.message), icon: const Icon(Icons.message),
label: Text(L10n.of(context).replyInThread),
), ),
), ),
), ),

View file

@ -9,7 +9,8 @@ extension VisibleInGuiExtension on List<Event> {
}) => }) =>
where( where(
(event) { (event) {
if (threadId != null) { if (threadId != null &&
event.relationshipType != RelationshipTypes.reaction) {
if ((event.relationshipType != RelationshipTypes.thread || if ((event.relationshipType != RelationshipTypes.thread ||
event.relationshipEventId != threadId) && event.relationshipEventId != threadId) &&
event.eventId != threadId) { event.eventId != threadId) {