Updated to last dev

This commit is contained in:
HDDen
2026-06-12 14:44:09 +03:00
parent d06a4c1861
commit 27695d372a
8 changed files with 75 additions and 34 deletions
+1 -1
View File
@@ -271,7 +271,7 @@ class _ChannelsScreenState extends State<ChannelsScreen>
),
buildDefaultDragHandles: false,
itemCount: filteredChannels.length,
onReorder: (oldIndex, newIndex) {
onReorderItem: (oldIndex, newIndex) {
final reordered = List<Channel>.from(
filteredChannels,
);
+25 -3
View File
@@ -12,6 +12,7 @@ import '../utils/platform_info.dart';
import '../connector/meshcore_connector.dart';
import '../connector/meshcore_protocol.dart';
import '../helpers/cyr2lat.dart';
import '../helpers/path_helper.dart';
import '../helpers/reaction_helper.dart';
import '../widgets/message_status_icon.dart';
import '../widgets/empty_state.dart';
@@ -727,17 +728,35 @@ class _ChatScreenState extends State<ChatScreen> {
}
String _currentPathLabel(Contact contact) {
final connector = context.read<MeshCoreConnector>();
// Check if user has set a path override
if (contact.pathOverride != null) {
if (contact.pathOverride! < 0) return context.l10n.chat_floodForced;
if (contact.pathOverride == 0) return context.l10n.chat_directForced;
return context.l10n.chat_hopsForced(contact.pathOverride!);
final bytes = contact.pathOverrideBytes ?? Uint8List(0);
final hopCount = _displayHopCount(
bytes,
contact.pathOverride!,
connector.pathHashByteWidth,
);
return context.l10n.chat_hopsForced(hopCount);
}
// Use device's path
if (contact.pathLength < 0) return context.l10n.chat_floodAuto;
if (contact.pathLength == 0) return context.l10n.chat_direct;
return context.l10n.chat_hopsCount(contact.pathLength);
final hopCount = _displayHopCount(
contact.path,
contact.pathLength,
connector.pathHashByteWidth,
);
return context.l10n.chat_hopsCount(hopCount);
}
int _displayHopCount(List<int> pathBytes, int storedHopCount, int hashWidth) {
if (pathBytes.isEmpty) return storedHopCount;
return PathHelper.splitPathBytes(pathBytes, hashWidth).length;
}
void _showContactInfo(BuildContext context) {
@@ -758,7 +777,10 @@ class _ChatScreenState extends State<ChatScreen> {
),
_buildInfoRow(
context.l10n.chat_path,
contact.pathLabel(context.l10n),
contact.pathLabel(
context.l10n,
pathHashByteWidth: connector.pathHashByteWidth,
),
),
_buildInfoRow(
context.l10n.contact_lastSeen,
+4 -1
View File
@@ -911,6 +911,7 @@ class _ContactsScreenState extends State<ContactsScreen>
);
return _ContactTile(
contact: contact,
pathHashByteWidth: connector.pathHashByteWidth,
lastSeen: _resolveLastSeen(contact),
unreadCount: unreadCount,
isFavorite: contact.isFavorite,
@@ -1553,6 +1554,7 @@ class _ContactsScreenState extends State<ContactsScreen>
class _ContactTile extends StatelessWidget {
final Contact contact;
final int pathHashByteWidth;
final DateTime lastSeen;
final int unreadCount;
final bool isFavorite;
@@ -1561,6 +1563,7 @@ class _ContactTile extends StatelessWidget {
const _ContactTile({
required this.contact,
required this.pathHashByteWidth,
required this.lastSeen,
required this.unreadCount,
required this.isFavorite,
@@ -1579,7 +1582,7 @@ class _ContactTile extends StatelessWidget {
),
title: Text(contact.name, maxLines: 1, overflow: TextOverflow.ellipsis),
subtitle: Text(
contact.pathLabel(context.l10n),
contact.pathLabel(context.l10n, pathHashByteWidth: pathHashByteWidth),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
+1 -7
View File
@@ -2468,10 +2468,7 @@ class _MapScreenState extends State<MapScreen> {
builder: (context) => PathTraceMapScreen(
title: l10n.contacts_pathTrace,
path: Uint8List.fromList(_pathTrace),
flipPathAround: true,
targetContact: _pathTraceContacts.isNotEmpty
? _pathTraceContacts.last
: null,
flipPathAround: false,
pathHashByteWidth: hashW,
pathContacts: _pathTraceContacts,
),
@@ -2494,9 +2491,6 @@ class _MapScreenState extends State<MapScreen> {
title: l10n.contacts_pathTrace,
path: Uint8List.fromList(_pathTrace),
flipPathAround: true,
targetContact: _pathTraceContacts.isNotEmpty
? _pathTraceContacts.last
: null,
pathHashByteWidth: context
.read<MeshCoreConnector>()
.pathHashByteWidth,