Merge remote-tracking branch 'origin/dev' into ez_display_region
# Conflicts: # lib/connector/meshcore_connector.dart # lib/models/channel_message.dart # lib/screens/channel_chat_screen.dart
This commit is contained in:
commit
7134bac7f7
146 files changed
+18000
-3160
No files matched your search
@@ -161,7 +161,7 @@ class ChannelMessage {
|
||||
return null;
|
||||
}
|
||||
|
||||
int pathLen;
|
||||
int? pathLen;
|
||||
int txtType;
|
||||
int? packetPathHashWidth;
|
||||
Uint8List pathBytes = Uint8List(0);
|
||||
@@ -173,20 +173,24 @@ class ChannelMessage {
|
||||
reader.skipBytes(1); // Skip reserved byte
|
||||
channelIdx = reader.readByte();
|
||||
final pathByte = reader.readUInt8();
|
||||
// pathByte packs: top 2 bits = hash width mode, low 6 bits = hop count
|
||||
packetPathHashWidth = ((pathByte & 0xC0) >> 6) + 1;
|
||||
final hopCount = pathByte & 0x3F;
|
||||
pathLen = hopCount;
|
||||
// If a path is present, read hopCount * width bytes
|
||||
if (hasPath && hopCount > 0) {
|
||||
final totalPathBytes = hopCount * packetPathHashWidth;
|
||||
pathBytes = reader.readBytes(totalPathBytes);
|
||||
// 0xFF = direct-routed; hop count is not reported.
|
||||
if (pathByte != 0xFF) {
|
||||
// pathByte packs: top 2 bits = hash width mode, low 6 bits = hop count
|
||||
packetPathHashWidth = ((pathByte & 0xC0) >> 6) + 1;
|
||||
final hopCount = pathByte & 0x3F;
|
||||
pathLen = hopCount;
|
||||
// If a path is present, read hopCount * width bytes
|
||||
if (hasPath && hopCount > 0) {
|
||||
final totalPathBytes = hopCount * packetPathHashWidth;
|
||||
pathBytes = reader.readBytes(totalPathBytes);
|
||||
}
|
||||
}
|
||||
// After consuming optional path bytes, read the text type byte.
|
||||
txtType = reader.readByte();
|
||||
} else {
|
||||
channelIdx = reader.readByte();
|
||||
pathLen = reader.readInt8();
|
||||
final pathByte = reader.readUInt8();
|
||||
pathLen = pathByte == 0xFF ? null : pathByte & 0x3F;
|
||||
txtType = reader.readByte();
|
||||
}
|
||||
final timestampRaw = reader.readUInt32LE();
|
||||
@@ -243,6 +247,7 @@ class ChannelMessage {
|
||||
String? translatedLanguageCode,
|
||||
String? translationModelId,
|
||||
String? region,
|
||||
ChannelMessage? replyTo,
|
||||
}) {
|
||||
return ChannelMessage(
|
||||
senderKey: null,
|
||||
@@ -251,6 +256,9 @@ class ChannelMessage {
|
||||
originalText: originalText,
|
||||
translatedLanguageCode: translatedLanguageCode,
|
||||
translationModelId: translationModelId,
|
||||
replyToMessageId: replyTo?.messageId,
|
||||
replyToSenderName: replyTo?.senderName,
|
||||
replyToText: replyTo?.text,
|
||||
timestamp: DateTime.now(),
|
||||
isOutgoing: true,
|
||||
status: ChannelMessageStatus.pending,
|
||||
|
||||
Reference in new issue
Block a user