Merge origin/dev into feat/group-editor-members-first

This commit is contained in:
zjs81 committed 2026-11-21 13:26:48 -07:00
commit 0cc5fd4e1f
88 files changed
+5799 -742

No files matched your search

+194 -167
View File
@@ -18,6 +18,7 @@ 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';
@@ -81,6 +82,13 @@ class AppSettingsScreen extends StatelessWidget {
child: _settingsCard(_buildRoutingContent),
),
// REPEATERS AND ROOMS
SectionHeader(context.l10n.appSettings_repeatersAndRooms),
MeshCard(
padding: EdgeInsets.zero,
child: _settingsCard(_buildRepeaterRoomContent),
),
// IMAGE MESSAGES
SectionHeader(context.l10n.appSettings_imageMessagesSection),
MeshCard(
@@ -414,29 +422,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,
@@ -449,20 +434,6 @@ class AppSettingsScreen extends StatelessWidget {
onChanged: settingsService.setJumpToOldestUnread,
),
const Divider(height: 1, indent: 16),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
secondary: const Icon(Icons.settings_remote_outlined, size: 24),
title: Text(context.l10n.appSettings_autoFetchRepeaterSettings),
subtitle: Text(
context.l10n.appSettings_autoFetchRepeaterSettingsSubtitle,
),
value: settingsService.settings.autoFetchRepeaterSettings,
onChanged: settingsService.setAutoFetchRepeaterSettings,
),
const Divider(height: 1, indent: 16),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
@@ -510,104 +481,75 @@ 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(
icon: Icons.route,
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(
icon: Icons.waves,
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),
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(
@@ -615,60 +557,150 @@ 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(
icon: Icons.linear_scale,
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(
icon: Icons.repeat,
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),
);
}
},
),
],
);
}
Widget _buildRepeaterRoomContent(
BuildContext context,
AppSettingsService settingsService,
) {
final settings = settingsService.settings;
final l10n = context.l10n;
return Column(
children: [
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
secondary: const Icon(Icons.schedule, size: 24),
title: Text(l10n.appSettings_clockSyncAfterLogin),
subtitle: Text(l10n.appSettings_clockSyncAfterLoginSubtitle),
value: settings.clockSyncAfterLogin,
onChanged: settingsService.setClockSyncAfterLogin,
),
const Divider(height: 1, indent: 16),
SwitchListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
secondary: const Icon(Icons.password, size: 24),
title: Text(l10n.appSettings_loginPasswordAutofocus),
subtitle: Text(l10n.appSettings_loginPasswordAutofocusSubtitle),
value: settings.loginPasswordAutofocus,
onChanged: settingsService.setLoginPasswordAutofocus,
),
const Divider(height: 1, indent: 16),
SettingsValueSlider(
icon: Icons.login,
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.settings_remote_outlined, size: 24),
title: Text(l10n.appSettings_autoFetchRepeaterSettings),
subtitle: Text(l10n.appSettings_autoFetchRepeaterSettingsSubtitle),
value: settings.autoFetchRepeaterSettings,
onChanged: settingsService.setAutoFetchRepeaterSettings,
),
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_resetRepeaterRoomSettings),
subtitle: Text(l10n.appSettings_resetRepeaterRoomSettingsSubtitle),
trailing: const Icon(Icons.keyboard_arrow_right, size: 18),
onTap: () async {
await settingsService.resetRepeaterRoomSettingsToDefault();
if (context.mounted) {
showDismissibleSnackBar(
context,
content: Text(l10n.appSettings_repeaterRoomSettingsReset),
duration: const Duration(seconds: 2),
);
}
},
),
],
);
}
@@ -707,15 +739,10 @@ class AppSettingsScreen extends StatelessWidget {
: null,
),
const Divider(height: 1, indent: 16),
ListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
leading: const Icon(Icons.link_outlined, size: 20),
title: Text(context.l10n.appSettings_ipfsImageLinks),
subtitle: Text(context.l10n.appSettings_ipfsImageLinksSubtitle),
trailing: const Icon(Icons.chevron_right, size: 18),
MeshNavTile(
icon: Icons.link_outlined,
title: context.l10n.appSettings_ipfsImageLinks,
subtitle: context.l10n.appSettings_ipfsImageLinksSubtitle,
onTap: () => _showIpfsImageLinksDialog(context, settingsService),
),
const Divider(height: 1, indent: 16),
@@ -812,7 +839,7 @@ class AppSettingsScreen extends StatelessWidget {
size: 24,
color: scheme.onSurfaceVariant,
),
const SizedBox(width: 12),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
+44 -19
View File
@@ -729,7 +729,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
ChatSearchEntry(
id: m.messageId,
sender: m.senderName,
text: m.text,
text: m.fullText,
translatedText: m.translatedText,
time: m.receivedAt,
matchSender: true,
@@ -1490,21 +1490,25 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
),
if (enableTracing &&
!isOutgoing &&
message.repeatCount > 0) ...[
const SizedBox(width: 2),
Icon(
Icons.repeat,
size: 14 * textScale,
color: metaColor,
message.repeatCount > 0)
Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.repeat,
size: 14 * textScale,
color: metaColor,
),
const SizedBox(width: 2),
Text(
'${message.repeatCount}',
style: MeshTheme.mono(
fontSize: 12 * textScale,
color: metaColor,
),
),
],
),
Text(
'${message.repeatCount}',
style: MeshTheme.mono(
fontSize: 12 * textScale,
color: metaColor,
),
),
],
if (isOutgoing)
MessageStatusIcon(
size: 16 * textScale,
@@ -2540,6 +2544,14 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
),
subtitle: _imageSenderLabel(entry),
),
ListTile(
leading: const Icon(Icons.copy),
title: Text(l10n.common_copy),
onTap: () {
Navigator.pop(sheetContext);
copyChatMessageText(context, _imageCopyText(entry));
},
),
if (canSave)
ListTile(
leading: const Icon(Icons.save_alt),
@@ -2592,6 +2604,17 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
);
}
String _imageCopyText(ReceivedImageEntry entry) {
final l10n = context.l10n;
final lines = <String>[
'${_imageSenderLabel(entry)} (${formatChatTime(context, entry.firstSeen)})',
l10n.receivedImage_awaiting(entry.bitstreamByteCount, entry.totalChunks),
if (entry.state == ReceivedImageState.decoded && entry.synthesized)
l10n.receivedImage_shareCaption(entry.bitstreamByteCount),
];
return lines.join('\n');
}
Future<void> _saveImage(ReceivedImageEntry entry) async {
final l10n = context.l10n;
final shareOrigin = shareOriginOf(context);
@@ -3095,7 +3118,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
title: Text(context.l10n.common_copy),
onTap: () {
Navigator.pop(sheetContext);
copyChatMessageText(context, message.text);
copyChatMessageText(context, message.fullText);
},
),
if (canTranslateMessage)
@@ -3427,8 +3450,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
final text = messages
.map(
(m) => m.senderName.isEmpty || m.isOutgoing
? m.text
: '${m.senderName}: ${m.text}',
? m.fullText
: '${m.senderName}: ${m.fullText}',
)
.join('\n');
setState(_selectedIds.clear);
@@ -4005,8 +4028,10 @@ class _SwipeReplyBubbleState extends State<_SwipeReplyBubble> {
onPointerMove: _handleSwipePointerMove,
onPointerUp: (event) => _handleSwipePointerUp(event.position),
onPointerCancel: (_) => _resetSwipe(),
// Same insets as the plain row in _buildMessageBubble, so a bubble is
// as wide whether or not it can be swiped (offline, desktop, outgoing).
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 8),
padding: const EdgeInsets.symmetric(vertical: 3),
child: Stack(
alignment: Alignment.center,
children: [
+19 -9
View File
@@ -21,6 +21,7 @@ import '../models/display_path.dart';
import '../models/path_playback.dart';
import '../theme/mesh_theme.dart';
import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/contact_visuals.dart';
import '../widgets/mesh_ui.dart';
import '../widgets/path_map_scaffold.dart';
import '../widgets/path_map_ui.dart';
@@ -356,7 +357,7 @@ class ChannelMessagePathScreen extends StatelessWidget {
Stack(
clipBehavior: Clip.none,
children: [
AvatarCircle(name: hop.displayLabel, size: 36),
AvatarCircle(name: hop.avatarName, size: 36),
Positioned(
right: -4,
top: -4,
@@ -1616,14 +1617,23 @@ class _PathHop {
bool get hasLocation => position != null;
String get displayLabel {
final prefixLabel = hopBytes != null && hopBytes!.isNotEmpty
? hopBytes!
.map((b) => b.toRadixString(16).padLeft(2, '0'))
.join('')
.toUpperCase()
: _formatPrefix(prefix);
return '($prefixLabel) ${_resolveName(contact, l10n)}';
String get prefixLabel => hopBytes != null && hopBytes!.isNotEmpty
? hopBytes!
.map((b) => b.toRadixString(16).padLeft(2, '0'))
.join('')
.toUpperCase()
: _formatPrefix(prefix);
String get displayLabel => '($prefixLabel) ${_resolveName(contact, l10n)}';
/// Avatar source: the repeater's own name, or the hop's hex prefix when
/// the hop is unresolved or its name has nothing to make initials from.
String get avatarName {
final name = contact?.name.trim() ?? '';
if (name.toLowerCase() == 'unknown' || avatarInitials(name) == null) {
return prefixLabel;
}
return name;
}
}
+11 -4
View File
@@ -781,6 +781,13 @@ class _ChatScreenState extends State<ChatScreen> with WidgetsBindingObserver {
}
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 = '';
@@ -810,6 +817,7 @@ class _ChatScreenState extends State<ChatScreen> with WidgetsBindingObserver {
);
final bubble = _MessageBubble(
message: message,
maxSendAttempts: retryLimit,
senderName: isRoom
? (roomAuthor != null
? "${roomAuthor.name} [$fourByteHex]"
@@ -1604,6 +1612,7 @@ class _ChatScreenState extends State<ChatScreen> with WidgetsBindingObserver {
class _MessageBubble extends StatelessWidget {
final Message message;
final int maxSendAttempts;
final String senderName;
final VoidCallback? onLongPress;
final void Function(Message message, String emoji)? onRetryReaction;
@@ -1613,6 +1622,7 @@ class _MessageBubble extends StatelessWidget {
const _MessageBubble({
required this.message,
required this.maxSendAttempts,
required this.senderName,
required this.sourceId,
required this.textScale,
@@ -1854,10 +1864,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 -1
View File
@@ -1198,6 +1198,9 @@ class _MapScreenState extends State<MapScreen> with WidgetsBindingObserver {
showOtherNodes: settings.mapShowOtherNodes,
isBuildingPathTrace: _isBuildingPathTrace,
clusterNodes: settings.mapClusterNodes,
// Node labels bake in the overlay colors, so a light/dark or theme
// switch must rebuild them.
colorScheme: Theme.of(context).colorScheme,
);
if (key != _nodeMarkersCacheKey) {
_nodeMarkersCacheKey = key;
@@ -4389,6 +4392,7 @@ class _NodeMarkersCacheKey {
final bool showOtherNodes;
final bool isBuildingPathTrace;
final bool clusterNodes;
final ColorScheme colorScheme;
const _NodeMarkersCacheKey({
required this.contactsSignature,
@@ -4409,6 +4413,7 @@ class _NodeMarkersCacheKey {
required this.showOtherNodes,
required this.isBuildingPathTrace,
required this.clusterNodes,
required this.colorScheme,
});
@override
@@ -4431,7 +4436,8 @@ class _NodeMarkersCacheKey {
showChatNodes == other.showChatNodes &&
showOtherNodes == other.showOtherNodes &&
isBuildingPathTrace == other.isBuildingPathTrace &&
clusterNodes == other.clusterNodes;
clusterNodes == other.clusterNodes &&
colorScheme == other.colorScheme;
}
@override
@@ -4454,6 +4460,7 @@ class _NodeMarkersCacheKey {
showOtherNodes,
isBuildingPathTrace,
clusterNodes,
colorScheme,
);
}
+75 -22
View File
@@ -112,7 +112,8 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
int? _spreadingFactor;
int? _codingRate;
bool _autoClockSyncAfterLogin = false;
RepeaterClockSyncOverride _clockSyncOverride =
RepeaterClockSyncOverride.followDefault;
// Identity keys
final TextEditingController _prvKeyController = TextEditingController();
@@ -527,13 +528,12 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
}
});
final autoClockSync = await _storage
.getRepeaterAutoClockSyncAfterLoginEnabled(
widget.repeater.publicKeyHex,
);
final clockSync = await _storage.getRepeaterClockSyncOverride(
widget.repeater.publicKeyHex,
);
if (!mounted) return;
setState(() {
_autoClockSyncAfterLogin = autoClockSync;
_clockSyncOverride = clockSync;
});
}
@@ -953,7 +953,7 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
_buildSectionCard(
l10n.repeater_features,
RepeaterSettingSection.features,
extra: [_buildClockSyncToggle()],
extra: [_buildClockSyncChoice()],
),
_buildSectionCard(
l10n.repeater_networkHealth,
@@ -1366,22 +1366,75 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
];
}
Widget _buildClockSyncToggle() {
Widget _buildClockSyncChoice() {
final l10n = context.l10n;
return SwitchListTile(
title: Text(l10n.repeater_clockSyncAfterLogin),
subtitle: Text(l10n.repeater_clockSyncAfterLoginSubtitle),
value: _autoClockSyncAfterLogin,
onChanged: (value) async {
setState(() {
_autoClockSyncAfterLogin = value;
});
await _storage.setRepeaterAutoClockSyncAfterLoginEnabled(
widget.repeater.publicKeyHex,
value,
);
},
contentPadding: EdgeInsets.zero,
final scheme = Theme.of(context).colorScheme;
final textTheme = Theme.of(context).textTheme;
ButtonSegment<RepeaterClockSyncOverride> segment(
RepeaterClockSyncOverride value,
String label,
) => ButtonSegment(value: value, label: MeshSegmentLabel(label));
return Padding(
padding: const EdgeInsets.only(top: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(Icons.schedule, size: 24, color: scheme.onSurfaceVariant),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
l10n.repeater_clockSyncAfterLogin,
style: textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 2),
Text(
l10n.repeater_clockSyncAfterLoginSubtitle,
style: textTheme.bodyMedium?.copyWith(
color: scheme.onSurfaceVariant,
),
),
],
),
),
],
),
const SizedBox(height: 8),
SegmentedButton<RepeaterClockSyncOverride>(
showSelectedIcon: false,
style: const ButtonStyle(
minimumSize: WidgetStatePropertyAll(Size.fromHeight(40)),
visualDensity: VisualDensity.compact,
),
segments: [
segment(
RepeaterClockSyncOverride.followDefault,
l10n.repeater_clockSyncDefault,
),
segment(RepeaterClockSyncOverride.on, l10n.repeater_clockSyncOn),
segment(
RepeaterClockSyncOverride.off,
l10n.repeater_clockSyncOff,
),
],
selected: {_clockSyncOverride},
onSelectionChanged: (selected) async {
final value = selected.first;
setState(() => _clockSyncOverride = value);
await _storage.setRepeaterClockSyncOverride(
widget.repeater.publicKeyHex,
value,
);
},
),
],
),
);
}
+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}',
),
],
),
),
),
],
);