mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-09 18:22:48 +10:00
Refactor path handling in ChannelMessagePathScreen to improve logic for outgoing messages and channel messages
This commit is contained in:
@@ -64,7 +64,7 @@ class DirectRepeater {
|
|||||||
lastUpdated.millisecondsSinceEpoch;
|
lastUpdated.millisecondsSinceEpoch;
|
||||||
final maxAgeMs = maxAgeMinutes * 60 * 1000;
|
final maxAgeMs = maxAgeMinutes * 60 * 1000;
|
||||||
final recencyScore = (maxAgeMs - ageMs).clamp(0, maxAgeMs);
|
final recencyScore = (maxAgeMs - ageMs).clamp(0, maxAgeMs);
|
||||||
return (snr * snr).round() + recencyScore;
|
return ((snr - 31.75) * 1000).round() + recencyScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isStale() {
|
bool isStale() {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class ChannelMessagePathScreen extends StatelessWidget {
|
|||||||
title: context.l10n.contacts_repeaterPathTrace,
|
title: context.l10n.contacts_repeaterPathTrace,
|
||||||
path: primaryPath,
|
path: primaryPath,
|
||||||
flipPathRound: true,
|
flipPathRound: true,
|
||||||
reversePathRound: !message.isOutgoing,
|
reversePathRound: !message.isOutgoing && !channelMessage,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -165,7 +165,11 @@ class ChannelMessagePathScreen extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
subtitle: Text(_formatPathPrefixes(variants[i])),
|
subtitle: Text(_formatPathPrefixes(variants[i])),
|
||||||
trailing: const Icon(Icons.map_outlined, size: 20),
|
trailing: const Icon(Icons.map_outlined, size: 20),
|
||||||
onTap: () => _openPathMap(context, initialPath: variants[i]),
|
onTap: () => _openPathMap(
|
||||||
|
context,
|
||||||
|
initialPath: variants[i],
|
||||||
|
channelMessage: channelMessage,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -344,7 +348,9 @@ class _ChannelMessagePathMapScreenState
|
|||||||
primaryPath,
|
primaryPath,
|
||||||
);
|
);
|
||||||
|
|
||||||
final selectedPath = !widget.channelMessage && widget.message.isOutgoing
|
final selectedPath =
|
||||||
|
((!widget.message.isOutgoing && !widget.channelMessage) ||
|
||||||
|
(widget.message.isOutgoing && widget.channelMessage))
|
||||||
? Uint8List.fromList(selectedPathTmp.reversed.toList())
|
? Uint8List.fromList(selectedPathTmp.reversed.toList())
|
||||||
: selectedPathTmp;
|
: selectedPathTmp;
|
||||||
|
|
||||||
@@ -356,12 +362,24 @@ class _ChannelMessagePathMapScreenState
|
|||||||
);
|
);
|
||||||
|
|
||||||
final points = <LatLng>[];
|
final points = <LatLng>[];
|
||||||
|
print(
|
||||||
|
'outgoing: ${widget.message.isOutgoing}, channelMsg: ${widget.channelMessage}',
|
||||||
|
);
|
||||||
|
if ((widget.message.isOutgoing && !widget.channelMessage) ||
|
||||||
|
(widget.message.isOutgoing && widget.channelMessage)) {
|
||||||
|
points.add(LatLng(connector.selfLatitude!, connector.selfLongitude!));
|
||||||
|
}
|
||||||
|
|
||||||
for (final hop in hops) {
|
for (final hop in hops) {
|
||||||
if (hop.hasLocation) {
|
if (hop.hasLocation) {
|
||||||
points.add(hop.position!);
|
points.add(hop.position!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
points.add(LatLng(connector.selfLatitude!, connector.selfLongitude!));
|
|
||||||
|
if ((!widget.message.isOutgoing && !widget.channelMessage) ||
|
||||||
|
(!widget.message.isOutgoing && widget.channelMessage)) {
|
||||||
|
points.add(LatLng(connector.selfLatitude!, connector.selfLongitude!));
|
||||||
|
}
|
||||||
|
|
||||||
final polylines = points.length > 1
|
final polylines = points.length > 1
|
||||||
? [
|
? [
|
||||||
|
|||||||
Reference in New Issue
Block a user