Fix review findings, add default flood scope, and address recent issues

Review fixes:
- Keep stored message history beyond the 200-message window; stop
  messages leaking between radios; reset link/session state on disconnect
- Accept firmware's 176-byte RX frames over USB/TCP
- Hold APP_START during contact sync; contact-sync watchdog; replay DMs
  from not-yet-known senders; tombstone late command replies; finish
  channel sync on ERR_NOT_FOUND; fail region-scoped sends cleanly
- DM retry watchdog when RESP_CODE_SENT never arrives; late repeater CLI
  replies; ACK hash collisions; UTF-8-safe name truncation
- Image pipeline: delete-during-decode, lifecycle cancels, decoder memory
  release, entry cap, dead worker recovery, atomic model writes
- Storage: deterministic reaction hash across web/native, Smaz
  double-decode, per-entry parsing, per-radio path history and regions,
  review-mode data isolation
- UI: safe channel slot selection, byte-length name limits, double-send
  guard, mounted checks, localized hardcoded strings
- Skip persisted-store reload on repeat SELF_INFO

Features:
- Radio default flood scope (firmware ver 11+) and explicit unscoped
  sends (ver 12+)
- Scan for nearby nodes (#570)
- Optional distinct first-hop repeater counting for channel resend (#589)
- Optional region next to hop count (#580)

Issues:
- Message text follows system font size (#569)
- Repeater/room password field accepts 20 chars (#576)
- TCP auto-reconnect and keepalive (#571)
- Order feeds by local receive time; flag future timestamps (#584)
- Coding rate help text (#568), French "Favoris" (#575)
- iOS/macOS app badge now clears

Translations for all new strings in every locale.
This commit is contained in:
zjs81 committed 2026-10-11 01:25:31 -07:00
1 parent a64a33d0c0
commit 25f197c979
120 files changed
+10424 -687

No files matched your search

+129 -22
View File
@@ -30,6 +30,7 @@ import '../widgets/sync_progress_overlay.dart';
import '../widgets/unread_badge.dart';
import '../helpers/gif_helper.dart';
import '../helpers/snack_bar_builder.dart';
import '../helpers/utf8_length_limiter.dart';
import 'channel_chat_screen.dart';
import 'community_qr_scanner_screen.dart';
import 'contacts_screen.dart';
@@ -399,6 +400,9 @@ class _ChannelsScreenState extends State<ChannelsScreen>
? context.l10n.channels_regionSetTo(
connector.getChannelRegion(channel.index),
)
: connector.isChannelExplicitlyUnscoped(channel.index) &&
connector.supportsExplicitUnscopedFlood
? context.l10n.channels_regionNotSet
: '';
switch (channelType) {
case ChannelType.communityPublic:
@@ -836,17 +840,7 @@ class _ChannelsScreenState extends State<ChannelsScreen>
void _showAddChannelDialog(BuildContext context) {
final connector = context.read<MeshCoreConnector>();
final nextIndex = _findNextAvailableIndex(
connector.channels,
connector.maxChannels,
);
if (nextIndex == null) {
showDismissibleSnackBar(
context,
content: Text(context.l10n.channels_noFreeSlots),
);
return;
}
if (_resolveFreeChannelSlot(context, connector) == null) return;
final hasPublicChannel = connector.channels.any((c) => c.isPublicChannel);
int? selectedOption;
final nameController = TextEditingController();
@@ -958,7 +952,11 @@ class _ChannelsScreenState extends State<ChannelsScreen>
labelText: sheetContext.l10n.channels_channelName,
border: const OutlineInputBorder(),
),
maxLength: 31,
inputFormatters: const [
Utf8LengthLimitingTextInputFormatter(
maxRadioNameBytes,
),
],
),
),
Padding(
@@ -980,6 +978,11 @@ class _ChannelsScreenState extends State<ChannelsScreen>
);
return;
}
final nextIndex = _resolveFreeChannelSlot(
context,
connector,
);
if (nextIndex == null) return;
final psk = randomBytes(16);
Navigator.pop(sheetContext);
await connector.setChannel(
@@ -1023,7 +1026,11 @@ class _ChannelsScreenState extends State<ChannelsScreen>
labelText: sheetContext.l10n.channels_channelName,
border: const OutlineInputBorder(),
),
maxLength: 31,
inputFormatters: const [
Utf8LengthLimitingTextInputFormatter(
maxRadioNameBytes,
),
],
),
),
Padding(
@@ -1071,6 +1078,11 @@ class _ChannelsScreenState extends State<ChannelsScreen>
);
return;
}
final nextIndex = _resolveFreeChannelSlot(
context,
connector,
);
if (nextIndex == null) return;
Navigator.pop(sheetContext);
connector.setChannel(nextIndex, name, psk);
if (context.mounted) {
@@ -1103,6 +1115,11 @@ class _ChannelsScreenState extends State<ChannelsScreen>
Expanded(
child: FilledButton(
onPressed: () {
final nextIndex = _resolveFreeChannelSlot(
context,
connector,
);
if (nextIndex == null) return;
final psk = Channel.parsePskHex(
Channel.publicChannelPsk,
);
@@ -1214,7 +1231,21 @@ class _ChannelsScreenState extends State<ChannelsScreen>
border: const OutlineInputBorder(),
prefixIcon: const Icon(Icons.tag),
),
maxLength: 31,
inputFormatters: [
Utf8LengthLimitingTextInputFormatter(
maxRadioNameBytes,
encoder: (text) {
final tag = text.trim().startsWith('#')
? text.trim().substring(1)
: text.trim();
if (!isRegularHashtag &&
selectedCommunity != null) {
return '${selectedCommunity!.name} #$tag';
}
return '#$tag';
},
),
],
),
),
// Privacy hint for community hashtags
@@ -1259,6 +1290,27 @@ class _ChannelsScreenState extends State<ChannelsScreen>
if (hashtag.startsWith('#')) {
hashtag = hashtag.substring(1);
}
if (!isRegularHashtag &&
selectedCommunity != null &&
utf8ByteLength(
'${selectedCommunity!.name} #$hashtag',
) >
maxRadioNameBytes) {
showDismissibleSnackBar(
context,
content: Text(
sheetContext.l10n.channels_nameTooLong(
maxRadioNameBytes,
),
),
);
return;
}
final nextIndex = _resolveFreeChannelSlot(
context,
connector,
);
if (nextIndex == null) return;
final String channelName;
final Uint8List psk;
@@ -1369,7 +1421,13 @@ class _ChannelsScreenState extends State<ChannelsScreen>
border: const OutlineInputBorder(),
prefixIcon: const Icon(Icons.groups),
),
maxLength: 31,
inputFormatters: [
Utf8LengthLimitingTextInputFormatter(
maxRadioNameBytes,
encoder: (text) =>
'$text ${sheetContext.l10n.channels_public}',
),
],
),
),
CheckboxListTile(
@@ -1408,6 +1466,16 @@ class _ChannelsScreenState extends State<ChannelsScreen>
return;
}
final nextIndex = addPublicChannel
? _resolveFreeChannelSlot(
context,
connector,
)
: null;
if (addPublicChannel && nextIndex == null) {
return;
}
// Create community with random secret
final community = Community.create(
id: const Uuid().v4(),
@@ -1418,11 +1486,13 @@ class _ChannelsScreenState extends State<ChannelsScreen>
await _communityStore.addCommunity(community);
// Optionally add the community public channel to the device
if (addPublicChannel) {
if (nextIndex != null) {
final psk = community
.deriveCommunityPublicPsk();
final channelName =
'${community.name} $publicLabel';
final channelName = fitRadioName(
community.name,
publicLabel,
);
connector.setChannel(
nextIndex,
channelName,
@@ -1602,7 +1672,9 @@ class _ChannelsScreenState extends State<ChannelsScreen>
labelText: sheetContext.l10n.channels_channelName,
border: const OutlineInputBorder(),
),
maxLength: 31,
inputFormatters: const [
Utf8LengthLimitingTextInputFormatter(maxRadioNameBytes),
],
),
const SizedBox(height: 16),
TextField(
@@ -1835,17 +1907,52 @@ class _ChannelsScreenState extends State<ChannelsScreen>
);
}
/// Picks a free channel slot at the moment the user commits, or shows why
/// none can be used. Slots are only trusted after a complete channel sync:
/// while syncing, a slot that hasn't been fetched yet looks empty and
/// writing to it would overwrite the channel stored on the radio.
int? _resolveFreeChannelSlot(
BuildContext context,
MeshCoreConnector connector,
) {
if (connector.isSyncingChannels || !connector.hasLoadedChannels) {
showDismissibleSnackBar(
context,
content: Text(context.l10n.channels_waitForSync),
);
return null;
}
final index = _findNextAvailableIndex(
connector.channels,
connector.maxChannels,
connector.unconfirmedChannelSlots,
);
if (index == null) {
showDismissibleSnackBar(
context,
content: Text(context.l10n.channels_noFreeSlots),
);
}
return index;
}
void _addPublicChannel(BuildContext context, MeshCoreConnector connector) {
final index = _resolveFreeChannelSlot(context, connector);
if (index == null) return;
final psk = Channel.parsePskHex(Channel.publicChannelPsk);
connector.setChannel(0, context.l10n.channels_public, psk);
connector.setChannel(index, context.l10n.channels_public, psk);
showDismissibleSnackBar(
context,
content: Text(context.l10n.channels_publicChannelAdded),
);
}
int? _findNextAvailableIndex(List<Channel> channels, int maxChannels) {
final usedIndices = channels.map((c) => c.index).toSet();
int? _findNextAvailableIndex(
List<Channel> channels,
int maxChannels,
Set<int> unconfirmedSlots,
) {
final usedIndices = {...channels.map((c) => c.index), ...unconfirmedSlots};
for (int i = 0; i < maxChannels; i++) {
if (!usedIndices.contains(i)) return i;
}