mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-20 07:41:03 +10:00
multibyte for snr_indicator and map_filtering.
This commit is contained in:
@@ -805,16 +805,22 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
pathsWithRepeaters = paths.map((path) {
|
||||
final isDirectRepeater =
|
||||
directRepeater != null &&
|
||||
path.pathBytes.isNotEmpty &&
|
||||
directRepeater.pubkeyFirstByte == path.pathBytes.first;
|
||||
directRepeater.matchesPathStart(
|
||||
path.pathBytes,
|
||||
connector.pathHashByteWidth,
|
||||
);
|
||||
final isSecondDirectRepeater =
|
||||
secondDirectRepeater != null &&
|
||||
path.pathBytes.isNotEmpty &&
|
||||
secondDirectRepeater.pubkeyFirstByte == path.pathBytes.first;
|
||||
secondDirectRepeater.matchesPathStart(
|
||||
path.pathBytes,
|
||||
connector.pathHashByteWidth,
|
||||
);
|
||||
final isThirdDirectRepeater =
|
||||
thirdDirectRepeater != null &&
|
||||
path.pathBytes.isNotEmpty &&
|
||||
thirdDirectRepeater.pubkeyFirstByte == path.pathBytes.first;
|
||||
thirdDirectRepeater.matchesPathStart(
|
||||
path.pathBytes,
|
||||
connector.pathHashByteWidth,
|
||||
);
|
||||
|
||||
int ranking = -1;
|
||||
Color color = Colors.grey;
|
||||
|
||||
@@ -1266,7 +1266,7 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PathTraceMapScreen(
|
||||
title: context.l10n.contacts_repeaterPing,
|
||||
path: Uint8List.fromList([contact.publicKey.first]),
|
||||
path: _contactPathPrefix(contact, hw),
|
||||
targetContact: contact,
|
||||
pathHashByteWidth: hw,
|
||||
),
|
||||
@@ -1299,7 +1299,7 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
: context.l10n.contacts_roomPing,
|
||||
path: contact.pathBytesForDisplay.isNotEmpty
|
||||
? contact.pathBytesForDisplay
|
||||
: Uint8List.fromList([contact.publicKey.first]),
|
||||
: _contactPathPrefix(contact, hw),
|
||||
flipPathAround: contact.pathBytesForDisplay.isNotEmpty,
|
||||
targetContact: contact,
|
||||
pathHashByteWidth: hw,
|
||||
@@ -1416,6 +1416,16 @@ class _ContactsScreenState extends State<ContactsScreen>
|
||||
);
|
||||
}
|
||||
|
||||
Uint8List _contactPathPrefix(Contact contact, int hashByteWidth) {
|
||||
if (contact.publicKey.isEmpty) return Uint8List(0);
|
||||
final width = hashByteWidth
|
||||
.clamp(1, pubKeySize)
|
||||
.toInt()
|
||||
.clamp(1, contact.publicKey.length)
|
||||
.toInt();
|
||||
return Uint8List.fromList(contact.publicKey.sublist(0, width));
|
||||
}
|
||||
|
||||
void _confirmDelete(
|
||||
BuildContext context,
|
||||
MeshCoreConnector connector,
|
||||
|
||||
@@ -728,7 +728,10 @@ class _MapScreenState extends State<MapScreen> {
|
||||
for (final repeater in withLocation) {
|
||||
if (repeater.type != advTypeRepeater) continue;
|
||||
if (repeater.publicKey.length < lastHop.length) continue;
|
||||
if (!listEquals(repeater.publicKey.sublist(0, lastHop.length), lastHop)) {
|
||||
if (!listEquals(
|
||||
repeater.publicKey.sublist(0, lastHop.length),
|
||||
lastHop,
|
||||
)) {
|
||||
continue;
|
||||
}
|
||||
anchorSet.add(LatLng(repeater.latitude!, repeater.longitude!));
|
||||
@@ -986,11 +989,21 @@ class _MapScreenState extends State<MapScreen> {
|
||||
}
|
||||
|
||||
if (settings.mapShowOverlaps) {
|
||||
final hopWidth = context
|
||||
.read<MeshCoreConnector>()
|
||||
.pathHashByteWidth
|
||||
.clamp(1, pubKeySize)
|
||||
.toInt();
|
||||
final hasOverlap = contacts
|
||||
.where(
|
||||
(c) =>
|
||||
c.publicKeyHex != contact.publicKeyHex &&
|
||||
c.publicKey.first == contact.publicKey.first &&
|
||||
c.publicKey.length >= hopWidth &&
|
||||
contact.publicKey.length >= hopWidth &&
|
||||
listEquals(
|
||||
c.publicKey.sublist(0, hopWidth),
|
||||
contact.publicKey.sublist(0, hopWidth),
|
||||
) &&
|
||||
(c.type == advTypeRepeater || c.type == advTypeRoom) &&
|
||||
(contact.type == advTypeRepeater ||
|
||||
contact.type == advTypeRoom),
|
||||
|
||||
Reference in New Issue
Block a user