Merge upstream/dev (35 commits) into tth

Conflicts in lib/widgets/mesh_nav_tile.dart and lib/widgets/mesh_ui.dart:
took upstream's iconSlot/ThemedIcon, busy spinner and SectionHeader
description, and re-applied the terminal theme on top (18 dp icons,
narrower gaps and padding, mono section labels).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-24 11:47:28 +01:00
commit ceab62428a
103 files changed
+13328 -5463

No files matched your search

+119 -62
View File
@@ -54,7 +54,6 @@ import '../widgets/empty_state.dart';
import '../widgets/filter_rule_dialog.dart';
import '../widgets/filtered_message_ghost.dart';
import '../widgets/chat_composer.dart';
import '../widgets/chat_compression_selector.dart';
import '../widgets/chat_send_pipeline.dart';
import '../widgets/chat_zoom_wrapper.dart';
import '../widgets/message_bubble_frame.dart';
@@ -77,7 +76,9 @@ import '../widgets/mesh_ui.dart';
import '../widgets/share_contact_sheet.dart';
import '../widgets/shared_contact_card.dart';
import 'app_settings_screen.dart';
import 'bookmarks_screen.dart';
import 'channel_chat_transcript_grouping.dart';
import 'chat_compression_screen.dart';
import 'channels_screen.dart' show confirmDeleteChannel, showEditChannelSheet;
import 'channel_message_path_screen.dart';
import 'map_screen.dart';
@@ -180,7 +181,6 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
/// Message ids picked for a bulk action. Non-empty means selection mode:
/// taps toggle messages and the app bar shows the bulk actions.
final Set<String> _selectedIds = <String>{};
bool _showBookmarkedOnly = false;
bool get _selecting => _selectedIds.isNotEmpty;
@override
@@ -601,6 +601,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
_toggleChannelFiltering();
case 'notifications':
showChannelNotificationModeSheet(context, muteKey);
case 'compression':
_openCompressionScreen();
case 'region':
openRegionSelectDialog(widget.channel);
case 'editChannel':
@@ -611,10 +613,27 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
onSaved: _onChannelEdited,
);
case 'showBookmarks':
setState(() {
_showBookmarkedOnly = !_showBookmarkedOnly;
_selectedIds.clear();
});
final channelLabel = widget.channel.name.isEmpty
? '#${context.l10n.channels_channelIndex(widget.channel.index)}'
: (widget.channel.name.startsWith('#')
? widget.channel.name
: '#${widget.channel.name}');
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => BookmarksScreen(
initialSourceType: BookmarkSourceType.channel,
initialSourceId:
widget.channel.storageId ??
'slot:${widget.channel.index}',
sourceIdAliases: [
?widget.channel.storageId,
'slot:${widget.channel.index}',
],
initialSourceName: channelLabel,
),
),
);
case 'background':
showChatBackgroundSheet(
context,
@@ -658,6 +677,20 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
),
),
),
PopupMenuItem(
value: 'compression',
child: _menuRow(
Icons.compress,
context.l10n.chatCompression_label(
chatCompressionModeLabel(
context,
context.read<MeshCoreConnector>().channelCompressionMode(
widget.channel.index,
),
),
),
),
),
PopupMenuItem(
value: 'region',
child: _menuRow(
@@ -673,9 +706,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
PopupMenuItem(
value: 'showBookmarks',
child: _menuRow(
_showBookmarkedOnly ? Icons.bookmark : Icons.bookmark_border,
context.l10n.chat_showBookmarks,
color: _showBookmarkedOnly ? const Color(0xFFFFE54A) : null,
Icons.bookmark_border,
context.l10n.bookmarks_title,
),
),
PopupMenuItem(
@@ -882,7 +914,6 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
bottom: false,
child: Column(
children: [
_buildCompressionSelector(),
Expanded(
child: ChatBackdrop(
contentKey: _messageAreaKey,
@@ -910,22 +941,13 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
final layout = _transcriptLayoutFor(
context,
messages,
showBookmarkedOnly: _showBookmarkedOnly,
);
// Fewer entries than messages means the message filter
// hid or collapsed some; bookmark filtering is deliberate.
final hidesMessages =
!_showBookmarkedOnly &&
layout.length < messages.length;
// hid or collapsed some.
final hidesMessages = layout.length < messages.length;
if (hidesMessages) _scheduleHiddenHistoryBackfill();
if (layout.length == 0) {
if (_showBookmarkedOnly) {
return EmptyState(
icon: Icons.bookmark_border,
title: context.l10n.bookmarks_empty,
);
}
final canLoadOlder =
hidesMessages && !_olderHistoryExhausted;
return EmptyState(
@@ -987,6 +1009,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
return Stack(
children: [
ChatZoomWrapper(
enabled: !_selecting,
child: ListView.builder(
reverse: true, // List grows from bottom up
controller: _scrollController,
@@ -1016,14 +1039,19 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
);
}
final row = layout.rowAt(index, messages);
final GlobalKey messageKey;
// Duplicate-id rows use a stable value key
// (not a fresh GlobalKey) so toggling one
// row does not remount every visible row.
final Key messageKey;
if (layout.keyedIndices.contains(index)) {
messageKey = _messageKeys.putIfAbsent(
row.id,
GlobalKey.new,
);
} else {
messageKey = GlobalKey();
messageKey = ValueKey<String>(
'${row.id}#dup$index',
);
}
final dividerId = _unreadDividerMessageId;
final isUnreadAnchor =
@@ -1271,7 +1299,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
: null,
child: MessageBubbleFrame(
isOutgoing: isOutgoing,
isBookmarked: message.isBookmarked || _showBookmarkedOnly,
isBookmarked: message.isBookmarked,
compact: gifId != null,
maxWidth: constraints.maxWidth,
child: Column(
@@ -2317,9 +2345,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
/// `State`'s) — `watch` asserts on that.
_TranscriptLayout _transcriptLayoutFor(
BuildContext context,
List<ChannelMessage> messages, {
bool showBookmarkedOnly = false,
}) {
List<ChannelMessage> messages,
) {
ReceivedImageStore? store;
try {
store = context.watch<ReceivedImageStore>();
@@ -2348,7 +2375,6 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
displayMode,
filterActive,
_revealVersion,
showBookmarkedOnly,
_filteredMessagesSignature(messages),
Object.hashAll(
messages
@@ -2357,8 +2383,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
),
);
final cached = _transcriptLayout;
if (!showBookmarkedOnly &&
cached != null &&
if (cached != null &&
cached.matches(
messages,
_imageStoreVersion,
@@ -2367,14 +2392,11 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
)) {
return cached;
}
final displayedMessages = showBookmarkedOnly
? messages.where((message) => message.isBookmarked).toList()
: messages;
final images = store == null || showBookmarkedOnly
final images = store == null
? const <ReceivedImageEntry>[]
: store.entriesForChannel(widget.channel.storageId);
final layout = _TranscriptLayout.build(
messages: displayedMessages,
messages: messages,
images: images,
imageVersion: _imageStoreVersion,
channelIndex: widget.channel.index,
@@ -2836,26 +2858,35 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
/// Compression is stored on this phone under the channel's storage ID, so
/// it can change while the radio is offline, but not before the slot has
/// one.
Widget _buildCompressionSelector() {
void _openCompressionScreen() {
final slot = widget.channel.index;
return Consumer2<MeshCoreConnector, AppSettingsService>(
builder: (context, connector, settingsService, _) {
final hasStorageId = connector.channelIdForSlot(slot) != null;
return ChatCompressionSelector(
mode: connector.channelCompressionMode(slot),
enabled: hasStorageId,
disabledReason: hasStorageId
? null
: context.l10n.chatCompression_noStorageId,
profiles: settingsService.settings.cyr2latProfiles,
profileId: connector.getChannelCyr2LatProfileId(slot),
defaultProfileId: settingsService.settings.selectedCyr2latProfileId,
final connector = context.read<MeshCoreConnector>();
final settingsService = context.read<AppSettingsService>();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChatCompressionScreen(
listenable: Listenable.merge([connector, settingsService]),
read: () {
final hasStorageId = connector.channelIdForSlot(slot) != null;
return ChatCompressionState(
mode: connector.channelCompressionMode(slot),
enabled: hasStorageId,
disabledReason: hasStorageId
? null
: context.l10n.chatCompression_noStorageId,
profiles: settingsService.settings.cyr2latProfiles,
profileId: connector.getChannelCyr2LatProfileId(slot),
defaultProfileId:
settingsService.settings.selectedCyr2latProfileId,
);
},
onModeChanged: (mode) =>
connector.setChannelCompressionMode(slot, mode),
onProfileChanged: (id) =>
connector.setChannelCyr2LatProfileId(slot, id),
);
},
),
),
);
}
@@ -3220,8 +3251,14 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
? context.l10n.chat_removeBookmark
: context.l10n.chat_bookmark,
),
onTap: () {
onTap: () async {
final connector = context.read<MeshCoreConnector>();
final selfLabel = connector.selfName ?? context.l10n.chat_me;
Navigator.pop(sheetContext);
if (message.isBookmarked) {
final confirmed = await confirmRemoveBookmarks(context);
if (!confirmed || !mounted) return;
}
final bookmark = BookmarkedMessage.fromChannel(
message: message,
channelId:
@@ -3229,15 +3266,12 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
'slot:${widget.channel.index}',
channelName: widget.channel.name,
senderName: message.isOutgoing
? (context.read<MeshCoreConnector>().selfName ??
context.l10n.chat_me)
? selfLabel
: message.senderName,
);
unawaited(
context.read<MeshCoreConnector>().setBookmarkedMessage(
bookmark,
isBookmarked: !message.isBookmarked,
),
await connector.setBookmarkedMessage(
bookmark,
isBookmarked: !message.isBookmarked,
);
},
),
@@ -3341,10 +3375,9 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
final filterActive = _transcriptLayout?.filterActive ?? true;
return [
for (final m in messages)
if ((!_showBookmarkedOnly || m.isBookmarked) &&
!(filterActive &&
m.isFiltered &&
!_revealedFilteredIds.contains(m.messageId)))
if (!(filterActive &&
m.isFiltered &&
!_revealedFilteredIds.contains(m.messageId)))
m,
];
}
@@ -3423,6 +3456,11 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
icon: const Icon(Icons.visibility_outlined),
onPressed: () => _bulkMarkNotSpam(notSpamCandidates),
),
IconButton(
tooltip: l10n.chat_bookmark,
icon: const Icon(Icons.bookmark_add_outlined),
onPressed: selected.isEmpty ? null : () => _bulkBookmark(selected),
),
IconButton(
tooltip: l10n.common_delete,
icon: const Icon(Icons.delete_outline),
@@ -3497,6 +3535,25 @@ class _ChannelChatScreenState extends State<ChannelChatScreen>
showDismissibleSnackBar(context, content: Text(text));
}
Future<void> _bulkBookmark(List<ChannelMessage> messages) async {
final connector = context.read<MeshCoreConnector>();
final selfLabel = connector.selfName ?? context.l10n.chat_me;
final channelId =
widget.channel.storageId ?? 'slot:${widget.channel.index}';
final channelName = widget.channel.name;
final toBookmark = messages.where((m) => !m.isBookmarked).toList();
_clearSelection();
for (final message in toBookmark) {
final bookmark = BookmarkedMessage.fromChannel(
message: message,
channelId: channelId,
channelName: channelName,
senderName: message.isOutgoing ? selfLabel : message.senderName,
);
await connector.setBookmarkedMessage(bookmark, isBookmarked: true);
}
}
Future<void> _bulkDelete(List<ChannelMessage> messages) async {
final connector = context.read<MeshCoreConnector>();
final confirmed = await confirmBulkDelete(context, messages.length);