Merge pull request #686 from zjs81/fix/copy-full-and-special-messages

Preserve reply mentions and support copying image messages
This commit is contained in:
zjs81 authored and GitHub committed 2026-11-21 09:29:37 -07:00
commit 787f1bb931
6 files changed
+703 -6

No files matched your search

+23 -4
View File
@@ -729,7 +729,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
ChatSearchEntry(
id: m.messageId,
sender: m.senderName,
text: m.text,
text: m.fullText,
translatedText: m.translatedText,
time: m.receivedAt,
matchSender: true,
@@ -2540,6 +2540,14 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
),
subtitle: _imageSenderLabel(entry),
),
ListTile(
leading: const Icon(Icons.copy),
title: Text(l10n.common_copy),
onTap: () {
Navigator.pop(sheetContext);
copyChatMessageText(context, _imageCopyText(entry));
},
),
if (canSave)
ListTile(
leading: const Icon(Icons.save_alt),
@@ -2592,6 +2600,17 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
);
}
String _imageCopyText(ReceivedImageEntry entry) {
final l10n = context.l10n;
final lines = <String>[
'${_imageSenderLabel(entry)} (${formatChatTime(context, entry.firstSeen)})',
l10n.receivedImage_awaiting(entry.bitstreamByteCount, entry.totalChunks),
if (entry.state == ReceivedImageState.decoded && entry.synthesized)
l10n.receivedImage_shareCaption(entry.bitstreamByteCount),
];
return lines.join('\n');
}
Future<void> _saveImage(ReceivedImageEntry entry) async {
final l10n = context.l10n;
final shareOrigin = shareOriginOf(context);
@@ -3095,7 +3114,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
title: Text(context.l10n.common_copy),
onTap: () {
Navigator.pop(sheetContext);
copyChatMessageText(context, message.text);
copyChatMessageText(context, message.fullText);
},
),
if (canTranslateMessage)
@@ -3427,8 +3446,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
final text = messages
.map(
(m) => m.senderName.isEmpty || m.isOutgoing
? m.text
: '${m.senderName}: ${m.text}',
? m.fullText
: '${m.senderName}: ${m.fullText}',
)
.join('\n');
setState(_selectedIds.clear);