feat: add reset to default for routing algorithm settings (#622)

- Add Reset button in routing settings with Icons.restart_alt
- Extract default values as constants in AppSettings to avoid duplication
- Add translations for all 18 supported languages
- Update documentation in settings.md
This commit is contained in:
edouard committed 2026-10-31 04:53:21 +01:00
1 parent ac28dac575
commit 3032be9bad
42 files changed
+377 -39

No files matched your search

+23 -10
View File
@@ -96,6 +96,13 @@ class AppSettings {
static const String stadiaDemo = '51bd0381-4685-4666-bae8-48940f6d77c0';
static const String defaultPublicIpfsGateway = 'https://ipfs.io/ipfs/';
// Routing algorithm default values
static const double defaultMaxRouteWeight = 5.0;
static const double defaultInitialRouteWeight = 3.0;
static const double defaultRouteWeightSuccessIncrement = 0.5;
static const double defaultRouteWeightFailureDecrement = 0.2;
static const int defaultMaxMessageRetries = 5;
final bool clearPathOnMaxRetry;
final bool mapShowRepeaters;
final bool mapShowChatNodes;
@@ -255,11 +262,11 @@ class AppSettings {
this.autoSendZeroHopAdvertOnGpsUpdate = false,
this.gpsIntervalSeconds = 900,
this.autoRouteRotationEnabled = true,
this.maxRouteWeight = 5.0,
this.initialRouteWeight = 3.0,
this.routeWeightSuccessIncrement = 0.5,
this.routeWeightFailureDecrement = 0.2,
this.maxMessageRetries = 5,
this.maxRouteWeight = defaultMaxRouteWeight,
this.initialRouteWeight = defaultInitialRouteWeight,
this.routeWeightSuccessIncrement = defaultRouteWeightSuccessIncrement,
this.routeWeightFailureDecrement = defaultRouteWeightFailureDecrement,
this.maxMessageRetries = defaultMaxMessageRetries,
this.channelMinHopsEnabled = false,
this.channelMinHops = 2,
this.channelMinHopsRetries = 1,
@@ -480,14 +487,20 @@ class AppSettings {
(json['gps_interval_seconds'] as num?)?.toInt() ?? 900,
autoRouteRotationEnabled:
json['auto_route_rotation_enabled'] as bool? ?? true,
maxRouteWeight: (json['max_route_weight'] as num?)?.toDouble() ?? 5.0,
maxRouteWeight:
(json['max_route_weight'] as num?)?.toDouble() ??
defaultMaxRouteWeight,
initialRouteWeight:
(json['initial_route_weight'] as num?)?.toDouble() ?? 3.0,
(json['initial_route_weight'] as num?)?.toDouble() ??
defaultInitialRouteWeight,
routeWeightSuccessIncrement:
(json['route_weight_success_increment'] as num?)?.toDouble() ?? 0.5,
(json['route_weight_success_increment'] as num?)?.toDouble() ??
defaultRouteWeightSuccessIncrement,
routeWeightFailureDecrement:
(json['route_weight_failure_decrement'] as num?)?.toDouble() ?? 0.2,
maxMessageRetries: json['max_message_retries'] as int? ?? 5,
(json['route_weight_failure_decrement'] as num?)?.toDouble() ??
defaultRouteWeightFailureDecrement,
maxMessageRetries:
json['max_message_retries'] as int? ?? defaultMaxMessageRetries,
channelMinHopsEnabled: json['channel_min_hops_enabled'] as bool? ?? false,
channelMinHops: json['channel_min_hops'] as int? ?? 2,
channelMinHopsRetries: json['channel_min_hops_retries'] as int? ?? 1,