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

+15
View File
@@ -2,6 +2,7 @@ import 'dart:typed_data';
import '../connector/meshcore_protocol.dart';
import '../helpers/reaction_helper.dart';
import '../helpers/smaz.dart';
import 'message.dart' show futureTimestampTolerance;
import 'translation_support.dart';
import '../utils/app_logger.dart';
@@ -36,6 +37,11 @@ class ChannelMessage {
final MessageTranslationStatus translationStatus;
final String? translationModelId;
final DateTime timestamp;
/// Local clock time when this message was added (received or sent). Feeds
/// are ordered by it so a sender clock running ahead cannot pin a message
/// to the bottom; [timestamp] stays the sender's identity time.
final DateTime receivedAt;
final bool isOutgoing;
final ChannelMessageStatus status;
final List<Repeat> repeats;
@@ -63,6 +69,7 @@ class ChannelMessage {
this.translationStatus = MessageTranslationStatus.none,
this.translationModelId,
required this.timestamp,
DateTime? receivedAt,
required this.isOutgoing,
this.status = ChannelMessageStatus.pending,
this.repeats = const [],
@@ -82,6 +89,7 @@ class ChannelMessage {
}) : messageId =
messageId ??
'${timestamp.millisecondsSinceEpoch}_${senderName.hashCode}_${text.hashCode}',
receivedAt = receivedAt ?? timestamp,
reactions = reactions ?? {},
pathBytes = pathBytes ?? Uint8List(0),
pathVariants = _mergePathVariants(
@@ -92,6 +100,11 @@ class ChannelMessage {
String? get senderKeyHex =>
senderKey != null ? pubKeyToHex(senderKey!) : null;
/// True when the sender's clock put [timestamp] clearly ahead of the time
/// this device received the message.
bool get hasFutureTimestamp =>
timestamp.difference(receivedAt) > futureTimestampTolerance;
ChannelMessage copyWith({
ChannelMessageStatus? status,
List<Repeat>? repeats,
@@ -130,6 +143,7 @@ class ChannelMessage {
? this.translationModelId
: translationModelId as String?,
timestamp: timestamp,
receivedAt: receivedAt,
isOutgoing: isOutgoing,
status: status ?? this.status,
repeats: repeats ?? this.repeats,
@@ -225,6 +239,7 @@ class ChannelMessage {
senderName: senderName,
text: decodedText,
timestamp: DateTime.fromMillisecondsSinceEpoch(timestampRaw * 1000),
receivedAt: DateTime.now(),
isOutgoing: false,
status: ChannelMessageStatus.sent,
pathLength: pathLen,