Add optional SMAZ compression indicator icon on messages
This commit is contained in:
1 parent
ae967ec21f
commit
d76d488e45
36 files changed
+1321
-38
No files matched your search
@@ -5171,9 +5171,8 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
}) async {
|
||||
if (!isConnected || text.isEmpty) return;
|
||||
|
||||
final outboundBytes = utf8.encode(
|
||||
prepareContactOutboundText(contact, text),
|
||||
);
|
||||
final prepared = prepareContactOutbound(contact, text);
|
||||
final outboundBytes = utf8.encode(prepared.text);
|
||||
if (outboundBytes.length > maxTextPayloadBytes) {
|
||||
debugPrint(
|
||||
'sendMessage: dropping overlong message '
|
||||
@@ -5222,6 +5221,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
originalText: originalText,
|
||||
translatedLanguageCode: translatedLanguageCode,
|
||||
translationModelId: translationModelId,
|
||||
isSmazCompressed: prepared.isSmazCompressed,
|
||||
);
|
||||
} else {
|
||||
// Fallback to old behavior if retry service not initialized
|
||||
@@ -5234,11 +5234,11 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
originalText: originalText,
|
||||
translatedLanguageCode: translatedLanguageCode,
|
||||
translationModelId: translationModelId,
|
||||
isSmazCompressed: prepared.isSmazCompressed,
|
||||
);
|
||||
_addMessage(contact.publicKeyHex, message); // recipient as "sender"
|
||||
notifyListeners();
|
||||
final outboundText = prepareContactOutboundText(contact, text);
|
||||
await sendFrame(buildSendTextMsgFrame(contact.publicKey, outboundText));
|
||||
await sendFrame(buildSendTextMsgFrame(contact.publicKey, prepared.text));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5661,6 +5661,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
// we continue to process it normally.
|
||||
}
|
||||
|
||||
final prepared = prepareChannelOutbound(channel.index, text);
|
||||
final message = ChannelMessage.outgoing(
|
||||
text,
|
||||
_selfName ?? 'Me',
|
||||
@@ -5670,12 +5671,13 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
translationModelId: translationModelId,
|
||||
region: sendRegion,
|
||||
replyTo: replyTo,
|
||||
isSmazCompressed: prepared.isSmazCompressed,
|
||||
);
|
||||
_addChannelMessage(channel.index, message);
|
||||
_pendingChannelSentQueue.add(message.messageId);
|
||||
notifyListeners();
|
||||
|
||||
final outboundText = prepareChannelOutboundText(channel.index, text);
|
||||
final outboundText = prepared.text;
|
||||
// Resends reuse the timestamp, so they are the same packet: repeaters
|
||||
// that already forwarded it drop the copy and recipients see it once.
|
||||
Future<void> transmit({bool isResend = false}) =>
|
||||
@@ -8333,9 +8335,8 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
appLogger.warn('Received message with empty text, ignoring');
|
||||
return null;
|
||||
}
|
||||
final decodedText = isCli
|
||||
? msgText
|
||||
: (Smaz.tryDecodePrefixed(msgText) ?? msgText);
|
||||
final smazDecoded = isCli ? null : Smaz.tryDecodePrefixed(msgText);
|
||||
final decodedText = smazDecoded ?? msgText;
|
||||
|
||||
final contact = _contacts.cast<Contact?>().firstWhere(
|
||||
(c) => c != null && _matchesPrefix(c.publicKey, senderPrefix),
|
||||
@@ -8355,6 +8356,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
receivedAt: DateTime.now(),
|
||||
isOutgoing: false,
|
||||
isCli: isCli,
|
||||
isSmazCompressed: smazDecoded != null,
|
||||
status: MessageStatus.delivered,
|
||||
pathLength: pathLength == 0xFF ? null : (pathLength & 0x3F),
|
||||
pathBytes: Uint8List(0),
|
||||
@@ -8484,7 +8486,13 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
|
||||
/// Prepares contact outbound text by applying SMAZ encoding if enabled.
|
||||
/// This should be used to transform text before computing ACK hashes.
|
||||
String prepareContactOutboundText(Contact contact, String text) {
|
||||
String prepareContactOutboundText(Contact contact, String text) =>
|
||||
prepareContactOutbound(contact, text).text;
|
||||
|
||||
({String text, bool isSmazCompressed}) prepareContactOutbound(
|
||||
Contact contact,
|
||||
String text,
|
||||
) {
|
||||
final trimmed = text.trim();
|
||||
final isStructuredPayload =
|
||||
trimmed.startsWith('g:') ||
|
||||
@@ -8492,7 +8500,8 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
trimmed.startsWith('V1|');
|
||||
if (!isStructuredPayload) {
|
||||
if (isContactSmazEnabled(contact.publicKeyHex)) {
|
||||
return Smaz.encodeIfSmaller(text);
|
||||
final encoded = Smaz.encodeIfSmaller(text);
|
||||
return (text: encoded, isSmazCompressed: encoded != text);
|
||||
} else if (isContactCyr2LatEnabled(contact.publicKeyHex)) {
|
||||
final profileId = getContactCyr2LatProfileId(contact.publicKeyHex);
|
||||
final profile = profileId != null && _appSettingsService != null
|
||||
@@ -8508,19 +8517,26 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
Cyr2Lat.setCharMap(globalProfile.charMap);
|
||||
}
|
||||
}
|
||||
return Cyr2Lat.encode(text);
|
||||
return (text: Cyr2Lat.encode(text), isSmazCompressed: false);
|
||||
}
|
||||
}
|
||||
return text;
|
||||
return (text: text, isSmazCompressed: false);
|
||||
}
|
||||
|
||||
String prepareChannelOutboundText(int channelIndex, String text) {
|
||||
String prepareChannelOutboundText(int channelIndex, String text) =>
|
||||
prepareChannelOutbound(channelIndex, text).text;
|
||||
|
||||
({String text, bool isSmazCompressed}) prepareChannelOutbound(
|
||||
int channelIndex,
|
||||
String text,
|
||||
) {
|
||||
final trimmed = text.trim();
|
||||
final isStructuredPayload =
|
||||
trimmed.startsWith('g:') || trimmed.startsWith('m:');
|
||||
if (!isStructuredPayload) {
|
||||
if (isChannelSmazEnabled(channelIndex)) {
|
||||
return Smaz.encodeIfSmaller(text);
|
||||
final encoded = Smaz.encodeIfSmaller(text);
|
||||
return (text: encoded, isSmazCompressed: encoded != text);
|
||||
} else if (isChannelCyr2LatEnabled(channelIndex)) {
|
||||
final profileId = getChannelCyr2LatProfileId(channelIndex);
|
||||
final profile = profileId != null && _appSettingsService != null
|
||||
@@ -8536,10 +8552,10 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
Cyr2Lat.setCharMap(globalProfile.charMap);
|
||||
}
|
||||
}
|
||||
return Cyr2Lat.encode(text);
|
||||
return (text: Cyr2Lat.encode(text), isSmazCompressed: false);
|
||||
}
|
||||
}
|
||||
return text;
|
||||
return (text: text, isSmazCompressed: false);
|
||||
}
|
||||
|
||||
// Falls back to the cached channel list, which stays populated while a
|
||||
@@ -8727,8 +8743,8 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
|
||||
final text = decrypted.readCString();
|
||||
final parsed = _splitSenderText(text);
|
||||
final decodedText =
|
||||
Smaz.tryDecodePrefixed(parsed.text) ?? parsed.text;
|
||||
final smazDecoded = Smaz.tryDecodePrefixed(parsed.text);
|
||||
final decodedText = smazDecoded ?? parsed.text;
|
||||
if (_shouldDropSelfChannelMessage(
|
||||
parsed.senderName,
|
||||
packet.pathBytes,
|
||||
@@ -8758,6 +8774,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
timestamp: DateTime.fromMillisecondsSinceEpoch(timestampRaw * 1000),
|
||||
receivedAt: DateTime.now(),
|
||||
isOutgoing: false,
|
||||
isSmazCompressed: smazDecoded != null,
|
||||
status: ChannelMessageStatus.sent,
|
||||
pathLength: packet.isFlood ? packet.hopCount : 0,
|
||||
pathHashWidth: packet.pathHashWidth,
|
||||
@@ -9572,6 +9589,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
timestamp: message.timestamp,
|
||||
receivedAt: message.receivedAt,
|
||||
isOutgoing: message.isOutgoing,
|
||||
isSmazCompressed: message.isSmazCompressed,
|
||||
status: message.status,
|
||||
repeats: message.repeats,
|
||||
repeatCount: message.repeatCount,
|
||||
@@ -9620,6 +9638,8 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
existing.status == ChannelMessageStatus.pending;
|
||||
messages[existingIndex] = existing.copyWith(
|
||||
repeatCount: newRepeatCount,
|
||||
isSmazCompressed:
|
||||
existing.isSmazCompressed || processedMessage.isSmazCompressed,
|
||||
pathLength: mergedPathLength,
|
||||
pathHashWidth: existing.pathHashWidth ?? processedMessage.pathHashWidth,
|
||||
pathBytes: mergedPathBytes,
|
||||
|
||||
+4
-1
@@ -601,6 +601,8 @@
|
||||
"appSettings_enableMessageTracingSubtitle": "Also show repeat counts and trip times. Long-press a message and choose Path for full details.",
|
||||
"appSettings_regionOnHopsLine": "Region next to hop count",
|
||||
"appSettings_regionOnHopsLineSubtitle": "Show a channel message's region on the same line as its hop count instead of below it.",
|
||||
"appSettings_showCompressionIndicator": "Compression indicator",
|
||||
"appSettings_showCompressionIndicatorSubtitle": "Show an icon on messages compressed with SMAZ.",
|
||||
"appSettings_notifications": "Notifications",
|
||||
"appSettings_enableNotifications": "Enable Notifications",
|
||||
"appSettings_enableNotificationsSubtitle": "Receive notifications for messages and adverts",
|
||||
@@ -4359,5 +4361,6 @@
|
||||
"chatCompression_cyr2latDescription": "Not lossless. Swaps some Cyrillic letters for lookalike Latin ones (А→A, З→3) to save bytes. Readable in any app with no decoding, but the exact characters change, including your own sent messages here. Copying, search and technical text may be affected. Results depend on the chosen profile.",
|
||||
"chatCompression_profile": "Cyr2Lat profile",
|
||||
"chatCompression_noStorageId": "Can't change compression until this channel has synced from the radio.",
|
||||
"chatCompression_saveFailed": "Couldn't save the compression setting. Showing the saved setting."
|
||||
"chatCompression_saveFailed": "Couldn't save the compression setting. Showing the saved setting.",
|
||||
"messageMeta_smazCompressed": "SMAZ compressed"
|
||||
}
|
||||
@@ -2533,6 +2533,18 @@ abstract class AppLocalizations {
|
||||
/// **'Show a channel message\'s region on the same line as its hop count instead of below it.'**
|
||||
String get appSettings_regionOnHopsLineSubtitle;
|
||||
|
||||
/// No description provided for @appSettings_showCompressionIndicator.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Compression indicator'**
|
||||
String get appSettings_showCompressionIndicator;
|
||||
|
||||
/// No description provided for @appSettings_showCompressionIndicatorSubtitle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Show an icon on messages compressed with SMAZ.'**
|
||||
String get appSettings_showCompressionIndicatorSubtitle;
|
||||
|
||||
/// No description provided for @appSettings_notifications.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
@@ -12693,6 +12705,12 @@ abstract class AppLocalizations {
|
||||
/// In en, this message translates to:
|
||||
/// **'Couldn\'t save the compression setting. Showing the saved setting.'**
|
||||
String get chatCompression_saveFailed;
|
||||
|
||||
/// No description provided for @messageMeta_smazCompressed.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'SMAZ compressed'**
|
||||
String get messageMeta_smazCompressed;
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1385,6 +1386,13 @@ class AppLocalizationsBg extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Показвай региона на съобщението в канала на същия ред като броя хопове, а не под него.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Уведомления';
|
||||
|
||||
@@ -7618,4 +7626,7 @@ class AppLocalizationsBg extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1376,6 +1377,13 @@ class AppLocalizationsCs extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Zobrazit region zprávy kanálu na stejném řádku jako počet skoků místo pod ním.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Oznámení';
|
||||
|
||||
@@ -7589,4 +7597,7 @@ class AppLocalizationsCs extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1384,6 +1385,13 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Die Region einer Kanalnachricht in derselben Zeile wie die Hop-Anzahl anzeigen statt darunter.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Benachrichtigungen';
|
||||
|
||||
@@ -7633,4 +7641,7 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1359,6 +1360,13 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Show a channel message\'s region on the same line as its hop count instead of below it.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Notifications';
|
||||
|
||||
@@ -7505,4 +7513,7 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1377,6 +1378,13 @@ class AppLocalizationsEs extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Mostrar la región de un mensaje de canal en la misma línea que su número de saltos en lugar de debajo.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Notificaciones';
|
||||
|
||||
@@ -7610,4 +7618,7 @@ class AppLocalizationsEs extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1383,6 +1384,13 @@ class AppLocalizationsFr extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Afficher la région d\'un message de canal sur la même ligne que son nombre de sauts plutôt qu\'en dessous.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Notifications';
|
||||
|
||||
@@ -7638,4 +7646,7 @@ class AppLocalizationsFr extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1376,6 +1377,13 @@ class AppLocalizationsHu extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'A csatornaüzenet régiója az ugrásszámmal azonos sorban jelenik meg, nem alatta.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Értesítések';
|
||||
|
||||
@@ -7602,4 +7610,7 @@ class AppLocalizationsHu extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1381,6 +1382,13 @@ class AppLocalizationsIt extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Mostra la regione di un messaggio di canale sulla stessa riga del numero di salti invece che sotto.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Notifiche';
|
||||
|
||||
@@ -7622,4 +7630,7 @@ class AppLocalizationsIt extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1316,6 +1317,13 @@ class AppLocalizationsJa extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'チャンネルメッセージの地域を、ホップ数の下ではなく同じ行に表示します。';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => '通知';
|
||||
|
||||
@@ -7265,4 +7273,7 @@ class AppLocalizationsJa extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1319,6 +1320,13 @@ class AppLocalizationsKo extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'채널 메시지의 지역을 홉 수 아래가 아닌 같은 줄에 표시합니다.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => '알림';
|
||||
|
||||
@@ -7278,4 +7286,7 @@ class AppLocalizationsKo extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1374,6 +1375,13 @@ class AppLocalizationsNl extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Toon de regio van een kanaalbericht op dezelfde regel als het aantal hops in plaats van eronder.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Notificaties';
|
||||
|
||||
@@ -7578,4 +7586,7 @@ class AppLocalizationsNl extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1387,6 +1388,13 @@ class AppLocalizationsPl extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Pokaż region wiadomości kanału w tym samym wierszu co liczba hopów, zamiast pod nią.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Powiadomienia';
|
||||
|
||||
@@ -7656,4 +7664,7 @@ class AppLocalizationsPl extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1380,6 +1381,13 @@ class AppLocalizationsPt extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Mostra a região de uma mensagem de canal na mesma linha da contagem de saltos, em vez de abaixo dela.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Notificações';
|
||||
|
||||
@@ -7600,6 +7608,9 @@ class AppLocalizationsPt extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
|
||||
/// The translations for Portuguese, as used in Portugal (`pt_PT`).
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1379,6 +1380,13 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Показывать регион сообщения канала в одной строке с числом хопов, а не под ней.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Уведомления';
|
||||
|
||||
@@ -7636,4 +7644,7 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1374,6 +1375,13 @@ class AppLocalizationsSk extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Zobraziť región správy kanála v rovnakom riadku ako počet skokov namiesto pod ním.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Upozornenia';
|
||||
|
||||
@@ -7601,4 +7609,7 @@ class AppLocalizationsSk extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1373,6 +1374,13 @@ class AppLocalizationsSl extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Regijo sporočila kanala prikaži v isti vrstici kot število skokov, ne pod njim.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Obvestila';
|
||||
|
||||
@@ -7595,4 +7603,7 @@ class AppLocalizationsSl extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1364,6 +1365,13 @@ class AppLocalizationsSv extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Visa ett kanalmeddelandes region på samma rad som dess hoppantal i stället för under det.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Notifieringar';
|
||||
|
||||
@@ -7555,4 +7563,7 @@ class AppLocalizationsSv extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1375,6 +1376,13 @@ class AppLocalizationsUk extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'Показувати регіон повідомлення каналу в одному рядку з кількістю хопів, а не під ним.';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => 'Сповіщення';
|
||||
|
||||
@@ -7648,4 +7656,7 @@ class AppLocalizationsUk extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// ignore: unused_import
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
@@ -1297,6 +1298,13 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
String get appSettings_regionOnHopsLineSubtitle =>
|
||||
'将频道消息的地区与跳数显示在同一行,而不是在其下方。';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicator => 'Compression indicator';
|
||||
|
||||
@override
|
||||
String get appSettings_showCompressionIndicatorSubtitle =>
|
||||
'Show an icon on messages compressed with SMAZ.';
|
||||
|
||||
@override
|
||||
String get appSettings_notifications => '通知';
|
||||
|
||||
@@ -7108,4 +7116,7 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
@override
|
||||
String get chatCompression_saveFailed =>
|
||||
'Couldn\'t save the compression setting. Showing the saved setting.';
|
||||
|
||||
@override
|
||||
String get messageMeta_smazCompressed => 'SMAZ compressed';
|
||||
}
|
||||
@@ -120,6 +120,7 @@ class AppSettings {
|
||||
final bool mapClusterNodes;
|
||||
final bool enableMessageTracing;
|
||||
final bool regionOnHopsLine;
|
||||
final bool showCompressionIndicator;
|
||||
final Map<String, double>? mapCacheBounds;
|
||||
final int mapCacheMinZoom;
|
||||
final int mapCacheMaxZoom;
|
||||
@@ -274,6 +275,7 @@ class AppSettings {
|
||||
this.mapClusterNodes = true,
|
||||
this.enableMessageTracing = false,
|
||||
this.regionOnHopsLine = false,
|
||||
this.showCompressionIndicator = false,
|
||||
this.mapCacheBounds,
|
||||
this.mapCacheMinZoom = 10,
|
||||
this.mapCacheMaxZoom = 15,
|
||||
@@ -371,6 +373,7 @@ class AppSettings {
|
||||
'map_cluster_nodes': mapClusterNodes,
|
||||
'enable_message_tracing': enableMessageTracing,
|
||||
'region_on_hops_line': regionOnHopsLine,
|
||||
'show_compression_indicator': showCompressionIndicator,
|
||||
'map_cache_bounds': mapCacheBounds,
|
||||
'map_cache_min_zoom': mapCacheMinZoom,
|
||||
'map_cache_max_zoom': mapCacheMaxZoom,
|
||||
@@ -508,6 +511,8 @@ class AppSettings {
|
||||
mapClusterNodes: json['map_cluster_nodes'] as bool? ?? true,
|
||||
enableMessageTracing: json['enable_message_tracing'] as bool? ?? false,
|
||||
regionOnHopsLine: json['region_on_hops_line'] as bool? ?? false,
|
||||
showCompressionIndicator:
|
||||
json['show_compression_indicator'] as bool? ?? false,
|
||||
mapCacheBounds: (json['map_cache_bounds'] as Map?)?.map(
|
||||
(key, value) => MapEntry(key.toString(), (value as num).toDouble()),
|
||||
),
|
||||
@@ -681,6 +686,7 @@ class AppSettings {
|
||||
bool? mapClusterNodes,
|
||||
bool? enableMessageTracing,
|
||||
bool? regionOnHopsLine,
|
||||
bool? showCompressionIndicator,
|
||||
Object? mapCacheBounds = _unset,
|
||||
int? mapCacheMinZoom,
|
||||
int? mapCacheMaxZoom,
|
||||
@@ -764,6 +770,8 @@ class AppSettings {
|
||||
mapClusterNodes: mapClusterNodes ?? this.mapClusterNodes,
|
||||
enableMessageTracing: enableMessageTracing ?? this.enableMessageTracing,
|
||||
regionOnHopsLine: regionOnHopsLine ?? this.regionOnHopsLine,
|
||||
showCompressionIndicator:
|
||||
showCompressionIndicator ?? this.showCompressionIndicator,
|
||||
mapCacheBounds: mapCacheBounds == _unset
|
||||
? this.mapCacheBounds
|
||||
: mapCacheBounds as Map<String, double>?,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import '../connector/meshcore_protocol.dart';
|
||||
import '../helpers/reaction_helper.dart';
|
||||
import '../helpers/smaz.dart';
|
||||
@@ -44,6 +45,7 @@ class ChannelMessage {
|
||||
final DateTime receivedAt;
|
||||
final bool isOutgoing;
|
||||
final bool isBookmarked;
|
||||
final bool isSmazCompressed;
|
||||
final ChannelMessageStatus status;
|
||||
final List<Repeat> repeats;
|
||||
final int repeatCount;
|
||||
@@ -79,6 +81,7 @@ class ChannelMessage {
|
||||
DateTime? receivedAt,
|
||||
required this.isOutgoing,
|
||||
this.isBookmarked = false,
|
||||
this.isSmazCompressed = false,
|
||||
this.status = ChannelMessageStatus.pending,
|
||||
this.repeats = const [],
|
||||
this.repeatCount = 0,
|
||||
@@ -120,6 +123,7 @@ class ChannelMessage {
|
||||
ChannelMessage copyWith({
|
||||
ChannelMessageStatus? status,
|
||||
bool? isBookmarked,
|
||||
bool? isSmazCompressed,
|
||||
List<Repeat>? repeats,
|
||||
int? repeatCount,
|
||||
int? pathLength,
|
||||
@@ -163,6 +167,7 @@ class ChannelMessage {
|
||||
receivedAt: receivedAt,
|
||||
isOutgoing: isOutgoing,
|
||||
isBookmarked: isBookmarked ?? this.isBookmarked,
|
||||
isSmazCompressed: isSmazCompressed ?? this.isSmazCompressed,
|
||||
status: status ?? this.status,
|
||||
repeats: repeats ?? this.repeats,
|
||||
repeatCount: repeatCount ?? this.repeatCount,
|
||||
@@ -252,7 +257,8 @@ class ChannelMessage {
|
||||
}
|
||||
}
|
||||
|
||||
final decodedText = Smaz.tryDecodePrefixed(actualText) ?? actualText;
|
||||
final smazDecoded = Smaz.tryDecodePrefixed(actualText);
|
||||
final decodedText = smazDecoded ?? actualText;
|
||||
|
||||
return ChannelMessage(
|
||||
senderKey: null,
|
||||
@@ -261,6 +267,7 @@ class ChannelMessage {
|
||||
timestamp: DateTime.fromMillisecondsSinceEpoch(timestampRaw * 1000),
|
||||
receivedAt: DateTime.now(),
|
||||
isOutgoing: false,
|
||||
isSmazCompressed: smazDecoded != null,
|
||||
status: ChannelMessageStatus.sent,
|
||||
pathLength: pathLen,
|
||||
pathHashWidth: packetPathHashWidth,
|
||||
@@ -283,6 +290,7 @@ class ChannelMessage {
|
||||
String? translationModelId,
|
||||
String? region,
|
||||
ChannelMessage? replyTo,
|
||||
bool isSmazCompressed = false,
|
||||
}) {
|
||||
return ChannelMessage(
|
||||
senderKey: null,
|
||||
@@ -296,6 +304,7 @@ class ChannelMessage {
|
||||
replyToText: replyTo?.text,
|
||||
timestamp: DateTime.now(),
|
||||
isOutgoing: true,
|
||||
isSmazCompressed: isSmazCompressed,
|
||||
status: ChannelMessageStatus.pending,
|
||||
pathLength: null,
|
||||
pathBytes: Uint8List(0),
|
||||
|
||||
+12
-1
@@ -1,6 +1,8 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import '../connector/meshcore_protocol.dart';
|
||||
import '../helpers/reaction_helper.dart';
|
||||
import '../helpers/smaz.dart';
|
||||
import 'translation_support.dart';
|
||||
|
||||
enum MessageStatus { pending, sent, delivered, failed }
|
||||
@@ -36,6 +38,7 @@ class Message {
|
||||
final bool isOutgoing;
|
||||
final bool isBookmarked;
|
||||
final bool isCli;
|
||||
final bool isSmazCompressed;
|
||||
final MessageStatus status;
|
||||
final String? originalText;
|
||||
final String? translatedText;
|
||||
@@ -65,6 +68,7 @@ class Message {
|
||||
required this.isOutgoing,
|
||||
this.isBookmarked = false,
|
||||
this.isCli = false,
|
||||
this.isSmazCompressed = false,
|
||||
this.status = MessageStatus.pending,
|
||||
String? messageId,
|
||||
this.originalText,
|
||||
@@ -110,6 +114,7 @@ class Message {
|
||||
int? pathLength,
|
||||
Uint8List? pathBytes,
|
||||
bool? isCli,
|
||||
bool? isSmazCompressed,
|
||||
bool? isBookmarked,
|
||||
Object? originalText = _unset,
|
||||
Object? translatedText = _unset,
|
||||
@@ -128,6 +133,7 @@ class Message {
|
||||
isOutgoing: isOutgoing,
|
||||
isBookmarked: isBookmarked ?? this.isBookmarked,
|
||||
isCli: isCli ?? this.isCli,
|
||||
isSmazCompressed: isSmazCompressed ?? this.isSmazCompressed,
|
||||
status: status ?? this.status,
|
||||
messageId: messageId,
|
||||
originalText: originalText == _unset
|
||||
@@ -173,7 +179,9 @@ class Message {
|
||||
if ((flags >> 2) != txtTypePlain) {
|
||||
return null;
|
||||
}
|
||||
final text = reader.readCString();
|
||||
final rawText = reader.readCString();
|
||||
final smazDecoded = Smaz.tryDecodePrefixed(rawText);
|
||||
final text = smazDecoded ?? rawText;
|
||||
|
||||
return Message(
|
||||
senderKey: senderKey,
|
||||
@@ -182,6 +190,7 @@ class Message {
|
||||
receivedAt: DateTime.now(),
|
||||
isOutgoing: false,
|
||||
isCli: false,
|
||||
isSmazCompressed: smazDecoded != null,
|
||||
status: MessageStatus.delivered,
|
||||
pathBytes: Uint8List(0),
|
||||
);
|
||||
@@ -198,6 +207,7 @@ class Message {
|
||||
String? translationModelId,
|
||||
int? pathLength,
|
||||
Uint8List? pathBytes,
|
||||
bool isSmazCompressed = false,
|
||||
}) {
|
||||
return Message(
|
||||
senderKey: recipientKey,
|
||||
@@ -208,6 +218,7 @@ class Message {
|
||||
timestamp: DateTime.now(),
|
||||
isOutgoing: true,
|
||||
isCli: false,
|
||||
isSmazCompressed: isSmazCompressed,
|
||||
status: MessageStatus.pending,
|
||||
pathLength: pathLength,
|
||||
pathBytes: pathBytes,
|
||||
|
||||
@@ -488,6 +488,20 @@ class AppSettingsScreen extends StatelessWidget {
|
||||
value: settingsService.settings.regionOnHopsLine,
|
||||
onChanged: settingsService.setRegionOnHopsLine,
|
||||
),
|
||||
const Divider(height: 1, indent: 16),
|
||||
SwitchListTile(
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 4,
|
||||
),
|
||||
secondary: const Icon(Icons.compress, size: 24),
|
||||
title: Text(context.l10n.appSettings_showCompressionIndicator),
|
||||
subtitle: Text(
|
||||
context.l10n.appSettings_showCompressionIndicatorSubtitle,
|
||||
),
|
||||
value: settingsService.settings.showCompressionIndicator,
|
||||
onChanged: settingsService.setShowCompressionIndicator,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1109,6 +1109,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
final publicIpfsGateway = settingsService.settings.publicIpfsGateway;
|
||||
final enableTracing = settingsService.settings.enableMessageTracing;
|
||||
final regionOnHopsLine = settingsService.settings.regionOnHopsLine;
|
||||
final showCompressionIndicator =
|
||||
settingsService.settings.showCompressionIndicator;
|
||||
final isOutgoing = message.isOutgoing;
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final gifId = GifHelper.parseGif(message.text);
|
||||
@@ -1423,8 +1425,10 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
bottom: 4,
|
||||
)
|
||||
: EdgeInsets.zero,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
child: Wrap(
|
||||
spacing: 4,
|
||||
runSpacing: 2,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
formatChatTime(context, message.timestamp),
|
||||
@@ -1433,20 +1437,23 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
color: metaColor,
|
||||
),
|
||||
),
|
||||
if (message.hasFutureTimestamp) ...[
|
||||
const SizedBox(width: 4),
|
||||
if (message.hasFutureTimestamp)
|
||||
FutureTimestampIndicator(size: 16 * textScale),
|
||||
],
|
||||
if (showCompressionIndicator &&
|
||||
message.isSmazCompressed)
|
||||
CompressionIndicator(
|
||||
size: 14 * textScale,
|
||||
color: metaColor,
|
||||
),
|
||||
if (enableTracing &&
|
||||
!isOutgoing &&
|
||||
message.repeatCount > 0) ...[
|
||||
const SizedBox(width: 6),
|
||||
const SizedBox(width: 2),
|
||||
Icon(
|
||||
Icons.repeat,
|
||||
size: 14 * textScale,
|
||||
color: metaColor,
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
'${message.repeatCount}',
|
||||
style: MeshTheme.mono(
|
||||
@@ -1455,8 +1462,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
),
|
||||
),
|
||||
],
|
||||
if (isOutgoing) ...[
|
||||
const SizedBox(width: 4),
|
||||
if (isOutgoing)
|
||||
MessageStatusIcon(
|
||||
size: 16 * textScale,
|
||||
isAcked: false,
|
||||
@@ -1476,7 +1482,6 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
ChannelMessageStatus.failed,
|
||||
onColor: metaColor,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1574,6 +1574,8 @@ class _MessageBubble extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final settingsService = context.watch<AppSettingsService>();
|
||||
final enableTracing = settingsService.settings.enableMessageTracing;
|
||||
final showCompressionIndicator =
|
||||
settingsService.settings.showCompressionIndicator;
|
||||
final isOutgoing = message.isOutgoing;
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final gifId = GifHelper.parseGif(message.text);
|
||||
@@ -1838,6 +1840,12 @@ class _MessageBubble extends StatelessWidget {
|
||||
FutureTimestampIndicator(
|
||||
size: 16 * textScale,
|
||||
),
|
||||
if (showCompressionIndicator &&
|
||||
message.isSmazCompressed)
|
||||
CompressionIndicator(
|
||||
size: 14 * textScale,
|
||||
color: metaColor,
|
||||
),
|
||||
if (isOutgoing) ...[
|
||||
const SizedBox(width: 2),
|
||||
MessageStatusIcon(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../models/app_settings.dart';
|
||||
import '../models/custom_theme.dart';
|
||||
import '../models/holiday_schedule.dart';
|
||||
@@ -135,6 +137,10 @@ class AppSettingsService extends ChangeNotifier {
|
||||
await updateSettings(_settings.copyWith(regionOnHopsLine: value));
|
||||
}
|
||||
|
||||
Future<void> setShowCompressionIndicator(bool value) async {
|
||||
await updateSettings(_settings.copyWith(showCompressionIndicator: value));
|
||||
}
|
||||
|
||||
Future<void> setMapCacheBounds(Map<String, double>? value) async {
|
||||
await updateSettings(_settings.copyWith(mapCacheBounds: value));
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
|
||||
import '../connector/meshcore_protocol.dart';
|
||||
import '../models/contact.dart';
|
||||
import '../models/message.dart';
|
||||
@@ -169,6 +171,7 @@ class MessageRetryService extends ChangeNotifier {
|
||||
String? translationModelId,
|
||||
Uint8List? pathBytes,
|
||||
int? pathLength,
|
||||
bool isSmazCompressed = false,
|
||||
}) async {
|
||||
final messageId = const Uuid().v4();
|
||||
final resolved = resolvePathSelection(contact);
|
||||
@@ -184,6 +187,7 @@ class MessageRetryService extends ChangeNotifier {
|
||||
translationModelId: translationModelId,
|
||||
timestamp: DateTime.now(),
|
||||
isOutgoing: true,
|
||||
isSmazCompressed: isSmazCompressed,
|
||||
status: MessageStatus.pending,
|
||||
messageId: messageId,
|
||||
retryCount: 0,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:meshcore_open/utils/app_logger.dart';
|
||||
|
||||
import '../models/channel_message.dart';
|
||||
@@ -160,6 +161,7 @@ class ChannelMessageStore {
|
||||
'receivedAt': msg.receivedAt.millisecondsSinceEpoch,
|
||||
'isOutgoing': msg.isOutgoing,
|
||||
'isBookmarked': msg.isBookmarked,
|
||||
'isSmazCompressed': msg.isSmazCompressed,
|
||||
'status': msg.status.index,
|
||||
'channelIndex': msg.channelIndex,
|
||||
'region': msg.region,
|
||||
@@ -186,9 +188,12 @@ class ChannelMessageStore {
|
||||
/// Convert JSON map to ChannelMessage
|
||||
ChannelMessage _messageFromJson(Map<String, dynamic> json) {
|
||||
final rawText = json['text'] as String;
|
||||
final decodedText = json['plainText'] == true
|
||||
? rawText
|
||||
: (Smaz.tryDecodePrefixed(rawText) ?? rawText);
|
||||
final smazDecoded = json['plainText'] == true
|
||||
? null
|
||||
: Smaz.tryDecodePrefixed(rawText);
|
||||
final decodedText = smazDecoded ?? rawText;
|
||||
final isSmazCompressed =
|
||||
json['isSmazCompressed'] as bool? ?? (smazDecoded != null);
|
||||
|
||||
final rawPathLength = json['pathLength'] as int?;
|
||||
final rawPathBytes = json['pathBytes'] != null
|
||||
@@ -238,6 +243,7 @@ class ChannelMessageStore {
|
||||
receivedAt: legacyAwareReceivedAt(json),
|
||||
isOutgoing: json['isOutgoing'] as bool? ?? false,
|
||||
isBookmarked: json['isBookmarked'] as bool? ?? false,
|
||||
isSmazCompressed: isSmazCompressed,
|
||||
status: _statusAt(json['status']) ?? ChannelMessageStatus.failed,
|
||||
repeatCount: (json['repeatCount'] as int?) ?? 0,
|
||||
pathLength: decodedPathLength,
|
||||
|
||||
@@ -202,6 +202,7 @@ class MessageStore {
|
||||
'isOutgoing': msg.isOutgoing,
|
||||
'isBookmarked': msg.isBookmarked,
|
||||
'isCli': msg.isCli,
|
||||
'isSmazCompressed': msg.isSmazCompressed,
|
||||
'status': msg.status.index,
|
||||
'messageId': msg.messageId,
|
||||
'originalText': msg.originalText,
|
||||
@@ -233,9 +234,12 @@ class MessageStore {
|
||||
Message _messageFromJson(Map<String, dynamic> json) {
|
||||
final rawText = json['text'] as String;
|
||||
final isCli = json['isCli'] as bool? ?? false;
|
||||
final decodedText = isCli || json['plainText'] == true
|
||||
? rawText
|
||||
: (Smaz.tryDecodePrefixed(rawText) ?? rawText);
|
||||
final smazDecoded = (isCli || json['plainText'] == true)
|
||||
? null
|
||||
: Smaz.tryDecodePrefixed(rawText);
|
||||
final decodedText = smazDecoded ?? rawText;
|
||||
final isSmazCompressed =
|
||||
json['isSmazCompressed'] as bool? ?? (smazDecoded != null);
|
||||
|
||||
final rawPathLength = json['pathLength'] as int?;
|
||||
final rawPathBytes = json['pathBytes'] != null
|
||||
@@ -273,6 +277,7 @@ class MessageStore {
|
||||
isOutgoing: json['isOutgoing'] as bool? ?? false,
|
||||
isBookmarked: json['isBookmarked'] as bool? ?? false,
|
||||
isCli: isCli,
|
||||
isSmazCompressed: isSmazCompressed,
|
||||
status: _statusAt(json['status']) ?? MessageStatus.failed,
|
||||
messageId: json['messageId'] as String?,
|
||||
originalText: json['originalText'] as String?,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../l10n/l10n.dart';
|
||||
import '../theme/mesh_theme.dart';
|
||||
|
||||
/// Colours shared by the direct-message and channel chat bubbles.
|
||||
@@ -149,3 +150,25 @@ class MessageBubbleFrame extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Subtle indicator shown in a message bubble's metadata row when SMAZ
|
||||
/// compression was applied to the message.
|
||||
class CompressionIndicator extends StatelessWidget {
|
||||
final double size;
|
||||
final Color color;
|
||||
|
||||
const CompressionIndicator({super.key, this.size = 14, required this.color});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final label = context.l10n.messageMeta_smazCompressed;
|
||||
return Tooltip(
|
||||
message: label,
|
||||
triggerMode: TooltipTriggerMode.tap,
|
||||
child: Semantics(
|
||||
label: label,
|
||||
child: Icon(Icons.compress, size: size, color: color),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user