Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mobile/lib/features/channels/channel_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import 'dm_voice_agent_provider.dart';
import 'message_actions.dart';
import 'message_action_backdrop_state.dart';
import 'message_long_press_region.dart';
import 'message_reply_drag_target.dart';
import 'message_content.dart';
import 'message_media_avatar.dart';
import 'message_skeleton_body.dart';
Expand Down
186 changes: 93 additions & 93 deletions mobile/lib/features/channels/channel_detail_page/message_bubble.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ class _MessageBubble extends HookConsumerWidget {
borderRadius: BorderRadius.circular(Radii.md),
highlightColor: context.colors.primary.withValues(alpha: 0.1),
snapshotKey: messageSnapshotKey,
// Empty row space beside the message's parts is not the message.
targetsOnly: true,
// Tap opens existing threads; long-press can start a new one.
// MessageContent handles mention, channel-link, and media taps.
onTap: (!hasReplies && !hasLocalReplies) || allMessages == null
Expand Down Expand Up @@ -210,18 +212,21 @@ class _MessageBubble extends HookConsumerWidget {
right: ownMessage ? Grid.xxs : 0,
left: ownMessage ? 0 : Grid.xxs,
),
child: ReactionRow(
combined: true,
messageId: message.id,
channelId: currentChannelId,
reactions: message.reactions,
onToggle: (emoji) =>
toggleReaction(ref, message, emoji),
showAddButton: isMember && !isArchived,
onAddReaction: () => showAddReactionPicker(
context: context,
ref: ref,
message: message,
child: MessageLongPressTarget(
child: ReactionRow(
combined: true,
messageId: message.id,
channelId: currentChannelId,
reactions: message.reactions,
onToggle: (emoji) =>
toggleReaction(ref, message, emoji),
showAddButton: isMember && !isArchived,
onAddReaction: () =>
showAddReactionPicker(
context: context,
ref: ref,
message: message,
),
),
),
),
Expand All @@ -232,7 +237,9 @@ class _MessageBubble extends HookConsumerWidget {
),
child: Directionality(
textDirection: Directionality.of(context),
child: replyFooter!,
child: MessageLongPressTarget(
child: replyFooter!,
),
),
),
],
Expand Down Expand Up @@ -272,73 +279,64 @@ class _MessageBubble extends HookConsumerWidget {
left: ownMessage ? 0 : Grid.xs,
right: ownMessage ? Grid.xs : 0,
),
child: Row(
children: [
Expanded(
child: MessageAuthorMeta(
timestampGap: Grid.half,
showIdentity: showSenderIdentity,
showTimestamp: true,
reversed: false,
alignment: ownMessage
? MainAxisAlignment.end
: MainAxisAlignment.start,
nameStyle:
messageUsernameTextStyle
.copyWith(
fontWeight:
FontWeight.w500,
fontSize: 11,
height: 17 / 11,
),
metadataStyle:
messageMetadataTextStyle
.copyWith(
fontSize: 11,
height: 17 / 11,
),
timestampStyle:
messageTimestampTextStyle
.copyWith(
fontSize: 11,
height: 17 / 11,
),
displayName: ownMessage
? 'You'
: displayName,
username: ownMessage
? null
: messageUsernameLabel(
profile,
),
timestamp: formatMessageTime(
message.createdAt,
),
nameColor:
context.tertiaryTextColor,
metadataColor:
context.tertiaryTextColor,
onAuthorTap: () =>
showUserProfileSheet(
context,
message.pubkey,
names:
channelIdentityNamesProvider(
currentChannelId,
),
),
displayNameKey: ValueKey(
'message-author-${message.id}',
child: MessageLongPressTarget(
child: MessageAuthorMeta(
mainAxisSize: MainAxisSize.min,
timestampGap: Grid.half,
showIdentity: showSenderIdentity,
showTimestamp: true,
reversed: false,
alignment: ownMessage
? MainAxisAlignment.end
: MainAxisAlignment.start,
nameStyle: messageUsernameTextStyle
.copyWith(
fontWeight: FontWeight.w500,
fontSize: 11,
height: 17 / 11,
),
usernameKey: ValueKey(
'message-username-${message.id}',
metadataStyle:
messageMetadataTextStyle.copyWith(
fontSize: 11,
height: 17 / 11,
),
timestampKey: ValueKey(
'message-timestamp-${message.id}',
timestampStyle:
messageTimestampTextStyle
.copyWith(
fontSize: 11,
height: 17 / 11,
),
displayName: ownMessage
? 'You'
: displayName,
username: ownMessage
? null
: messageUsernameLabel(profile),
timestamp: formatMessageTime(
message.createdAt,
),
nameColor: context.tertiaryTextColor,
metadataColor:
context.tertiaryTextColor,
onAuthorTap: () =>
showUserProfileSheet(
context,
message.pubkey,
names:
channelIdentityNamesProvider(
currentChannelId,
),
),
),
displayNameKey: ValueKey(
'message-author-${message.id}',
),
usernameKey: ValueKey(
'message-username-${message.id}',
),
timestampKey: ValueKey(
'message-timestamp-${message.id}',
),
],
),
),
),
AgentReplyHandoff(
Expand Down Expand Up @@ -450,30 +448,32 @@ class _MessageBubble extends HookConsumerWidget {
bottom: 0,
child: MessageMediaAvatar(
offset: mediaOffset,
child: Semantics(
container: true,
label: 'Open $displayName profile',
button: true,
excludeSemantics: true,
onTap: () => showUserProfileSheet(
context,
message.pubkey,
names: channelIdentityNamesProvider(
currentChannelId,
),
),
child: GestureDetector(
child: MessageLongPressTarget(
child: Semantics(
container: true,
label: 'Open $displayName profile',
button: true,
excludeSemantics: true,
onTap: () => showUserProfileSheet(
context,
message.pubkey,
names: channelIdentityNamesProvider(
currentChannelId,
),
),
child: _UserAvatar(
profile: profile,
pubkey: message.pubkey,
isAgent: isAgent,
child: GestureDetector(
onTap: () => showUserProfileSheet(
context,
message.pubkey,
names: channelIdentityNamesProvider(
currentChannelId,
),
),
child: _UserAvatar(
profile: profile,
pubkey: message.pubkey,
isAgent: isAgent,
),
),
),
),
Expand Down
15 changes: 4 additions & 11 deletions mobile/lib/features/channels/message_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -599,19 +599,12 @@ class MessageContent extends HookConsumerWidget {
: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
if (bubble)
Padding(
padding: const EdgeInsets.symmetric(horizontal: Grid.xs),
child: Text(
'${trailingGallery.items.length} ${trailingGallery.items.any((item) => item.isVideo) ? 'attachments' : 'photos'}',
key: const ValueKey('message-media-stack-count'),
style: context.textTheme.labelSmall?.copyWith(
color: context.colors.onSurfaceVariant,
),
),
),
if (bubble) _MessageImageStackCount(items: trailingGallery.items),
if (trailingGallery.content.trim().isNotEmpty) markdown,
MessageReplyDragTarget(
// The photo stack is narrower than the row it aligns itself in, so
// it marks its own deck for the long press.
opensActions: !bubble,
child: MessageAttachmentCorners(
borderRadius: _attachmentCorners(
start: bubbleStart && trailingGallery.content.trim().isEmpty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:gpt_markdown/gpt_markdown.dart';

import '../../../shared/theme/theme.dart';
import '../message_reply_drag_target.dart';

/// Marks where an edited body draws its "(edited)" marker. A private-use
/// character. A body that already has one is drawn as written, and its
Expand Down Expand Up @@ -116,11 +117,13 @@ class EditedMarkerBelow extends StatelessWidget {
const EditedMarkerBelow({super.key});

@override
Widget build(BuildContext context) => Padding(
padding: const EdgeInsets.symmetric(horizontal: Grid.xs),
child: Text(
editedMarkerText,
style: editedMarkerStyle(context, own: false),
Widget build(BuildContext context) => MessageLongPressTarget(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: Grid.xs),
child: Text(
editedMarkerText,
style: editedMarkerStyle(context, own: false),
),
),
);
}
Expand Down
Loading
Loading