mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-12 11:52:07 +10:00
Merge pull request #1 from ericszimmermann/ez_snr_multibyte2
Multibyte Support for SNR-Indicator, channel message_bubble and Setting
This commit is contained in:
@@ -15,7 +15,10 @@ class PathHelper {
|
||||
.join();
|
||||
}
|
||||
|
||||
static List<Uint8List> splitPathBytes(List<int> pathBytes, int hashByteWidth) {
|
||||
static List<Uint8List> splitPathBytes(
|
||||
List<int> pathBytes,
|
||||
int hashByteWidth,
|
||||
) {
|
||||
if (pathBytes.isEmpty) return const [];
|
||||
|
||||
final width = hashByteWidth.clamp(1, 4);
|
||||
@@ -50,18 +53,13 @@ class PathHelper {
|
||||
final hex = formatHopHex(hopBytes);
|
||||
|
||||
// Find matching contacts by comparing public key prefix
|
||||
final matches = allContacts
|
||||
.where((c) {
|
||||
if (c.publicKey.length < hopBytes.length) return false;
|
||||
if (c.type != advTypeRepeater && c.type != advTypeRoom) return false;
|
||||
// Compare bytes using listEquals for multi-byte support
|
||||
return listEquals(
|
||||
c.publicKey.sublist(0, hopBytes.length),
|
||||
hopBytes,
|
||||
);
|
||||
})
|
||||
.toList();
|
||||
|
||||
final matches = allContacts.where((c) {
|
||||
if (c.publicKey.length < hopBytes.length) return false;
|
||||
if (c.type != advTypeRepeater && c.type != advTypeRoom) return false;
|
||||
// Compare bytes using listEquals for multi-byte support
|
||||
return listEquals(c.publicKey.sublist(0, hopBytes.length), hopBytes);
|
||||
}).toList();
|
||||
|
||||
if (matches.isEmpty) {
|
||||
parts.add(hex);
|
||||
} else if (matches.length == 1) {
|
||||
@@ -70,7 +68,7 @@ class PathHelper {
|
||||
parts.add(matches.map((c) => c.name).join(' | '));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return parts.join(' \u2192 ');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user