mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-19 23:31:03 +10:00
remove inversal for outgoing path
This commit is contained in:
@@ -33,7 +33,7 @@ class ChannelMessagePathScreen extends StatelessWidget {
|
|||||||
return Consumer<MeshCoreConnector>(
|
return Consumer<MeshCoreConnector>(
|
||||||
builder: (context, connector, _) {
|
builder: (context, connector, _) {
|
||||||
final l10n = context.l10n;
|
final l10n = context.l10n;
|
||||||
final primaryPathTmp = _selectPrimaryPath(
|
final primaryPath = _selectPrimaryPath(
|
||||||
message.pathBytes,
|
message.pathBytes,
|
||||||
message.pathVariants,
|
message.pathVariants,
|
||||||
);
|
);
|
||||||
@@ -42,9 +42,6 @@ class ChannelMessagePathScreen extends StatelessWidget {
|
|||||||
(message.pathHashWidth ?? connector.pathHashByteWidth)
|
(message.pathHashWidth ?? connector.pathHashByteWidth)
|
||||||
.clamp(1, 4)
|
.clamp(1, 4)
|
||||||
.toInt();
|
.toInt();
|
||||||
final primaryPath = !channelMessage && !message.isOutgoing
|
|
||||||
? _reversePathByHop(primaryPathTmp, hashByteWidth)
|
|
||||||
: primaryPathTmp;
|
|
||||||
final hops = _buildPathHops(
|
final hops = _buildPathHops(
|
||||||
primaryPath,
|
primaryPath,
|
||||||
connector,
|
connector,
|
||||||
@@ -86,8 +83,7 @@ class ChannelMessagePathScreen extends StatelessWidget {
|
|||||||
title: context.l10n.contacts_repeaterPathTrace,
|
title: context.l10n.contacts_repeaterPathTrace,
|
||||||
path: primaryPath,
|
path: primaryPath,
|
||||||
flipPathAround: true,
|
flipPathAround: true,
|
||||||
reversePathAround:
|
reversePathAround: false,
|
||||||
!(!channelMessage && !message.isOutgoing),
|
|
||||||
pathHashByteWidth: hashByteWidth,
|
pathHashByteWidth: hashByteWidth,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -485,7 +481,7 @@ class _ChannelMessagePathMapScreenState
|
|||||||
widget.message.pathVariants,
|
widget.message.pathVariants,
|
||||||
);
|
);
|
||||||
final isDesktop = _isDesktopPlatform(defaultTargetPlatform);
|
final isDesktop = _isDesktopPlatform(defaultTargetPlatform);
|
||||||
final selectedPathTmp = _resolveSelectedPath(
|
final selectedPath = _resolveSelectedPath(
|
||||||
_selectedPath,
|
_selectedPath,
|
||||||
observedPaths,
|
observedPaths,
|
||||||
primaryPath,
|
primaryPath,
|
||||||
@@ -495,12 +491,7 @@ class _ChannelMessagePathMapScreenState
|
|||||||
(widget.message.pathHashWidth ?? connector.pathHashByteWidth)
|
(widget.message.pathHashWidth ?? connector.pathHashByteWidth)
|
||||||
.clamp(1, 4)
|
.clamp(1, 4)
|
||||||
.toInt();
|
.toInt();
|
||||||
final selectedPath =
|
final selectedIndex = _indexForPath(selectedPath, observedPaths);
|
||||||
((!widget.message.isOutgoing && !widget.channelMessage) ||
|
|
||||||
(widget.message.isOutgoing && widget.channelMessage))
|
|
||||||
? _reversePathByHop(selectedPathTmp, width)
|
|
||||||
: selectedPathTmp;
|
|
||||||
final selectedIndex = _indexForPath(selectedPathTmp, observedPaths);
|
|
||||||
final hops = _buildPathHops(
|
final hops = _buildPathHops(
|
||||||
selectedPath,
|
selectedPath,
|
||||||
connector,
|
connector,
|
||||||
@@ -1087,17 +1078,6 @@ String _formatPathPrefixes(Uint8List pathBytes, int hashByteWidth) {
|
|||||||
).map(PathHelper.formatHopHex).join(',');
|
).map(PathHelper.formatHopHex).join(',');
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint8List _reversePathByHop(Uint8List pathBytes, int hashByteWidth) {
|
|
||||||
final hops = PathHelper.splitPathBytes(pathBytes, hashByteWidth);
|
|
||||||
if (hops.length <= 1) return Uint8List.fromList(pathBytes);
|
|
||||||
|
|
||||||
final reversedBytes = <int>[];
|
|
||||||
for (final hop in hops.reversed) {
|
|
||||||
reversedBytes.addAll(hop);
|
|
||||||
}
|
|
||||||
return Uint8List.fromList(reversedBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _hopCountFromBytes(int byteCount, int hashByteWidth) {
|
int _hopCountFromBytes(int byteCount, int hashByteWidth) {
|
||||||
if (byteCount <= 0) return 0;
|
if (byteCount <= 0) return 0;
|
||||||
final width = hashByteWidth.clamp(1, 4);
|
final width = hashByteWidth.clamp(1, 4);
|
||||||
|
|||||||
Reference in New Issue
Block a user