Add trace button and raw packets

This commit is contained in:
Janez T
2026-03-05 08:02:39 +01:00
parent 13b91e3cc9
commit b12567f613
2 changed files with 139 additions and 74 deletions

View File

@@ -769,8 +769,6 @@ class _MessagesTabState extends State<MessagesTab> {
final connectionProvider = context.read<ConnectionProvider>();
final messagesProvider = context.read<MessagesProvider>();
final voiceProvider = context.read<VoiceProvider>();
// Insert the chat placeholder before sending (so it appears immediately).
final msgId = 'voice_${sessionId}_sent';
final devicePublicKey = connectionProvider.deviceInfo.publicKey;
final senderPublicKeyPrefix =
@@ -782,24 +780,6 @@ class _MessagesTabState extends State<MessagesTab> {
MessageDestinationPreferences.destinationTypeChannel;
final recipient = _selectedRecipient;
final channelIdx = isChannel ? (recipient?.publicKey[1] ?? 0) : null;
final sentMsg = Message(
id: msgId,
messageType: (!isChannel && recipient != null)
? MessageType.contact
: MessageType.channel,
senderPublicKeyPrefix: senderPublicKeyPrefix,
pathLen: 0,
textType: MessageTextType.plain,
senderTimestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
text: '',
receivedAt: DateTime.now(),
deliveryStatus: MessageDeliveryStatus.sent,
isVoice: true,
voiceId: sessionId,
channelIdx: channelIdx,
recipientPublicKey: isChannel ? null : recipient?.publicKey,
);
messagesProvider.addSentMessage(sentMsg);
final encodedPackets = <VoicePacket>[];
debugPrint(
@@ -859,6 +839,26 @@ class _MessagesTabState extends State<MessagesTab> {
);
final envelopeText = envelope.encodeText();
// Insert placeholder with real VE1 envelope text so technical details are populated.
final sentMsg = Message(
id: msgId,
messageType: (!isChannel && recipient != null)
? MessageType.contact
: MessageType.channel,
senderPublicKeyPrefix: senderPublicKeyPrefix,
pathLen: 0,
textType: MessageTextType.plain,
senderTimestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
text: envelopeText,
receivedAt: DateTime.now(),
deliveryStatus: MessageDeliveryStatus.sent,
isVoice: true,
voiceId: sessionId,
channelIdx: channelIdx,
recipientPublicKey: isChannel ? null : recipient?.publicKey,
);
messagesProvider.addSentMessage(sentMsg);
try {
if (isChannel) {
await connectionProvider.sendChannelMessage(