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:
69 files changed
+2199
-784
No files matched your search
@@ -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),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user