Implement meshcore route rotation

This commit is contained in:
Janez T
2026-03-08 16:46:46 +01:00
parent 17d7c43745
commit 922b40b755

View File

@@ -59,6 +59,7 @@ class _ContactRouteDialogState extends State<ContactRouteDialog> {
int _selectedHashSize = RouteHashPreferences.defaultHashSize;
ParsedContactRoute? _parsedRoute;
String? _errorText;
bool _showRoutingInfo = false;
@override
void initState() {
@@ -188,6 +189,12 @@ class _ContactRouteDialogState extends State<ContactRouteDialog> {
],
const SizedBox(height: 16),
_AutomationRoutingInfo(
isExpanded: _showRoutingInfo,
onToggle: () {
setState(() {
_showRoutingInfo = !_showRoutingInfo;
});
},
autoRouteRotationEnabled: appProvider.autoRouteRotationEnabled,
clearPathOnMaxRetry: appProvider.clearPathOnMaxRetry,
),
@@ -254,10 +261,14 @@ class _ContactRouteDialogState extends State<ContactRouteDialog> {
}
class _AutomationRoutingInfo extends StatelessWidget {
final bool isExpanded;
final VoidCallback onToggle;
final bool autoRouteRotationEnabled;
final bool clearPathOnMaxRetry;
const _AutomationRoutingInfo({
required this.isExpanded,
required this.onToggle,
required this.autoRouteRotationEnabled,
required this.clearPathOnMaxRetry,
});
@@ -276,16 +287,34 @@ class _AutomationRoutingInfo extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
InkWell(
borderRadius: BorderRadius.circular(8),
onTap: onToggle,
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
child: Row(
children: [
Icon(Icons.info_outline, size: 18, color: colorScheme.primary),
Icon(
Icons.info_outline,
size: 18,
color: colorScheme.primary,
),
const SizedBox(width: 8),
Text(
Expanded(
child: Text(
'Automatic direct-send routing',
style: Theme.of(context).textTheme.titleSmall,
),
),
Icon(
isExpanded ? Icons.expand_less : Icons.expand_more,
color: colorScheme.primary,
),
],
),
),
),
if (isExpanded) ...[
const SizedBox(height: 8),
Text(
'Room/contact sends keep one selected path for the whole send chain, retry up to 5 total attempts with 1s, 2s, 4s, and 8s backoff, then try one final nearest repeater if everything else fails.',
@@ -315,6 +344,13 @@ class _AutomationRoutingInfo extends StatelessWidget {
),
],
),
] else ...[
const SizedBox(height: 6),
Text(
'Shows retry, rotation, and final repeater fallback behavior.',
style: Theme.of(context).textTheme.bodySmall,
),
],
],
),
);