mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-12 11:52:07 +10:00
Updated to last dev
This commit is contained in:
@@ -97,7 +97,9 @@ class _PathEditorSheetState extends State<PathEditorSheet> {
|
||||
|
||||
void _syncHexFromHops() {
|
||||
_syncingHex = true;
|
||||
_hexController.text = _hops.map((h) => PathHelper.formatHopHex(h.bytes)).join(',');
|
||||
_hexController.text = _hops
|
||||
.map((h) => PathHelper.formatHopHex(h.bytes))
|
||||
.join(',');
|
||||
_syncingHex = false;
|
||||
_hexError = null;
|
||||
}
|
||||
@@ -114,8 +116,7 @@ class _PathEditorSheetState extends State<PathEditorSheet> {
|
||||
final invalid = tokens
|
||||
.where(
|
||||
(t) =>
|
||||
t.length != expectedChars ||
|
||||
int.tryParse(t, radix: 16) == null,
|
||||
t.length != expectedChars || int.tryParse(t, radix: 16) == null,
|
||||
)
|
||||
.toList();
|
||||
setState(() {
|
||||
@@ -144,10 +145,15 @@ class _PathEditorSheetState extends State<PathEditorSheet> {
|
||||
|
||||
void _addHop(Contact contact) {
|
||||
if (_hops.length >= _maxHops) return;
|
||||
final width = widget.pathHashByteWidth.clamp(1, contact.publicKey.length).toInt();
|
||||
final width = widget.pathHashByteWidth
|
||||
.clamp(1, contact.publicKey.length)
|
||||
.toInt();
|
||||
setState(() {
|
||||
_hops.add(
|
||||
_Hop(_nextHopId++, Uint8List.fromList(contact.publicKey.sublist(0, width))),
|
||||
_Hop(
|
||||
_nextHopId++,
|
||||
Uint8List.fromList(contact.publicKey.sublist(0, width)),
|
||||
),
|
||||
);
|
||||
_syncHexFromHops();
|
||||
});
|
||||
@@ -173,10 +179,7 @@ class _PathEditorSheetState extends State<PathEditorSheet> {
|
||||
for (final hop in _hops) {
|
||||
bytes.addAll(hop.bytes);
|
||||
}
|
||||
Navigator.pop(
|
||||
context,
|
||||
Uint8List.fromList(bytes),
|
||||
);
|
||||
Navigator.pop(context, Uint8List.fromList(bytes));
|
||||
}
|
||||
|
||||
Widget _hopTile(BuildContext context, int index) {
|
||||
|
||||
@@ -547,9 +547,15 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> {
|
||||
connector.pathHashByteWidth,
|
||||
)
|
||||
: l10n.chat_hopsCount(record.hopCount);
|
||||
final displayHopCount = hasBytes
|
||||
? PathHelper.splitPathBytes(
|
||||
record.pathBytes,
|
||||
connector.pathHashByteWidth,
|
||||
).length
|
||||
: record.hopCount;
|
||||
|
||||
final line1 =
|
||||
'${l10n.chat_hopsCount(record.hopCount)} • ${_qualityLabel(context, quality)}';
|
||||
'${l10n.chat_hopsCount(displayHopCount)} • ${_qualityLabel(context, quality)}';
|
||||
final line2Parts = <String>[
|
||||
record.timestamp != null
|
||||
? l10n.routing_lastWorked(_relativeTime(context, record.timestamp!))
|
||||
|
||||
Reference in New Issue
Block a user