Add localization support for German, Spanish, French, and Italian

- Updated localization files for French, Croatian, Italian, Slovenian to include translations for German, Spanish, French, and Italian.
- Added new methods for handling drawing messages sent to the public channel in multiple languages.
- Enhanced the Contact model to identify public channels using a dedicated method.
- Implemented echo detection for public channel messages, including tracking and reporting of echoes.
- Updated BLE response handling to support echo detection and tracking of sent messages.
- Modified UI components to reflect new localization strings and echo statuses.
This commit is contained in:
Janez T
2025-10-18 22:39:26 +02:00
parent da03592980
commit 52b2f4ede1
30 changed files with 1971 additions and 37 deletions

View File

@@ -133,6 +133,8 @@ class ConnectionProvider with ChangeNotifier {
Function(String messageId, int expectedAckTag, int suggestedTimeoutMs)?
onMessageSent;
Function(int ackCode, int roundTripTimeMs)? onMessageDelivered;
Function(String messageId, int echoCount, int snrRaw, int rssiDbm)?
onMessageEchoDetected;
Function(Uint8List publicKeyPrefix, Uint8List statusData)? onStatusResponse;
// Track pending send operations for auto-recovery
@@ -381,6 +383,13 @@ class ConnectionProvider with ChangeNotifier {
onMessageDelivered?.call(ackCode, roundTripTimeMs);
};
_bleService.onMessageEchoDetected = (messageId, echoCount, snrRaw, rssiDbm) {
print(
'🔊 [Provider] Echo detected - Message: $messageId, Count: $echoCount',
);
onMessageEchoDetected?.call(messageId, echoCount, snrRaw, rssiDbm);
};
_bleService.onStatusResponse = (publicKeyPrefix, statusData) {
print('📥 [Provider] Status response received from node');
print(
@@ -774,8 +783,16 @@ class ConnectionProvider with ChangeNotifier {
}
try {
debugPrint('📨 [ConnectionProvider] sendChannelMessage called:');
debugPrint(' Channel: $channelIdx');
debugPrint(' Text: $text');
debugPrint(' MessageID: $messageId');
await _bleService.sendChannelMessage(channelIdx: channelIdx, text: text);
debugPrint('✅ [ConnectionProvider] BLE send completed');
debugPrint(' Checking messageId: ${messageId != null ? "Present ($messageId)" : "NULL"}');
// Channel messages are ephemeral (not persisted) - mark as "sent" immediately
// They don't have ACK/TAG mechanism like direct messages
if (messageId != null) {
@@ -783,6 +800,12 @@ class ConnectionProvider with ChangeNotifier {
print(' Message ID: $messageId');
print(' onMessageSent callback exists: ${onMessageSent != null}');
// Track for echo detection
// The BLE handler will capture the packet via LOG_RX_DATA and associate it
debugPrint(' Calling trackSentChannelMessage...');
_bleService.trackSentChannelMessage(messageId);
debugPrint(' trackSentChannelMessage completed');
// Small delay to ensure the message is in the MessagesProvider list
// before we try to mark it as sent
await Future.delayed(const Duration(milliseconds: 50));