mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
Implement meshcore route rotation
This commit is contained in:
@@ -59,6 +59,7 @@ class _ContactRouteDialogState extends State<ContactRouteDialog> {
|
|||||||
int _selectedHashSize = RouteHashPreferences.defaultHashSize;
|
int _selectedHashSize = RouteHashPreferences.defaultHashSize;
|
||||||
ParsedContactRoute? _parsedRoute;
|
ParsedContactRoute? _parsedRoute;
|
||||||
String? _errorText;
|
String? _errorText;
|
||||||
|
bool _showRoutingInfo = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -188,6 +189,12 @@ class _ContactRouteDialogState extends State<ContactRouteDialog> {
|
|||||||
],
|
],
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
_AutomationRoutingInfo(
|
_AutomationRoutingInfo(
|
||||||
|
isExpanded: _showRoutingInfo,
|
||||||
|
onToggle: () {
|
||||||
|
setState(() {
|
||||||
|
_showRoutingInfo = !_showRoutingInfo;
|
||||||
|
});
|
||||||
|
},
|
||||||
autoRouteRotationEnabled: appProvider.autoRouteRotationEnabled,
|
autoRouteRotationEnabled: appProvider.autoRouteRotationEnabled,
|
||||||
clearPathOnMaxRetry: appProvider.clearPathOnMaxRetry,
|
clearPathOnMaxRetry: appProvider.clearPathOnMaxRetry,
|
||||||
),
|
),
|
||||||
@@ -254,10 +261,14 @@ class _ContactRouteDialogState extends State<ContactRouteDialog> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _AutomationRoutingInfo extends StatelessWidget {
|
class _AutomationRoutingInfo extends StatelessWidget {
|
||||||
|
final bool isExpanded;
|
||||||
|
final VoidCallback onToggle;
|
||||||
final bool autoRouteRotationEnabled;
|
final bool autoRouteRotationEnabled;
|
||||||
final bool clearPathOnMaxRetry;
|
final bool clearPathOnMaxRetry;
|
||||||
|
|
||||||
const _AutomationRoutingInfo({
|
const _AutomationRoutingInfo({
|
||||||
|
required this.isExpanded,
|
||||||
|
required this.onToggle,
|
||||||
required this.autoRouteRotationEnabled,
|
required this.autoRouteRotationEnabled,
|
||||||
required this.clearPathOnMaxRetry,
|
required this.clearPathOnMaxRetry,
|
||||||
});
|
});
|
||||||
@@ -276,45 +287,70 @@ class _AutomationRoutingInfo extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
InkWell(
|
||||||
children: [
|
borderRadius: BorderRadius.circular(8),
|
||||||
Icon(Icons.info_outline, size: 18, color: colorScheme.primary),
|
onTap: onToggle,
|
||||||
const SizedBox(width: 8),
|
child: Padding(
|
||||||
Text(
|
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||||
'Automatic direct-send routing',
|
child: Row(
|
||||||
style: Theme.of(context).textTheme.titleSmall,
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.info_outline,
|
||||||
|
size: 18,
|
||||||
|
color: colorScheme.primary,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
'Automatic direct-send routing',
|
||||||
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
isExpanded ? Icons.expand_less : Icons.expand_more,
|
||||||
|
color: colorScheme.primary,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
|
||||||
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.',
|
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Text(
|
|
||||||
'Public and channel broadcasts are not affected by this automation.',
|
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Wrap(
|
|
||||||
spacing: 8,
|
|
||||||
runSpacing: 8,
|
|
||||||
children: [
|
|
||||||
_InfoChip(
|
|
||||||
label: autoRouteRotationEnabled
|
|
||||||
? 'Auto route rotation on'
|
|
||||||
: 'Auto route rotation off',
|
|
||||||
icon: Icons.swap_horiz,
|
|
||||||
),
|
|
||||||
_InfoChip(
|
|
||||||
label: clearPathOnMaxRetry
|
|
||||||
? 'Clear path on max retry on'
|
|
||||||
: 'Clear path on max retry off',
|
|
||||||
icon: Icons.route,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
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.',
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'Public and channel broadcasts are not affected by this automation.',
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Wrap(
|
||||||
|
spacing: 8,
|
||||||
|
runSpacing: 8,
|
||||||
|
children: [
|
||||||
|
_InfoChip(
|
||||||
|
label: autoRouteRotationEnabled
|
||||||
|
? 'Auto route rotation on'
|
||||||
|
: 'Auto route rotation off',
|
||||||
|
icon: Icons.swap_horiz,
|
||||||
|
),
|
||||||
|
_InfoChip(
|
||||||
|
label: clearPathOnMaxRetry
|
||||||
|
? 'Clear path on max retry on'
|
||||||
|
: 'Clear path on max retry off',
|
||||||
|
icon: Icons.route,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
] else ...[
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
Text(
|
||||||
|
'Shows retry, rotation, and final repeater fallback behavior.',
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user