Merge remote-tracking branch 'origin/dev' into pr-593

# Conflicts:
#	lib/models/app_settings.dart
#	lib/screens/channel_chat_screen.dart
#	lib/screens/chat_screen.dart
#	untranslated.json
This commit is contained in:
zjs81 committed 2026-10-24 21:45:13 -07:00
commit 7e7e7a48db
87 files changed
+4822 -882

No files matched your search

+20 -15
View File
@@ -20,6 +20,7 @@ import '../connector/meshcore_protocol.dart';
import '../helpers/cyr2lat.dart';
import '../helpers/gif_helper.dart';
import '../helpers/ipfs_upload_helper.dart';
import '../helpers/marker_message.dart';
import '../helpers/message_url_image_helper.dart';
import '../helpers/path_helper.dart';
import '../helpers/reaction_helper.dart';
@@ -28,7 +29,8 @@ import '../l10n/l10n.dart';
import '../models/channel.dart';
import '../models/channel_message.dart';
import '../models/image_codec_support.dart' show aeicRatePointForUi;
import '../services/app_settings_service.dart';
import '../services/app_settings_service.dart'
show AppSettingsService, ChannelNotificationMode;
import '../services/chat_text_scale_service.dart';
import '../services/image_chunk_transport.dart';
import '../services/image_codec_service.dart';
@@ -38,6 +40,7 @@ import '../utils/image_save.dart';
import '../utils/lora_airtime.dart';
import '../widgets/marker_label_dialog.dart';
import '../widgets/received_image_message.dart';
import '../widgets/channel_notification_mode_sheet.dart';
import '../widgets/chat_day_separator.dart';
import '../widgets/empty_state.dart';
import '../widgets/chat_composer.dart';
@@ -404,19 +407,22 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
Consumer<AppSettingsService>(
builder: (context, settings, _) {
final muteKey = widget.channel.muteKey;
final muted = settings.isChannelMuted(muteKey);
final notificationMode = settings.getChannelNotificationMode(
muteKey,
);
return IconButton(
tooltip: muted
? context.l10n.channels_unmuteChannel
: context.l10n.channels_muteChannel,
icon: Icon(
muted
? Icons.notifications_off_outlined
: Icons.notifications_outlined,
tooltip: context.l10n.channels_notificationModeTooltip(
channelNotificationModeLabel(context, notificationMode),
),
onPressed: () => muted
? settings.unmuteChannel(muteKey)
: settings.muteChannel(muteKey),
icon: Icon(
notificationMode == ChannelNotificationMode.muted
? Icons.notifications_off
: notificationMode == ChannelNotificationMode.mentionsOnly
? Icons.notification_important
: Icons.notifications,
),
onPressed: () =>
showChannelNotificationModeSheet(context, muteKey),
);
},
),
@@ -2427,9 +2433,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
}
void _showEmojiPicker(ChannelMessage message) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
showMeshSheet(
context,
builder: (context) => EmojiPicker(
onEmojiSelected: (emoji) {
_sendReaction(message, emoji);
@@ -24,6 +24,7 @@ import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/mesh_ui.dart';
import '../widgets/path_map_scaffold.dart';
import '../widgets/path_map_ui.dart';
import '../widgets/set_my_location_dialog.dart';
class ChannelMessagePathScreen extends StatelessWidget {
final ChannelMessage message;
@@ -911,6 +912,10 @@ class _ChannelMessagePathMapScreenState
initialCenter: model.initialCenter,
initialZoom: model.initialZoom,
bounds: model.bounds,
onLongPress: (_, point) =>
confirmAndSetMyLocation(context, connector, point),
onSecondaryTap: (_, point) =>
confirmAndSetMyLocation(context, connector, point),
onPositionChanged: (camera, hasGesture) {
if (!mounted) return;
// A manual pan/zoom releases the follow lock.
+18 -22
View File
@@ -10,7 +10,8 @@ import 'package:uuid/uuid.dart';
import '../connector/meshcore_connector.dart';
import '../l10n/l10n.dart';
import '../services/app_settings_service.dart';
import '../services/app_settings_service.dart'
show AppSettingsService, ChannelNotificationMode;
import '../services/ui_view_state_service.dart';
import '../models/channel.dart';
import '../models/community.dart';
@@ -19,6 +20,7 @@ import '../theme/mesh_theme.dart';
import '../utils/dialog_utils.dart';
import '../utils/disconnect_navigation_mixin.dart';
import '../utils/route_transitions.dart';
import '../widgets/channel_notification_mode_sheet.dart';
import '../widgets/list_filter_widget.dart';
import '../widgets/empty_state.dart';
import '../widgets/mesh_ui.dart';
@@ -372,9 +374,9 @@ class _ChannelsScreenState extends State<ChannelsScreen>
int listIndex = 0,
}) {
final unreadCount = connector.getUnreadCountForChannel(channel);
final isMuted = context.watch<AppSettingsService>().isChannelMuted(
channel.muteKey,
);
final notificationMode = context
.watch<AppSettingsService>()
.getChannelNotificationMode(channel.muteKey);
final scheme = Theme.of(context).colorScheme;
// Determine icon and colors based on channel type
@@ -580,9 +582,9 @@ class _ChannelsScreenState extends State<ChannelsScreen>
Row(
mainAxisSize: MainAxisSize.min,
children: [
if (isMuted) ...[
if (notificationMode != ChannelNotificationMode.all) ...[
Icon(
Icons.notifications_off,
channelNotificationModeIcon(notificationMode),
size: 18,
color: scheme.onSurfaceVariant,
),
@@ -625,8 +627,6 @@ class _ChannelsScreenState extends State<ChannelsScreen>
Channel channel,
) {
final parentContext = context;
final settingsService = context.read<AppSettingsService>();
final isMuted = settingsService.isChannelMuted(channel.muteKey);
showMeshSheet(
parentContext,
@@ -645,23 +645,19 @@ class _ChannelsScreenState extends State<ChannelsScreen>
}
},
),
// Notification mode selection
ListTile(
leading: Icon(
isMuted
? Icons.notifications_outlined
: Icons.notifications_off_outlined,
),
title: Text(
isMuted
? sheetContext.l10n.channels_unmuteChannel
: sheetContext.l10n.channels_muteChannel,
),
leading: const Icon(Icons.notifications_outlined),
title: Text(sheetContext.l10n.channels_notificationSettings),
trailing: const Icon(Icons.chevron_right),
onTap: () async {
Navigator.pop(sheetContext);
if (isMuted) {
await settingsService.unmuteChannel(channel.muteKey);
} else {
await settingsService.muteChannel(channel.muteKey);
await Future.delayed(const Duration(milliseconds: 100));
if (parentContext.mounted) {
showChannelNotificationModeSheet(
parentContext,
channel.muteKey,
);
}
},
),
+3 -3
View File
@@ -22,6 +22,7 @@ import '../widgets/empty_state.dart';
import '../helpers/chat_scroll_controller.dart';
import '../helpers/gif_helper.dart';
import '../helpers/ipfs_upload_helper.dart';
import '../helpers/marker_message.dart';
import '../models/channel_message.dart';
import '../models/contact.dart';
import '../l10n/contact_localization.dart';
@@ -1282,9 +1283,8 @@ class _ChatScreenState extends State<ChatScreen> {
}
void _showEmojiPicker(Message message, Contact senderContact) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
showMeshSheet(
context,
builder: (context) => EmojiPicker(
onEmojiSelected: (emoji) {
_sendReaction(message, senderContact, emoji);
+69 -3
View File
@@ -1758,6 +1758,16 @@ class _ContactsScreenState extends State<ContactsScreen>
Text(
context.l10n.contacts_removeFromContactsConfirm(contact.name),
),
if (connector.autoAddsContactType(contact.type)) ...[
const SizedBox(height: 12),
Text(
context.l10n.contacts_removeAutoAddNote,
style: TextStyle(
color: Theme.of(dialogContext).colorScheme.error,
fontWeight: FontWeight.w600,
),
),
],
CheckboxListTile(
contentPadding: EdgeInsets.zero,
controlAffinity: ListTileControlAffinity.leading,
@@ -1774,9 +1784,24 @@ class _ContactsScreenState extends State<ContactsScreen>
child: Text(context.l10n.common_cancel),
),
TextButton(
onPressed: () {
onPressed: () async {
Navigator.pop(dialogContext);
connector.removeContact(contact, keepMessages: keepHistory);
try {
await connector.removeContact(
contact,
keepMessages: keepHistory,
);
} catch (e) {
appLogger.warn(
'Remove contact failed: $e',
tag: 'ContactsScreen',
);
if (!context.mounted) return;
showDismissibleSnackBar(
context,
content: Text(context.l10n.contacts_removeFailed),
);
}
},
child: Text(
context.l10n.contacts_remove,
@@ -1884,9 +1909,13 @@ class _ContactTile extends StatelessWidget {
],
),
const SizedBox(height: 3),
// Path / subtitle row
// Key prefix + path / subtitle row
Row(
children: [
_KeyPrefixBadge(
prefix: contact.publicKeyPrefixHex(pathHashByteWidth),
),
const SizedBox(width: 8),
Expanded(
child: Text(
contact.pathLabel(
@@ -1953,6 +1982,43 @@ class _ContactTile extends StatelessWidget {
}
}
/// Mono pill showing the contact's routing hash (public-key prefix), so it can
/// be matched against hops in paths.
class _KeyPrefixBadge extends StatelessWidget {
final String prefix;
const _KeyPrefixBadge({required this.prefix});
@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Semantics(
label: context.l10n.contacts_keyPrefixSemantics(
prefix.split('').join(' '),
),
excludeSemantics: true,
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 1),
decoration: BoxDecoration(
color: scheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(MeshRadii.xs),
border: Border.all(color: scheme.outline),
),
child: Text(
prefix,
maxLines: 1,
style: MeshTheme.mono(
fontSize: 13,
fontWeight: FontWeight.w700,
color: scheme.onSurface,
letterSpacing: 0.6,
),
),
),
);
}
}
/// Disposes [controller] when the dialog content unmounts, i.e. after the
/// route's exit animation, so the TextField never sees a disposed controller.
class _DisposeControllerOnUnmount extends StatefulWidget {
+9 -1
View File
@@ -316,7 +316,15 @@ class _DiscoveryScreenState extends State<DiscoveryScreen> {
content: Text(context.l10n.discoveredContacts_contactAdded),
action: SnackBarAction(
label: context.l10n.common_undo,
onPressed: () => connector.removeContact(contact),
onPressed: () => unawaited(
connector.removeContact(contact).catchError((Object _) {
if (!context.mounted) return;
showDismissibleSnackBar(
context,
content: Text(context.l10n.contacts_removeFailed),
);
}),
),
),
);
} catch (_) {
File diff suppressed because it is too large. Load diff
+37 -1
View File
@@ -22,6 +22,7 @@ import 'package:meshcore_open/helpers/snack_bar_builder.dart';
import 'package:meshcore_open/widgets/path_map_scaffold.dart';
import 'package:meshcore_open/widgets/path_map_ui.dart';
import 'package:meshcore_open/widgets/snr_indicator.dart';
import 'package:meshcore_open/widgets/set_my_location_dialog.dart';
import 'package:provider/provider.dart';
import '../theme/mesh_theme.dart';
@@ -64,6 +65,13 @@ class PathTraceMapScreen extends StatefulWidget {
final int pathHashByteWidth;
final List<Contact>? pathContacts;
/// A previous PUSH_CODE_TRACE_DATA frame to show instead of sending a new
/// trace when the screen opens.
final Uint8List? initialTraceFrame;
/// Called with each trace response frame this screen receives.
final ValueChanged<Uint8List>? onTraceFrame;
const PathTraceMapScreen({
super.key,
required this.title,
@@ -74,6 +82,8 @@ class PathTraceMapScreen extends StatefulWidget {
this.targetContact,
this.pathHashByteWidth = pathHashSize,
this.pathContacts,
this.initialTraceFrame,
this.onTraceFrame,
});
@override
@@ -219,7 +229,20 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen>
_pathHistory = context.read<PathHistoryService>();
_pathHistory!.addListener(_onPathHistoryChanged);
_setupFrameListener();
_doPathTrace();
final initialFrame = widget.initialTraceFrame;
if (initialFrame == null) {
_doPathTrace();
return;
}
final (livePath, hopWidth) = _resolveLivePath(
context.read<MeshCoreConnector>(),
);
_tracedPath = livePath;
_tracedPathHashWidth = hopWidth;
_isLoading = true;
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) _handleTraceResponse(initialFrame);
});
}
@override
@@ -239,6 +262,16 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen>
});
}
Future<void> _setMyLocation(LatLng point) async {
final connector = context.read<MeshCoreConnector>();
final ok = await confirmAndSetMyLocation(context, connector, point);
if (!ok || !mounted || !_hasData) return;
// Display paths start at the self position, so redraw them from it.
setState(() {
_rebuildDisplayPaths(connector);
});
}
/// Keeps the camera centered on the packet while the follow lock is on.
void _followPacketCamera() {
if (!mounted) return;
@@ -490,6 +523,7 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen>
(listEquals(frame.sublist(4, 8), _sentTagBytes) ||
listEquals(frame.sublist(4, 8), _sentAckTag))) {
_timeoutTimer?.cancel();
widget.onTraceFrame?.call(frame);
if (!mounted) return;
_handleTraceResponse(frame);
}
@@ -1497,6 +1531,8 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen>
initialCenter: _initialCenter!,
initialZoom: _initialZoom,
bounds: _bounds,
onLongPress: (_, point) => _setMyLocation(point),
onSecondaryTap: (_, point) => _setMyLocation(point),
onPositionChanged: (camera, hasGesture) {
if (!mounted) return;
// A manual pan/zoom releases the follow lock.
+2 -9
View File
@@ -25,9 +25,6 @@ import '../widgets/sync_progress_overlay.dart';
import 'region_management_screen.dart';
import '../utils/share_origin.dart';
/// Companion firmware version that added CMD_SET_PATH_HASH_MODE (v1.14.0).
const int _minFirmwareVerCodeForPathHashMode = 10;
class SettingsScreen extends StatefulWidget {
const SettingsScreen({super.key});
@@ -566,14 +563,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
title: l10n.repeater_pathHashMode,
subtitle: !connected
? offline
: (connector.firmwareVerCode ?? 0) <
_minFirmwareVerCodeForPathHashMode
: !connector.supportsPathHashMode
? l10n.settings_requiresFirmware('v1.14')
: _pathHashModeSubtitle(context, connector.pathHashByteWidth),
onTap:
connector.isConnected &&
(connector.firmwareVerCode ?? 0) >=
_minFirmwareVerCodeForPathHashMode
onTap: connector.isConnected && connector.supportsPathHashMode
? () => _editPathHashMode(context, connector)
: null,
),