Move send controls into Routing and split retry limits

Direct and flood attempts are separate settings, available with auto
route rotation off. Saved single retry limits migrate to that split,
and reset restores the whole Routing section.

Co-authored-by: zjs81 <zjs81@users.noreply.github.com>
This commit is contained in:
Cursor Agentandzjs81 committed 2026-11-21 00:50:53 +00:00
1 parent 34ea0cb7ca
commit 1b804bd1eb
69 files changed
+2199 -784

No files matched your search

+127 -157
View File
@@ -19,6 +19,8 @@ import '../widgets/language_picker_sheet.dart';
import '../widgets/mesh_nav_tile.dart';
import '../widgets/mesh_ui.dart';
import '../widgets/network_map_settings_section.dart';
import '../models/send_attempt_plan.dart';
import '../widgets/settings_reveal.dart';
import '../widgets/sync_progress_overlay.dart';
import '../widgets/translation_settings_section.dart';
import '../helpers/snack_bar_builder.dart';
@@ -414,29 +416,6 @@ class AppSettingsScreen extends StatelessWidget {
) {
return Column(
children: [
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
secondary: const Icon(Icons.refresh_outlined, size: 24),
title: Text(context.l10n.appSettings_clearPathOnMaxRetry),
subtitle: Text(context.l10n.appSettings_clearPathOnMaxRetrySubtitle),
value: settingsService.settings.clearPathOnMaxRetry,
onChanged: (value) {
settingsService.setClearPathOnMaxRetry(value);
showDismissibleSnackBar(
context,
content: Text(
value
? context.l10n.appSettings_pathsWillBeCleared
: context.l10n.appSettings_pathsWillNotBeCleared,
),
duration: const Duration(seconds: 2),
);
},
),
const Divider(height: 1, indent: 16),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
@@ -496,104 +475,82 @@ class AppSettingsScreen extends StatelessWidget {
BuildContext context,
AppSettingsService settingsService,
) {
final autoRouteEnabled = settingsService.settings.autoRouteRotationEnabled;
final settings = settingsService.settings;
final l10n = context.l10n;
return Column(
children: [
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
secondary: const Icon(Icons.refresh_outlined, size: 24),
title: Text(l10n.appSettings_clearPathOnMaxRetry),
subtitle: Text(l10n.appSettings_clearPathOnMaxRetrySubtitle),
value: settings.clearPathOnMaxRetry,
onChanged: (value) {
settingsService.setClearPathOnMaxRetry(value);
showDismissibleSnackBar(
context,
content: Text(
value
? l10n.appSettings_pathsWillBeCleared
: l10n.appSettings_pathsWillNotBeCleared,
),
duration: const Duration(seconds: 2),
);
},
),
const Divider(height: 1, indent: 16),
SettingsValueSlider(
title: l10n.appSettings_directRetries(settings.directRetries),
subtitle: l10n.appSettings_directRetriesSubtitle,
value: settings.directRetries,
min: SendAttemptPlan.minDirectRetries,
max: SendAttemptPlan.maxDirectRetries,
onChanged: settingsService.setDirectRetries,
),
const Divider(height: 1, indent: 16),
SettingsValueSlider(
title: l10n.appSettings_floodRetries(settings.floodRetries),
subtitle: l10n.appSettings_floodRetriesSubtitle,
value: settings.floodRetries,
min: SendAttemptPlan.minFloodRetries,
max: SendAttemptPlan.maxFloodRetries,
onChanged: settingsService.setFloodRetries,
),
const Divider(height: 1, indent: 16),
SettingsValueSlider(
title: l10n.appSettings_loginAttempts(settings.loginAttempts),
subtitle: l10n.appSettings_loginAttemptsSubtitle,
value: settings.loginAttempts,
min: SendAttemptPlan.minLoginAttempts,
max: SendAttemptPlan.maxLoginAttempts,
onChanged: settingsService.setLoginAttempts,
),
const Divider(height: 1, indent: 16),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
secondary: const Icon(Icons.alt_route, size: 24),
title: Text(context.l10n.appSettings_autoRouteRotation),
subtitle: Text(context.l10n.appSettings_autoRouteRotationSubtitle),
value: autoRouteEnabled,
title: Text(l10n.appSettings_autoRouteRotation),
subtitle: Text(l10n.appSettings_autoRouteRotationSubtitle),
value: settings.autoRouteRotationEnabled,
onChanged: (value) {
settingsService.setAutoRouteRotationEnabled(value);
showDismissibleSnackBar(
context,
content: Text(
value
? context.l10n.appSettings_autoRouteRotationEnabled
: context.l10n.appSettings_autoRouteRotationDisabled,
? l10n.appSettings_autoRouteRotationEnabled
: l10n.appSettings_autoRouteRotationDisabled,
),
duration: const Duration(seconds: 2),
);
},
),
// AnimatedSize sub-options for auto-route rotation
AnimatedSize(
duration: const Duration(milliseconds: 200),
alignment: Alignment.topCenter,
child: autoRouteEnabled
? Container(
color: Theme.of(context).colorScheme.surfaceContainerHighest,
padding: const EdgeInsets.only(left: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider(height: 1),
ListTile(
title: Text(context.l10n.appSettings_maxMessageRetries),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
context
.l10n
.appSettings_maxMessageRetriesSubtitle,
),
Slider(
value: settingsService.settings.maxMessageRetries
.toDouble(),
min: 2,
max: 10,
divisions: 8,
label: settingsService.settings.maxMessageRetries
.toString(),
onChanged: (value) => settingsService
.setMaxMessageRetries(value.toInt()),
),
],
),
),
const Divider(height: 1),
ListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
leading: const Icon(Icons.restart_alt, size: 24),
title: Text(
context.l10n.appSettings_resetRoutingToDefault,
),
subtitle: Text(
context
.l10n
.appSettings_resetRoutingToDefaultSubtitle,
),
trailing: const Icon(
Icons.keyboard_arrow_right,
size: 18,
),
onTap: () async {
await settingsService.resetRoutingSettingsToDefault();
if (context.mounted) {
showDismissibleSnackBar(
context,
content: Text(
context.l10n.appSettings_routingResetToDefault,
),
duration: const Duration(seconds: 2),
);
}
},
),
],
),
)
: const SizedBox.shrink(),
),
const Divider(height: 1, indent: 16),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
@@ -601,60 +558,70 @@ class AppSettingsScreen extends StatelessWidget {
vertical: 4,
),
secondary: const Icon(Icons.cell_tower, size: 24),
title: Text(context.l10n.appSettings_channelMinHops),
subtitle: Text(context.l10n.appSettings_channelMinHopsSubtitle),
value: settingsService.settings.channelMinHopsEnabled,
title: Text(l10n.appSettings_channelMinHops),
subtitle: Text(l10n.appSettings_channelMinHopsSubtitle),
value: settings.channelMinHopsEnabled,
onChanged: settingsService.setChannelMinHopsEnabled,
),
if (settingsService.settings.channelMinHopsEnabled) ...[
ListTile(
title: Text(
context.l10n.appSettings_channelMinHopsCount(
settingsService.settings.channelMinHops,
SettingsReveal(
visible: settings.channelMinHopsEnabled,
children: [
SettingsValueSlider(
title: l10n.appSettings_channelMinHopsCount(
settings.channelMinHops,
),
),
subtitle: Slider(
value: settingsService.settings.channelMinHops.toDouble(),
value: settings.channelMinHops,
min: 1,
max: 8,
divisions: 7,
label: settingsService.settings.channelMinHops.toString(),
onChanged: (value) =>
settingsService.setChannelMinHops(value.toInt()),
onChanged: settingsService.setChannelMinHops,
),
),
ListTile(
title: Text(
context.l10n.appSettings_channelMinHopsRetries(
settingsService.settings.channelMinHopsRetries,
SettingsValueSlider(
title: l10n.appSettings_channelMinHopsRetries(
settings.channelMinHopsRetries,
),
),
subtitle: Slider(
value: settingsService.settings.channelMinHopsRetries.toDouble(),
value: settings.channelMinHopsRetries,
min: 1,
max: 5,
divisions: 4,
label: settingsService.settings.channelMinHopsRetries.toString(),
onChanged: (value) =>
settingsService.setChannelMinHopsRetries(value.toInt()),
onChanged: settingsService.setChannelMinHopsRetries,
),
),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
secondary: const Icon(Icons.hub_outlined, size: 24),
title: Text(context.l10n.appSettings_channelMinHopsCountRepeaters),
subtitle: Text(
context.l10n.appSettings_channelMinHopsCountRepeatersSubtitle(
settingsService.settings.channelMinHops,
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
secondary: const Icon(Icons.hub_outlined, size: 24),
title: Text(l10n.appSettings_channelMinHopsCountRepeaters),
subtitle: Text(
l10n.appSettings_channelMinHopsCountRepeatersSubtitle(
settings.channelMinHops,
),
),
value: settings.channelMinHopsCountRepeaters,
onChanged: settingsService.setChannelMinHopsCountRepeaters,
),
value: settingsService.settings.channelMinHopsCountRepeaters,
onChanged: settingsService.setChannelMinHopsCountRepeaters,
],
),
const Divider(height: 1, indent: 16),
ListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
],
leading: const Icon(Icons.restart_alt, size: 24),
title: Text(l10n.appSettings_resetRoutingToDefault),
subtitle: Text(l10n.appSettings_resetRoutingToDefaultSubtitle),
trailing: const Icon(Icons.keyboard_arrow_right, size: 18),
onTap: () async {
await settingsService.resetRoutingSettingsToDefault();
if (context.mounted) {
showDismissibleSnackBar(
context,
content: Text(l10n.appSettings_routingResetToDefault),
duration: const Duration(seconds: 2),
);
}
},
),
],
);
}
@@ -726,21 +693,24 @@ class AppSettingsScreen extends StatelessWidget {
},
),
),
if (settingsService.settings.imageMessagesEnabled) ...[
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
SettingsReveal(
visible: settingsService.settings.imageMessagesEnabled,
children: [
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
secondary: const Icon(Icons.auto_awesome_outlined, size: 24),
title: Text(context.l10n.imageMessages_autoProcessTitle),
subtitle: Text(context.l10n.imageMessages_autoProcessSubtitle),
value: settingsService.settings.imageProcessAutomatically,
onChanged: (value) =>
settingsService.setImageProcessAutomatically(value),
),
secondary: const Icon(Icons.auto_awesome_outlined, size: 24),
title: Text(context.l10n.imageMessages_autoProcessTitle),
subtitle: Text(context.l10n.imageMessages_autoProcessSubtitle),
value: settingsService.settings.imageProcessAutomatically,
onChanged: (value) =>
settingsService.setImageProcessAutomatically(value),
),
_buildImageCodecModels(context),
],
_buildImageCodecModels(context),
],
),
],
);
}
+5 -3
View File
@@ -25,6 +25,7 @@ import '../widgets/connect_sheet.dart';
import '../widgets/list_filter_widget.dart';
import '../widgets/empty_state.dart';
import '../widgets/mesh_ui.dart';
import '../widgets/settings_reveal.dart';
import '../widgets/network_map_opt_in_dialog.dart';
import '../widgets/qr_code_display.dart';
import '../widgets/quick_switch_bar.dart';
@@ -2045,8 +2046,9 @@ void showEditChannelSheet(
}
}),
),
if (cyr2latEnabled) ...[
Padding(
RevealOnEnable(
visible: cyr2latEnabled,
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 8, 0, 8),
child: DropdownButtonFormField<String>(
isExpanded: true,
@@ -2073,7 +2075,7 @@ void showEditChannelSheet(
}),
),
),
],
),
SwitchListTile(
contentPadding: EdgeInsets.zero,
title: Text(sheetContext.l10n.urlImage_enable),
+16 -7
View File
@@ -19,6 +19,7 @@ import '../helpers/message_url_image_helper.dart';
import '../helpers/path_helper.dart';
import '../helpers/reaction_helper.dart';
import '../widgets/message_status_icon.dart';
import '../widgets/settings_reveal.dart';
import '../widgets/empty_state.dart';
import '../helpers/chat_scroll_controller.dart';
import '../helpers/gif_helper.dart';
@@ -707,6 +708,13 @@ class _ChatScreenState extends State<ChatScreen> {
}
final messageIndex = index;
Contact contact = _resolveContact(connector);
final sendSettings = context.read<AppSettingsService>().settings;
final retryLimit = sendSettings.sendAttemptLimit(
rotating:
sendSettings.autoRouteRotationEnabled &&
contact.pathOverride == null,
floodPath: (contact.pathOverride ?? contact.pathLength) < 0,
);
final bool isRoom = contact.type == advTypeRoom;
final message = reversedMessages[messageIndex];
String fourByteHex = '';
@@ -736,6 +744,7 @@ class _ChatScreenState extends State<ChatScreen> {
);
final bubble = _MessageBubble(
message: message,
maxSendAttempts: retryLimit,
senderName: isRoom
? (roomAuthor != null
? "${roomAuthor.name} [$fourByteHex]"
@@ -1209,8 +1218,9 @@ class _ChatScreenState extends State<ChatScreen> {
});
},
),
if (cyr2latEnabled) ...[
Padding(
RevealOnEnable(
visible: cyr2latEnabled,
child: Padding(
padding: const EdgeInsets.fromLTRB(0, 8, 0, 8),
child: DropdownButtonFormField<String>(
isExpanded: true,
@@ -1242,7 +1252,7 @@ class _ChatScreenState extends State<ChatScreen> {
},
),
),
],
),
const Divider(height: 8),
SwitchListTile(
contentPadding: EdgeInsets.zero,
@@ -1623,6 +1633,7 @@ class _ChatScreenState extends State<ChatScreen> {
class _MessageBubble extends StatelessWidget {
final Message message;
final int maxSendAttempts;
final String senderName;
final VoidCallback? onLongPress;
final void Function(Message message, String emoji)? onRetryReaction;
@@ -1632,6 +1643,7 @@ class _MessageBubble extends StatelessWidget {
const _MessageBubble({
required this.message,
required this.maxSendAttempts,
required this.senderName,
required this.sourceId,
required this.textScale,
@@ -1871,10 +1883,7 @@ class _MessageBubble extends StatelessWidget {
child: Text(
context.l10n.chat_retryCount(
message.retryCount,
context
.read<AppSettingsService>()
.settings
.maxMessageRetries,
maxSendAttempts,
),
style: MeshTheme.mono(
fontSize: 12 * textScale,
+3 -1
View File
@@ -12,6 +12,7 @@ import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/chat_send_pipeline.dart';
import '../widgets/empty_state.dart';
import '../widgets/mesh_ui.dart';
import '../widgets/settings_reveal.dart';
/// Recent filtered channel messages across all channels, newest first.
///
@@ -286,7 +287,8 @@ class _FilteredMessageCard extends StatelessWidget {
),
const SizedBox(height: 8),
AnimatedSize(
duration: const Duration(milliseconds: 150),
duration: RevealOnEnable.duration,
curve: RevealOnEnable.curve,
alignment: AlignmentDirectional.topStart,
child: Padding(
padding: const EdgeInsetsDirectional.only(end: 8),
+8 -11
View File
@@ -15,6 +15,7 @@ import '../widgets/device_tile.dart';
import '../widgets/empty_state.dart';
import '../widgets/get_node_banner.dart';
import '../widgets/mesh_ui.dart';
import '../widgets/settings_reveal.dart';
import '../helpers/snack_bar_builder.dart';
import '../review_mode/review_mode_entry.dart';
import '../utils/main_navigation.dart';
@@ -151,17 +152,13 @@ class _ScannerScreenState extends State<ScannerScreen> {
builder: (context, connector, child) {
return Column(
children: [
// Bluetooth off warning — slides in/out with AnimatedSize
AnimatedSize(
duration: const Duration(milliseconds: 250),
curve: Curves.easeInOut,
child: _bluetoothState == BluetoothAdapterState.off
? _BluetoothOffBanner(
onEnable: PlatformInfo.isAndroid
? () => FlutterBluePlus.turnOn()
: null,
)
: const SizedBox.shrink(),
RevealOnEnable(
visible: _bluetoothState == BluetoothAdapterState.off,
child: _BluetoothOffBanner(
onEnable: PlatformInfo.isAndroid
? () => FlutterBluePlus.turnOn()
: null,
),
),
// Connection status header
+52 -55
View File
@@ -14,6 +14,7 @@ import '../helpers/snack_bar_builder.dart';
import '../helpers/utf8_length_limiter.dart';
import '../widgets/mesh_nav_tile.dart';
import '../widgets/mesh_ui.dart';
import '../widgets/settings_reveal.dart';
import '../widgets/radio_settings_dialog.dart';
import 'app_settings_screen.dart';
import 'app_debug_log_screen.dart';
@@ -301,62 +302,58 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
),
// Expandable detail rows
AnimatedSize(
duration: const Duration(milliseconds: 200),
alignment: Alignment.topCenter,
child: _deviceInfoExpanded
? Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 14),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider(height: 1),
const SizedBox(height: 10),
_infoRow(
context,
label: l10n.settings_infoId,
value: connector.deviceIdLabel,
),
_buildBatteryInfoRow(context, connector),
if (connector.manufacturerName != null)
_infoRow(
context,
label: l10n.settings_infoHardware,
value: connector.manufacturerName!,
),
if (connector.firmwareVersionString != null)
_infoRow(
context,
label: l10n.settings_infoFirmware,
value: connector.firmwareVersionString!,
),
if (connector.selfName != null)
_infoRow(
context,
label: l10n.settings_nodeName,
value: connector.selfName!,
),
if (connector.selfPublicKey != null)
_publicKeyRow(
context,
label: l10n.settings_infoPublicKey,
publicKeyHex: pubKeyToHex(connector.selfPublicKey!),
),
_infoRow(
context,
label: l10n.settings_infoContactsCount,
value: '${connector.contacts.length}',
),
_infoRow(
context,
label: l10n.settings_infoChannelCount,
value: '${connector.channels.length}',
),
],
RevealOnEnable(
visible: _deviceInfoExpanded,
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 14),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider(height: 1),
const SizedBox(height: 10),
_infoRow(
context,
label: l10n.settings_infoId,
value: connector.deviceIdLabel,
),
_buildBatteryInfoRow(context, connector),
if (connector.manufacturerName != null)
_infoRow(
context,
label: l10n.settings_infoHardware,
value: connector.manufacturerName!,
),
)
: const SizedBox.shrink(),
if (connector.firmwareVersionString != null)
_infoRow(
context,
label: l10n.settings_infoFirmware,
value: connector.firmwareVersionString!,
),
if (connector.selfName != null)
_infoRow(
context,
label: l10n.settings_nodeName,
value: connector.selfName!,
),
if (connector.selfPublicKey != null)
_publicKeyRow(
context,
label: l10n.settings_infoPublicKey,
publicKeyHex: pubKeyToHex(connector.selfPublicKey!),
),
_infoRow(
context,
label: l10n.settings_infoContactsCount,
value: '${connector.contacts.length}',
),
_infoRow(
context,
label: l10n.settings_infoChannelCount,
value: '${connector.channels.length}',
),
],
),
),
),
],
);