update to zjs81/dev commit d5f54df

This commit is contained in:
ericz committed 2026-09-21 16:11:40 +02:00
commit cf027c974f
64 files changed
+2972 -1129

No files matched your search

+1 -1
View File
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
+2 -2
View File
@@ -19,8 +19,8 @@ pluginManagement {
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.9.1" apply false
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
id("com.android.application") version "8.11.1" apply false
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
}
include(":app")
+28 -11
View File
@@ -1,6 +1,6 @@
# Privacy Policy for MeshCore Open
**Last Updated:** January 11, 2026
**Last Updated:** August 23, 2026
## Introduction
@@ -11,16 +11,17 @@ MeshCore Open ("the App") is an open-source Flutter application for communicatin
### Data We Do NOT Collect
MeshCore Open does **not**:
- Collect personal information
- Send data to external servers (except map tile requests)
- Collect personal information for the developer
- Track your usage or behavior
- Use analytics services
- Require account creation
- Share any data with third parties
- Sell personal information
The App does make limited requests to third-party services when you use features that require internet access, as described below.
### Data Stored Locally on Your Device
The App stores the following data **locally on your device only**:
The App stores the following data **locally on your device**:
- **Messages**: Chat messages sent and received through the mesh network
- **Contacts**: Names and identifiers of mesh network contacts
@@ -30,7 +31,7 @@ The App stores the following data **locally on your device only**:
- **Debug Logs**: Optional BLE and app debug logs (if enabled by user)
- **Cached Map Tiles**: Offline map data for the mapping feature
All locally stored data remains on your device and is never transmitted to us or any third party.
This locally stored data is not transmitted to the MeshCore Open developer. Some features may send specific data to third-party services as described in the Third-Party Services section.
## Permissions
@@ -45,12 +46,12 @@ These permissions are used solely to discover and communicate with MeshCore hard
### Location Permission
- **ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION**
Required by Android for BLE scanning on Android 11 and below. The App does not track or store your location. Location data may be optionally shared over the mesh network if you choose to enable location sharing features.
Required by Android for BLE scanning on Android 11 and below. MeshCore Open does not use the phone's GPS to determine your location. Location data shown in the App comes from MeshCore devices and mesh advertisements. Location data may also be optionally shared over the mesh network if you choose to enable location sharing features.
### Internet Permission
- **INTERNET**
Used only for downloading map tiles from OpenStreetMap tile servers when using the map feature. No personal data is transmitted.
Used for features that access third-party internet services, including map tiles, Line-of-Sight elevation lookups, optional model downloads, and optional GIF search.
### Notification Permission
- **POST_NOTIFICATIONS** (Android 13+)
@@ -65,7 +66,23 @@ Used to maintain BLE connection with your MeshCore device while the app is in th
## Third-Party Services
### Map Tiles
The App uses OpenStreetMap tile servers to display maps. When viewing maps, your device's IP address may be visible to the tile server. No other data is shared. See [OpenStreetMap's Privacy Policy](https://wiki.osmfoundation.org/wiki/Privacy_Policy) for more information.
The App uses OpenStreetMap and, when selected in settings, Stadia Maps tile servers to display maps. Map tile requests include tile coordinates that identify the geographic area being viewed, and your device's IP address may be visible to the tile provider.
See [OpenStreetMap's Privacy Policy](https://wiki.osmfoundation.org/wiki/Privacy_Policy) and [Stadia Maps' Privacy Policy](https://stadiamaps.com/privacy/) for more information.
### Line-of-Sight Elevation Lookups (Open-Meteo)
When you use the Line-of-Sight (LOS) analysis feature, the App sends latitude and longitude coordinates for points along the selected radio path to the Open-Meteo Elevation API. These coordinates come from MeshCore node positions or locations selected in the map, not from the phone's GPS.
Open-Meteo uses these coordinates to return terrain elevation data needed for the LOS calculation. The request also exposes your device's IP address to Open-Meteo as part of normal internet communication.
LOS elevation lookups are only made when the LOS feature is used. See [Open-Meteo's Terms and Privacy information](https://open-meteo.com/en/terms) for more information.
### Model Downloads (Hugging Face)
The App can download optional translation models and the optional neural image-codec model bundle from Hugging Face when you choose to install or update those models in Settings.
When a model download is requested, the App sends standard HTTP requests for the selected model files to `huggingface.co`. Your device's IP address is visible to Hugging Face as part of normal internet communication. The App does not upload your messages, contacts, mesh location data, or other locally stored content to Hugging Face as part of these model downloads.
Model-download requests are only made when you choose to download or update a model. See [Hugging Face's Privacy Policy](https://huggingface.co/privacy) for more information.
### GIF Search (Giphy)
The App includes a GIF picker feature powered by Giphy. When you use the GIF search feature:
@@ -81,7 +98,7 @@ Messages sent through the MeshCore mesh network are transmitted over radio frequ
## Data Security
All data is stored locally on your device using standard Flutter/Android storage mechanisms. The App does not implement additional encryption for locally stored data beyond what the operating system provides.
All data stored locally on your device uses standard Flutter/Android storage mechanisms. The App does not implement additional encryption for locally stored data beyond what the operating system provides.
## Children's Privacy
@@ -101,4 +118,4 @@ If you have questions about this Privacy Policy or the App's privacy practices,
---
**Summary**: MeshCore Open is a privacy-respecting app that stores all data locally on your device. We do not collect, track, or share your personal information.
**Summary**: MeshCore Open does not use the phone's GPS for location, does not include analytics, and does not collect personal information for the developer. Some optional features communicate with third-party services, including map tile providers, Open-Meteo for LOS elevation lookups, Hugging Face for model downloads, and Giphy for GIF search.
+137 -47
View File
@@ -375,12 +375,14 @@ class MeshCoreConnector extends ChangeNotifier {
List<Channel> _cachedChannels = [];
final Map<int, bool> _channelSmazEnabled = {};
final Map<int, bool> _channelCyr2LatEnabled = {};
final Map<int, bool> _channelUrlImagesEnabled = {};
final Map<int, String?> _channelCyr2LatProfileId = {};
final Map<int, Region> _channelRegions = {};
bool _lastSentWasCliCommand =
false; // Track if last sent message was a CLI command
final Map<String, bool> _contactSmazEnabled = {};
final Map<String, bool> _contactCyr2LatEnabled = {};
final Map<String, bool> _contactUrlImagesEnabled = {};
final Map<String, String?> _contactCyr2LatProfileId = {};
final Set<String> _knownContactKeys = {};
final Map<String, int> _contactUnreadCount = {};
@@ -454,6 +456,13 @@ class MeshCoreConnector extends ChangeNotifier {
);
}
Contact? getContactByPubKeyHex(String contactPubKeyHex) {
return _contacts.cast<Contact?>().firstWhere(
(c) => c?.publicKeyHex == contactPubKeyHex,
orElse: () => null,
);
}
List<Contact> get allContacts => List.unmodifiable([
..._contacts,
..._discoveredContacts.where(
@@ -802,6 +811,15 @@ class MeshCoreConnector extends ChangeNotifier {
return _contactSmazEnabled[contactKeyHex] ?? false;
}
bool isChannelUrlImagesEnabled(int channelIndex) {
return _channelUrlImagesEnabled[channelIndex] ?? false;
}
bool isContactUrlImagesEnabled(String contactKeyHex) {
_ensureContactUrlImagesSettingLoaded(contactKeyHex);
return _contactUrlImagesEnabled[contactKeyHex] ?? false;
}
bool hasChannelRegion(int channelIndex) {
return (_channelRegions[channelIndex] ?? '').isNotEmpty;
}
@@ -944,6 +962,24 @@ class MeshCoreConnector extends ChangeNotifier {
notifyListeners();
}
Future<void> setChannelUrlImagesEnabled(
int channelIndex,
bool enabled,
) async {
_channelUrlImagesEnabled[channelIndex] = enabled;
await _channelSettingsStore.saveUrlImagesEnabled(channelIndex, enabled);
notifyListeners();
}
Future<void> setContactUrlImagesEnabled(
String contactKeyHex,
bool enabled,
) async {
_contactUrlImagesEnabled[contactKeyHex] = enabled;
await _contactSettingsStore.saveUrlImagesEnabled(contactKeyHex, enabled);
notifyListeners();
}
Future<void> setChannelCyr2LatEnabled(int channelIndex, bool enabled) async {
_channelCyr2LatEnabled[channelIndex] = enabled;
if (enabled) {
@@ -1114,6 +1150,7 @@ class MeshCoreConnector extends ChangeNotifier {
}
Future<void> loadContactCache() async {
_contactUrlImagesEnabled.clear();
final cached = await _contactStore.loadContacts();
_knownContactKeys
..clear()
@@ -1124,6 +1161,7 @@ class MeshCoreConnector extends ChangeNotifier {
for (final contact in cached) {
_ensureContactSmazSettingLoaded(contact.publicKeyHex);
_ensureContactCyr2LatSettingLoaded(contact.publicKeyHex);
_ensureContactUrlImagesSettingLoaded(contact.publicKeyHex);
}
}
@@ -1144,12 +1182,15 @@ class MeshCoreConnector extends ChangeNotifier {
Future<void> loadChannelSettings({int? maxChannels}) async {
_channelSmazEnabled.clear();
_channelCyr2LatEnabled.clear();
_channelUrlImagesEnabled.clear();
_channelRegions.clear();
final channelCount = maxChannels ?? _maxChannels;
for (int i = 0; i < channelCount; i++) {
_channelSmazEnabled[i] = await _channelSettingsStore.loadSmazEnabled(i);
_channelCyr2LatEnabled[i] = await _channelSettingsStore
.loadCyr2LatEnabled(i);
_channelUrlImagesEnabled[i] = await _channelSettingsStore
.loadUrlImagesEnabled(i);
_channelRegions[i] = await _channelRegionStore.loadRegion(i);
}
}
@@ -3170,9 +3211,15 @@ class MeshCoreConnector extends ChangeNotifier {
// Check if this is a reaction - apply locally with pending status and route through retry service
final reactionInfo = ReactionHelper.parseReaction(text);
if (reactionInfo != null) {
appLogger.info('Sending reaction: ${reactionInfo.identifier()}');
_conversations.putIfAbsent(contact.publicKeyHex, () => []);
final messages = _conversations[contact.publicKeyHex]!;
// No check for duplicates. If you want to do it again to resend, you can.
final String reactionID = reactionInfo.identifier();
_processedContactReactions.putIfAbsent(contact.publicKeyHex, () => {});
_processedContactReactions[contact.publicKeyHex]!.add(reactionID);
// Apply reaction locally with pending status
_processOutgoingContactReaction(messages, reactionInfo, contact);
_setReactionStatus(
@@ -3214,7 +3261,7 @@ class MeshCoreConnector extends ChangeNotifier {
translatedLanguageCode: translatedLanguageCode,
translationModelId: translationModelId,
);
_addMessage(contact.publicKeyHex, message);
_addMessage(contact.publicKeyHex, message); // recipient as "sender"
notifyListeners();
final outboundText = prepareContactOutboundText(contact, text);
await sendFrame(buildSendTextMsgFrame(contact.publicKey, outboundText));
@@ -3551,11 +3598,12 @@ class MeshCoreConnector extends ChangeNotifier {
// Check if this is a reaction - if so, process it immediately instead of adding as a message
final reactionInfo = ReactionHelper.parseReaction(text);
if (reactionInfo != null) {
reactionInfo.senderName = selfName;
// Check if we've already processed this reaction
_processedChannelReactions.putIfAbsent(channel.index, () => {});
final reactionIdentifier =
'${reactionInfo.targetHash}_${reactionInfo.emoji}';
final reactionIdentifier = reactionInfo.identifier();
// Maybe we should allow resending. Recipients can drop duplicates.
if (_processedChannelReactions[channel.index]!.contains(
reactionIdentifier,
)) {
@@ -3568,27 +3616,32 @@ class MeshCoreConnector extends ChangeNotifier {
final messages = _channelMessages[channel.index]!;
// Process reaction locally to update the UI immediately
_processReaction(messages, reactionInfo);
await _channelMessageStore.saveChannelMessages(channel.index, messages);
appLogger.info('Adding sent channel reaction, id: $reactionIdentifier');
final reactionApplied = _processReaction(messages, reactionInfo);
if (reactionApplied) {
await _channelMessageStore.saveChannelMessages(channel.index, messages);
// Mark this reaction as processed
_processedChannelReactions[channel.index]!.add(reactionIdentifier);
// Mark this reaction as processed
_processedChannelReactions[channel.index]!.add(reactionIdentifier);
notifyListeners();
notifyListeners();
// Send the reaction to the device (don't add as a visible message)
final reactionQueueId = _nextReactionSendQueueId();
_pendingChannelSentQueue.add(reactionQueueId);
await _runScopedChannelSend(() async {
await _waitForRadioQuiet(lastInboundRxTime: _lastChannelMsgRxTime);
await _sendFrameAndWaitForCommandAck(
buildSendChannelTextMsgFrame(channel.index, text),
channelSendQueueId: reactionQueueId,
expectsGenericAck: true,
successCode: respCodeSent,
);
}, region: getChannelRegion(channel.index));
return;
// Send the reaction to the device (don't add as a visible message)
final reactionQueueId = _nextReactionSendQueueId();
_pendingChannelSentQueue.add(reactionQueueId);
await _runScopedChannelSend(() async {
await _waitForRadioQuiet(lastInboundRxTime: _lastChannelMsgRxTime);
await _sendFrameAndWaitForCommandAck(
buildSendChannelTextMsgFrame(channel.index, text),
channelSendQueueId: reactionQueueId,
expectsGenericAck: true,
successCode: respCodeSent,
);
}, region: getChannelRegion(channel.index));
return;
}
// It looks like a reaction, but we did not find its target, so
// we continue to process it normally.
}
final message = ChannelMessage.outgoing(
@@ -5334,6 +5387,8 @@ class MeshCoreConnector extends ChangeNotifier {
await _notificationService.showMessageNotification(
contactName: c?.name ?? 'Unknown',
message: resolvedText,
urlImagesEnabled:
c != null && isContactUrlImagesEnabled(c.publicKeyHex),
contactId: msg.senderKeyHex,
badgeCount: getTotalUnreadCount(),
);
@@ -5348,6 +5403,8 @@ class MeshCoreConnector extends ChangeNotifier {
await _notificationService.showMessageNotification(
contactName: c?.name ?? 'Unknown Room',
message: resolvedText,
urlImagesEnabled:
c != null && isContactUrlImagesEnabled(c.publicKeyHex),
contactId: msg.senderKeyHex,
badgeCount: getTotalUnreadCount(),
);
@@ -5498,6 +5555,15 @@ class MeshCoreConnector extends ChangeNotifier {
});
}
void _ensureContactUrlImagesSettingLoaded(String contactKeyHex) {
if (_contactUrlImagesEnabled.containsKey(contactKeyHex)) return;
_contactSettingsStore.loadUrlImagesEnabled(contactKeyHex).then((enabled) {
if (_contactUrlImagesEnabled[contactKeyHex] == enabled) return;
_contactUrlImagesEnabled[contactKeyHex] = enabled;
notifyListeners();
});
}
void _ensureContactCyr2LatProfileLoaded(String contactKeyHex) {
if (_contactCyr2LatProfileId.containsKey(contactKeyHex)) return;
_contactSettingsStore.loadCyr2LatProfileId(contactKeyHex).then((profileId) {
@@ -5652,6 +5718,7 @@ class MeshCoreConnector extends ChangeNotifier {
channelName: label,
senderName: message.senderName,
message: resolvedText,
urlImagesEnabled: isChannelUrlImagesEnabled(channelIndex),
channelIndex: message.channelIndex,
badgeCount: getTotalUnreadCount(),
);
@@ -6227,24 +6294,44 @@ class MeshCoreConnector extends ChangeNotifier {
if (reactionInfo != null) {
// Check if we've already processed this exact reaction
_processedContactReactions.putIfAbsent(pubKeyHex, () => {});
final reactionIdentifier =
'${reactionInfo.targetHash}_${reactionInfo.emoji}';
reactionInfo.senderName = _resolveContactSenderName(message, null, false);
final reactionIdentifier = reactionInfo.identifier();
final isDuplicate = _processedContactReactions[pubKeyHex]!.contains(
reactionIdentifier,
);
if (isDuplicate) return;
if (!isDuplicate) {
// New reaction - process it
_processContactReaction(messages, reactionInfo, pubKeyHex);
// New reaction - process it
// For hashing and dup checking, we use null for sender names in
// normal 1:1 chats. This way if we and they have different ideas
// about what their name is, reactions still work. But for reaction
// reports, we want to know who sent what, rather than infer it later,
// so we'll add it to the reactionInfo before storing it.
reactionInfo.senderName ??= message.isOutgoing
? selfName
: getContactByPubKeyHex(pubKeyHex)?.name ?? '???';
final reactionApplied = _processContactReaction(
messages,
reactionInfo,
pubKeyHex,
);
if (reactionApplied) {
appLogger.info('Adding reaction, id: $reactionIdentifier');
_messageStore.saveMessages(pubKeyHex, messages);
// Mark as processed
_processedContactReactions[pubKeyHex]!.add(reactionIdentifier);
notifyListeners();
return; // Don't add reaction as a visible message
}
return; // Don't add reaction as a visible message
// Looks like a reaction, but didn't match any message we have.
// for reactions matching our own format, because those are not very
// informative on their own, but the MC1 format is useful even if
// in raw form, so we'll let those through.
appLogger.info('No match for reaction, id: $reactionIdentifier');
if (reactionInfo.hashType == HashType.ours) return;
}
messages.add(message);
@@ -6255,18 +6342,15 @@ class MeshCoreConnector extends ChangeNotifier {
notifyListeners();
}
void _processContactReaction(
bool _processContactReaction(
List<Message> messages,
ReactionInfo reactionInfo,
String contactPubKeyHex,
) {
final contact = _contacts.cast<Contact?>().firstWhere(
(c) => c?.publicKeyHex == contactPubKeyHex,
orElse: () => null,
);
final contact = getContactByPubKeyHex(contactPubKeyHex);
final isRoomServer = contact?.type == advTypeRoom;
ReactionHelper.applyReaction<Message>(
return ReactionHelper.applyReaction<Message>(
messages: messages,
reactionInfo: reactionInfo,
// Incoming reactions in 1:1: match against outgoing messages only
@@ -6312,10 +6396,7 @@ class MeshCoreConnector extends ChangeNotifier {
) {
final messages = _conversations[pubKeyHex];
if (messages == null) return;
final contact = _contacts.cast<Contact?>().firstWhere(
(c) => c?.publicKeyHex == pubKeyHex,
orElse: () => null,
);
final contact = getContactByPubKeyHex(pubKeyHex);
final isRoomServer = contact?.type == advTypeRoom;
for (int i = messages.length - 1; i >= 0; i--) {
final msg = messages[i];
@@ -6474,27 +6555,36 @@ class MeshCoreConnector extends ChangeNotifier {
final messages = _channelMessages[channelIndex]!;
// Parse reaction info
final reactionInfo = ChannelMessage.parseReaction(message.text);
final reactionInfo = message.parseReaction();
if (reactionInfo != null) {
// Check if we've already processed this exact reaction
_processedChannelReactions.putIfAbsent(channelIndex, () => {});
final reactionIdentifier =
'${reactionInfo.targetHash}_${reactionInfo.emoji}';
final reactionIdentifier = reactionInfo.identifier();
final isDuplicate = _processedChannelReactions[channelIndex]!.contains(
reactionIdentifier,
);
if (!isDuplicate) {
// New reaction - process it
_processReaction(messages, reactionInfo);
if (isDuplicate) return false;
// New reaction - process it
final reactionApplied = _processReaction(messages, reactionInfo);
if (reactionApplied) {
appLogger.info('Adding channel reaction, id: $reactionIdentifier');
// Save updated messages
_channelMessageStore.saveChannelMessages(channelIndex, messages);
// Mark as processed
_processedChannelReactions[channelIndex]!.add(reactionIdentifier);
return false; // Don't add reaction as a visible message
}
return false; // Don't add reaction as a visible message
// Looks like a reaction, but didn't match any message we have.
// Old behavior is to silently drop these. We'll continue doing that
// for reactions matching our own format, because those are not very
// informative on their own, but the MC1 format is useful even if
// in raw form, so we'll let those through.
appLogger.info('No match for reaction, id: $reactionIdentifier');
if (reactionInfo.hashType == HashType.ours) return false;
}
// Parse reply info from message text
@@ -6596,11 +6686,11 @@ class MeshCoreConnector extends ChangeNotifier {
return null;
}
void _processReaction(
bool _processReaction(
List<ChannelMessage> messages,
ReactionInfo reactionInfo,
) {
ReactionHelper.applyReaction<ChannelMessage>(
return ReactionHelper.applyReaction<ChannelMessage>(
messages: messages,
reactionInfo: reactionInfo,
shouldSkip: (_) => false,
+340
View File
@@ -0,0 +1,340 @@
import 'dart:async';
import 'dart:collection';
import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:http/http.dart' as http;
/// Finds and renders image URLs embedded in ordinary text messages.
///
/// This is deliberately separate from MeshCore's transmitted channel-image
/// protocol, which is handled by [ReceivedImageStore].
class MessageUrlImageHelper {
static final Map<String, Future<bool>> _verifiedImageCache =
<String, Future<bool>>{};
static const int _maxMessageImageCacheEntries = 200;
static final LinkedHashMap<String, Future<String?>> _messageImageCache =
LinkedHashMap<String, Future<String?>>();
/// HTTP client used to resolve sharing pages.
///
/// Tests override this because `flutter_test` blocks real network requests.
@visibleForTesting
static http.Client? httpClient;
static final RegExp _pyxPattern = RegExp(
r'''https?://pyx\.li/\?i=([A-Za-z0-9_-]+)''',
caseSensitive: false,
);
static final RegExp _ipfsUrlPattern = RegExp(
r'''https?://[^\s<>'"`]+/(?:ipfs|ipns)/[^\s<>'"`]+''',
caseSensitive: false,
);
static final RegExp _ipfsCidPattern = RegExp(
r'''ipfs:(?://)?([^\s<>'"`]+)''',
caseSensitive: false,
);
static final RegExp _ibbSharePattern = RegExp(
r'''https?://(?:www\.)?ibb\.co/[^\s<>'"`/?#]+(?:[/?#][^\s<>'"`]*)?''',
caseSensitive: false,
);
static final RegExp _imagePattern = RegExp(
r'''https?://[^\s<>'"`]+?\.(?:png|jpe?g|webp)(?:\?[^\s<>'"`]+)?(?:#[^\s<>'"`]+)?''',
caseSensitive: false,
);
/// Checks locally whether [text] contains a URL format this helper supports.
/// This deliberately does not resolve sharing pages or fetch image data.
static bool hasPotentialImageUrl(String text) {
return _pyxPattern.hasMatch(text) ||
_ipfsUrlPattern.hasMatch(text) ||
_ipfsCidPattern.hasMatch(text) ||
_ibbSharePattern.hasMatch(text) ||
_imagePattern.hasMatch(text);
}
static Future<String?> parse(String text) async {
final trimmed = text.trim();
if (trimmed.isEmpty) return null;
final pyxMatch = _pyxPattern.firstMatch(trimmed);
if (pyxMatch != null) {
return 'https://pyx.li/i/${pyxMatch.group(1)!}.jpg';
}
final ipfsUrlMatch = _ipfsUrlPattern.firstMatch(trimmed);
if (ipfsUrlMatch != null) {
return _trimBoundary(ipfsUrlMatch.group(0)!);
}
final ipfsCidMatch = _ipfsCidPattern.firstMatch(trimmed);
if (ipfsCidMatch != null) {
final cid = _trimBoundary(ipfsCidMatch.group(1)!);
return 'https://ipfs.io/ipfs/$cid';
}
final ibbMatch = _ibbSharePattern.firstMatch(trimmed);
if (ibbMatch != null) {
return _extractFromUrl(
_trimBoundary(ibbMatch.group(0)!),
RegExp(
r'''<meta[^>]+property=["']og:image["'][^>]+content=["']([^"']+)["']''',
caseSensitive: false,
),
);
}
final imageMatch = _imagePattern.firstMatch(trimmed);
if (imageMatch != null) {
return _trimBoundary(imageMatch.group(0)!);
}
return null;
}
static Future<String?> parseVerified(String text) async {
final imageUrl = await parse(text);
if (imageUrl == null) return null;
final verified = await _verifyImageUrl(imageUrl);
return verified ? imageUrl : null;
}
/// Caches successful URL-image parsing by stable message identity.
///
/// Null results are evicted so temporary connectivity or host failures can
/// be retried when a message is shown again.
static Future<String?> parseVerifiedForMessage(
String messageId,
String text,
) {
final cached = _messageImageCache.remove(messageId);
if (cached != null) {
_messageImageCache[messageId] = cached;
return cached;
}
final parsing = parseVerified(text);
_messageImageCache[messageId] = parsing;
parsing.then((imageUrl) {
if (imageUrl == null &&
identical(_messageImageCache[messageId], parsing)) {
_messageImageCache.remove(messageId);
} else if (imageUrl != null) {
while (_messageImageCache.length > _maxMessageImageCacheEntries) {
_messageImageCache.remove(_messageImageCache.keys.first);
}
}
});
return parsing;
}
static Future<String?> _extractFromUrl(String pageUrl, RegExp pattern) async {
try {
final uri = Uri.parse(pageUrl);
final client = httpClient;
final response = await (client == null ? http.get(uri) : client.get(uri))
.timeout(const Duration(seconds: 8));
if (response.statusCode < 200 || response.statusCode >= 300) {
return null;
}
final value = pattern.firstMatch(response.body)?.group(1);
if (value == null || value.isEmpty) return null;
final imageUrl = uri.resolve(value.replaceAll('&amp;', '&'));
return imageUrl.scheme == 'http' || imageUrl.scheme == 'https'
? imageUrl.toString()
: null;
} catch (_) {
return null;
}
}
static String _trimBoundary(String value) {
return value.trim().replaceAll(RegExp(r"[.,;:!?]+$"), '');
}
static Future<bool> _verifyImageUrl(String imageUrl) {
final cached = _verifiedImageCache[imageUrl];
if (cached != null) return cached;
final verification = _tryLoadImage(imageUrl);
_verifiedImageCache[imageUrl] = verification;
verification.then((verified) {
if (!verified && identical(_verifiedImageCache[imageUrl], verification)) {
_verifiedImageCache.remove(imageUrl);
}
});
return verification;
}
static Future<bool> _tryLoadImage(String imageUrl) async {
final completer = Completer<bool>();
final stream = CachedNetworkImageProvider(
imageUrl,
).resolve(const ImageConfiguration());
late final ImageStreamListener listener;
listener = ImageStreamListener(
(_, _) {
if (!completer.isCompleted) completer.complete(true);
stream.removeListener(listener);
},
onError: (_, _) {
if (!completer.isCompleted) completer.complete(false);
stream.removeListener(listener);
},
);
stream.addListener(listener);
return completer.future.timeout(
const Duration(seconds: 8),
onTimeout: () {
stream.removeListener(listener);
return false;
},
);
}
}
class MessageUrlImageFutureBuilder extends StatefulWidget {
const MessageUrlImageFutureBuilder({
super.key,
required this.messageId,
required this.text,
required this.builder,
});
final String messageId;
final String text;
final AsyncWidgetBuilder<String?> builder;
@override
State<MessageUrlImageFutureBuilder> createState() =>
_MessageUrlImageFutureBuilderState();
}
class _MessageUrlImageFutureBuilderState
extends State<MessageUrlImageFutureBuilder> {
late Future<String?> _imageFuture;
@override
void initState() {
super.initState();
_imageFuture = MessageUrlImageHelper.parseVerifiedForMessage(
widget.messageId,
widget.text,
);
}
@override
void didUpdateWidget(covariant MessageUrlImageFutureBuilder oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.messageId != widget.messageId) {
_imageFuture = MessageUrlImageHelper.parseVerifiedForMessage(
widget.messageId,
widget.text,
);
}
}
@override
Widget build(BuildContext context) {
return FutureBuilder<String?>(
future: _imageFuture,
builder: widget.builder,
);
}
}
class MessageUrlImagePreview extends StatelessWidget {
const MessageUrlImagePreview({super.key, required this.imageUrl});
final String imageUrl;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (context) => Dialog(
insetPadding: const EdgeInsets.all(12),
backgroundColor: Colors.black,
child: SizedBox(
width: double.infinity,
height: double.infinity,
child: Stack(
children: [
Positioned.fill(
child: InteractiveViewer(
boundaryMargin: const EdgeInsets.all(80),
minScale: 1.0,
maxScale: 3.0,
child: Center(
child: CachedNetworkImage(
imageUrl: imageUrl,
fit: BoxFit.contain,
placeholder: (context, url) => const Center(
child: CircularProgressIndicator(strokeWidth: 2),
),
errorWidget: (context, url, error) => const Center(
child: Icon(
Icons.broken_image,
color: Colors.white,
),
),
),
),
),
),
Positioned(
top: 12,
right: 12,
child: IconButton(
onPressed: () => Navigator.of(context).pop(),
icon: const Icon(Icons.close, color: Colors.white),
style: IconButton.styleFrom(
backgroundColor: Colors.black54,
),
),
),
],
),
),
),
);
},
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child: SizedBox(
width: 240,
height: 240,
child: CachedNetworkImage(
imageUrl: imageUrl,
fit: BoxFit.contain,
placeholder: (context, url) => ColoredBox(
color: Theme.of(context).colorScheme.surfaceContainerHighest,
child: const Center(
child: CircularProgressIndicator(strokeWidth: 2),
),
),
errorWidget: (context, url, error) => Container(
padding: const EdgeInsets.all(12),
color: Theme.of(context).colorScheme.surfaceContainerHighest,
child: Text(
'Unable to load image',
style: Theme.of(context).textTheme.bodySmall,
),
),
),
),
),
);
}
}
+143 -10
View File
@@ -1,10 +1,29 @@
import 'dart:typed_data';
import 'dart:convert';
import 'package:characters/characters.dart';
import 'package:crypto/crypto.dart';
import 'package:base32/base32.dart';
import 'package:base32/encodings.dart';
import '../widgets/emoji_picker.dart';
enum HashType { ours, mc1 }
class ReactionInfo {
final String targetHash;
final String emoji;
HashType hashType;
String? senderName; // Who sent the reaction
ReactionInfo({required this.targetHash, required this.emoji});
ReactionInfo({
required this.targetHash,
required this.emoji,
required this.hashType,
this.senderName,
});
String identifier() {
return '$targetHash:$emoji:$hashType:${senderName ?? ""}';
}
}
class ReactionHelper {
@@ -26,25 +45,34 @@ class ReactionHelper {
required int Function(T) getTimestampSecs,
required String? Function(T) getSenderName,
required String Function(T) getMessageText,
required Map<String, int> Function(T) getReactions,
required Map<String, List<String?>> Function(T) getReactions,
required bool Function(T) shouldSkip,
required void Function(int index, Map<String, int> newReactions)
updateMessage,
}) {
final targetHash = reactionInfo.targetHash;
final hashFunc = switch (reactionInfo.hashType) {
HashType.ours => computeReactionHash,
HashType.mc1 => ((ts, senderName, text) => _concatenateHashAndSender(
computeReactionHashMC1(ts, senderName, text),
senderName,
)),
};
for (int i = messages.length - 1; i >= 0; i--) {
final msg = messages[i];
if (shouldSkip(msg)) continue;
final msgHash = computeReactionHash(
final msgHash = hashFunc(
getTimestampSecs(msg),
getSenderName(msg),
getMessageText(msg),
);
if (msgHash == targetHash) {
final currentReactions = Map<String, int>.from(getReactions(msg));
currentReactions[reactionInfo.emoji] =
(currentReactions[reactionInfo.emoji] ?? 0) + 1;
final currentReactions = Map<String, List<String?>>.from(
getReactions(msg),
);
(currentReactions[reactionInfo.emoji] ??= []).add(
reactionInfo.senderName,
);
updateMessage(i, currentReactions);
return true;
}
@@ -97,17 +125,122 @@ class ReactionHelper {
return hash.toRadixString(16).padLeft(4, '0');
}
// Compute the type of reaction hash used by MeshCoreOne.
static String computeReactionHashMC1(
int timestampSeconds,
String? senderName,
String messageText,
) {
// raw hash is first 5 bytes of SHA-256(UTF-8 text + uint32-LE sender timestamp)
Uint8List messageBytes = utf8.encode(messageText);
ByteData timestampBytes = ByteData(4)
..setUint32(0, timestampSeconds, Endian.little);
final hash = sha256
.convert(messageBytes + timestampBytes.buffer.asUint8List())
.bytes
.sublist(0, 5);
// encode as 8 chars of Crockford base32
return base32
.encode(Uint8List.fromList(hash), encoding: Encoding.crockford)
.toLowerCase();
// Note: Crockford32 defines permissive decoding and allows some
// substitutions (e.g. I, i, l -> 1) but we never decode the hashes, we
// just compare them. If someone sends a miscoded hash that should be
// equivalent, we won't match it and it won't work. But it's not worth
// accommodating, because no one is going to be hand copying hashes.
}
// MeshCoreOne-style reaction hashes don't depend on the sender name,
// and we're expected to check the hash and sender name separately.
// Our own reaction hashes include it. Rather than store the sender
// Name in ReactionInfo and complicate the logic in applyReaction(),
// we just tack the senderName onto the end of the "hash".
static String _concatenateHashAndSender(String hash, String? senderName) {
return "$hash:${senderName ?? ''}";
}
static ReactionInfo? parseReaction(String text) {
return parseReactionOurs(text) ??
parseReactionMC1(text) ??
parseReactionMC1Legacy(text);
}
static bool _looksLikeEmoji(String emoji) {
// Make sure it's a single grapheme.
if (Characters(emoji).length > 1) return false;
// Below are some emoji-validating tests, copied from MeshTrax.
// https://github.com/venamartin/meshtrax/
// It's nice to avoid false positives just to save us some processing,
// but it's not crucial, as we will either apply a reaction or show it
// as a message. Text that is not actually a hash is unlikely to match
// a message.
if (emoji.isEmpty) return false;
// Emoji, not prose: nearly all emoji start at U+2000 or above; the
// exceptions (keycaps, ©/®) carry a variation selector U+FE0F or a
// combining keycap U+20E3. Ordinary ASCII text fails both tests.
if (!(emoji.runes.first >= 0x2000 ||
emoji.runes.any((r) => r == 0xFE0F || r == 0x20E3))) {
return false;
}
return true;
}
static ReactionInfo? parseReactionMC1(String text) {
// See https://github.com/Avi0n/MeshCoreOne/blob/main/docs/Reactions.md
// This regex matches both the channel format, which includes the sender name,
// and the chat (DM) format, which omits it.
final regex = RegExp(r'^(?:@\[(.*)])?(.+?)\n([a-tv-zA-TV-Z0-9]{8})$');
final match = regex.firstMatch(text);
if (match == null) return null;
final senderName = match.group(1);
final emoji = match.group(2)!;
final hash = match.group(3)?.toLowerCase();
if (!_looksLikeEmoji(emoji)) return null;
return ReactionInfo(
targetHash: _concatenateHashAndSender(hash!, senderName),
emoji: emoji,
hashType: HashType.mc1,
);
}
static ReactionInfo? parseReactionMC1Legacy(String text) {
// See https://github.com/Avi0n/MeshCoreOne/blob/main/docs/Reactions.md
// This regex matches both the channel format, which includes the sender name,
// and the chat (DM) format, which omits it.
final regex = RegExp(r'^(.+?)(?:@\[(.*)])?\n([a-tv-zA-TV-Z0-9]{8})$');
final match = regex.firstMatch(text);
if (match == null) return null;
final hash = match.group(3)?.toLowerCase();
final senderName = match.group(2);
final emoji = match.group(1)!;
if (!_looksLikeEmoji(emoji)) return null;
return ReactionInfo(
targetHash: _concatenateHashAndSender(hash!, senderName),
emoji: emoji,
hashType: HashType.mc1,
);
}
/// Parse reaction format: r:HASH:INDEX (where INDEX is 2-char hex emoji index)
/// Returns null if text is not a valid reaction format
static ReactionInfo? parseReaction(String text) {
static ReactionInfo? parseReactionOurs(String text) {
final regex = RegExp(r'^r:([0-9a-f]{4}):([0-9a-f]{2})$');
final match = regex.firstMatch(text);
if (match == null) return null;
final emoji = indexToEmoji(match.group(2)!);
if (emoji == null) return null;
return ReactionInfo(targetHash: match.group(1)!, emoji: emoji);
return ReactionInfo(
targetHash: match.group(1)!,
emoji: emoji,
hashType: HashType.ours,
);
}
/// Encode a reaction message that parseReaction() can parse.
+2 -1
View File
@@ -485,6 +485,7 @@
}
}
},
"chat_selectSendAction": "Изберете действие за изпращане",
"chat_sendGif": "Изпрати GIF",
"chat_reply": "Отговори",
"chat_addReaction": "Добави Реакция",
@@ -2791,7 +2792,7 @@
"channels_regionNotSet": "Регион: ние",
"channels_regionSelect_Title": "Выберете регион",
"channels_clearRegion": "Чиста зона",
"chat_sendImage": "Изпрати изображение",
"chat_sendImageLora": "Изпращане на изображение чрез MeshCore",
"chat_imagePickFailed": "Не мог да откривам та изображин",
"chat_receivedGif": "Получил GIF",
"repeater_keySettings": "Изменяне на идентичности ключа",
+4 -1
View File
@@ -507,6 +507,7 @@
}
}
},
"chat_selectSendAction": "Sendeaktion auswählen",
"chat_sendGif": "GIF senden",
"chat_reply": "Antworten",
"chat_addReaction": "Reaktion hinzufügen",
@@ -2660,6 +2661,8 @@
"messageStatus_pending": "Wird gesendet",
"messageStatus_failed": "Senden fehlgeschlagen",
"messageStatus_repeated": "Mehrfach gehört",
"urlImage_enable": "URL-Bilder anzeigen",
"urlImage_possible": "Mögliches URL-Bild; in den Einstellungen aktivieren.",
"contacts_moreOptions": "Weitere Optionen",
"contacts_searchOpen": "Suche öffnen",
"contacts_searchClose": "Suche schließen",
@@ -2925,7 +2928,7 @@
"repeater_pathHashModeOption2": "2 - 3 Bytes",
"repeater_pathHashModeOption3": "3 - 4 Bytes",
"appSettings_batteryLipoHv": "LiPo HV (3,0–4,35 V)",
"chat_sendImage": "Bild senden",
"chat_sendImageLora": "Bild über MeshCore senden",
"chat_imagePickFailed": "Konnte dieses Bild nicht öffnen.",
"chat_receivedGif": "Erhalten eines GIF",
"repeater_keySettings": "Identitätsschlüssel ändern",
+6 -1
View File
@@ -34,6 +34,8 @@
"messageStatus_pending": "Sending",
"messageStatus_failed": "Failed to send",
"messageStatus_repeated": "Heard repeated",
"urlImage_enable": "Enable URL images",
"urlImage_possible": "Possible URL image; enable it in Settings.",
"common_reboot": "Reboot",
"common_loading": "Loading...",
"common_notAvailable": "—",
@@ -246,6 +248,7 @@
"settings_infoStatus": "Status",
"settings_infoBattery": "Battery",
"settings_infoPublicKey": "Public Key",
"settings_publicKeyCopied": "Public key copied",
"settings_infoContactsCount": "Contacts Count",
"settings_infoChannelCount": "Channel Count",
"settings_infoHardware": "Hardware",
@@ -740,8 +743,9 @@
}
}
},
"chat_selectSendAction": "Select send action",
"chat_sendGif": "Send GIF",
"chat_sendImage": "Send image",
"chat_sendImageLora": "Send image via meshcore",
"chat_imagePickFailed": "Couldn't open that image",
"@chat_imagePickFailed": {
"description": "Shown when picking or reading a photo to send fails"
@@ -750,6 +754,7 @@
"chat_reply": "Reply",
"chat_addReaction": "Add Reaction",
"chat_me": "Me",
"reaction_report": "Emoji Reactions",
"emojiCategorySmileys": "Smileys",
"emojiCategoryGestures": "Gestures",
"emojiCategoryHearts": "Hearts",
+2 -1
View File
@@ -507,6 +507,7 @@
}
}
},
"chat_selectSendAction": "Seleccionar acción de envío",
"chat_sendGif": "Enviar GIF",
"chat_reply": "Responder",
"chat_addReaction": "Añadir Reacción",
@@ -2925,7 +2926,7 @@
"channels_regionNotSet": "Región: ninguna",
"channels_regionSelect_Title": "Seleccione una región",
"channels_clearRegion": "Zona despejada",
"chat_sendImage": "Enviar imagen",
"chat_sendImageLora": "Enviar imagen mediante MeshCore",
"chat_imagePickFailed": "No pude abrir esa imagen",
"chat_receivedGif": "Recibido un GIF",
"repeater_keySettings": "Cambiar Claves de Identidad",
+2 -1
View File
@@ -507,6 +507,7 @@
}
}
},
"chat_selectSendAction": "Sélectionner une action d’envoi",
"chat_sendGif": "Envoyer un GIF",
"chat_reply": "Répondre",
"chat_addReaction": "Ajouter une réaction",
@@ -2925,7 +2926,7 @@
"channels_regionNotSet": "Région : aucune",
"channels_regionSelect_Title": "Choisissez une région",
"channels_clearRegion": "Zone dégagée",
"chat_sendImage": "Envoyer l'image",
"chat_sendImageLora": "Envoyer une image via MeshCore",
"chat_imagePickFailed": "Je n'ai pas pu ouvrir cette image",
"chat_receivedGif": "Reçu un GIF",
"repeater_keySettings": "Modifier les clés d'identité",
+2 -1
View File
@@ -657,6 +657,7 @@
}
}
},
"chat_selectSendAction": "Küldési művelet kiválasztása",
"chat_sendGif": "GIF küldése",
"chat_reply": "Válasz",
"chat_addReaction": "Reakció hozzáadása",
@@ -2829,7 +2830,7 @@
"channels_regionNotSet": "Tájékoztetés: nem",
"channels_regionSelect_Title": "Válassz egy regionot",
"channels_clearRegion": "Kéres kör",
"chat_sendImage": "Felhasználj az image",
"chat_sendImageLora": "Kép küldése MeshCore-on keresztül",
"chat_imagePickFailed": "Nem tudtam ezt a fenti fényre kapni",
"chat_receivedGif": "GIF-ot kapott",
"repeater_keySettings": "Képzőítsekei jelölt",
+3 -1
View File
@@ -140,6 +140,7 @@
"settings_infoStatus": "Stato",
"settings_infoBattery": "Batteria",
"settings_infoPublicKey": "Chiave Pubblica",
"settings_publicKeyCopied": "Chiave pubblica copiata",
"settings_infoContactsCount": "Numero di contatti",
"settings_infoChannelCount": "Numero di canali",
"settings_presets": "Preset",
@@ -551,6 +552,7 @@
}
}
},
"chat_selectSendAction": "Seleziona azione di invio",
"chat_sendGif": "Invia GIF",
"chat_reply": "Rispondi",
"chat_addReaction": "Aggiungi Reazione",
@@ -2925,7 +2927,7 @@
"channels_regionNotSet": "Regione: nessuna",
"channels_regionSelect_Title": "Scegli una regione",
"channels_clearRegion": "Zona chiara",
"chat_sendImage": "Invia immagine",
"chat_sendImageLora": "Invia immagine tramite MeshCore",
"chat_imagePickFailed": "Non sono riuscito ad aprire quell'immagine",
"chat_receivedGif": "Ricevuto un GIF",
"repeater_keySettings": "Cambia le Chiavi di Identità",
+2 -1
View File
@@ -675,6 +675,7 @@
}
}
},
"chat_selectSendAction": "送信アクションを選択",
"chat_sendGif": "GIF を送信",
"chat_reply": "返信",
"chat_addReaction": "リアクションを追加",
@@ -2925,7 +2926,7 @@
"channels_regionNotSet": "地域:なし",
"channels_regionSelect_Title": "地域を選択する",
"channels_clearRegion": "クリアな地域",
"chat_sendImage": "画像を送信",
"chat_sendImageLora": "MeshCore経由で画像を送信",
"chat_imagePickFailed": "その画像を開けませんでした",
"chat_receivedGif": "GIFを受け取りました",
"repeater_keySettings": "アイデンティティキーの変更",
+2 -1
View File
@@ -657,6 +657,7 @@
}
}
},
"chat_selectSendAction": "전송 작업 선택",
"chat_sendGif": "GIF 보내기",
"chat_reply": "답변",
"chat_addReaction": "댓글 추가",
@@ -2925,7 +2926,7 @@
"channels_regionNotSet": "지역: 없음",
"channels_regionSelect_Title": "지역을 선택하세요",
"channels_clearRegion": "명확한 지역",
"chat_sendImage": "이미지를 보내세요",
"chat_sendImageLora": "MeshCore를 통해 이미지 보내기",
"chat_imagePickFailed": "그 이미지를 열 수 없었어요.",
"chat_receivedGif": "GIF를 받았습니다",
"repeater_keySettings": "신원 키 변경",
+33 -3
View File
@@ -334,6 +334,18 @@ abstract class AppLocalizations {
/// **'Heard repeated'**
String get messageStatus_repeated;
/// No description provided for @urlImage_enable.
///
/// In en, this message translates to:
/// **'Enable URL images'**
String get urlImage_enable;
/// No description provided for @urlImage_possible.
///
/// In en, this message translates to:
/// **'Possible URL image; enable it in Settings.'**
String get urlImage_possible;
/// No description provided for @common_reboot.
///
/// In en, this message translates to:
@@ -1228,6 +1240,12 @@ abstract class AppLocalizations {
/// **'Public Key'**
String get settings_infoPublicKey;
/// No description provided for @settings_publicKeyCopied.
///
/// In en, this message translates to:
/// **'Public key copied'**
String get settings_publicKeyCopied;
/// No description provided for @settings_infoContactsCount.
///
/// In en, this message translates to:
@@ -2728,17 +2746,23 @@ abstract class AppLocalizations {
/// **'Retry {current}/{max}'**
String chat_retryCount(int current, int max);
/// No description provided for @chat_selectSendAction.
///
/// In en, this message translates to:
/// **'Select send action'**
String get chat_selectSendAction;
/// No description provided for @chat_sendGif.
///
/// In en, this message translates to:
/// **'Send GIF'**
String get chat_sendGif;
/// No description provided for @chat_sendImage.
/// No description provided for @chat_sendImageLora.
///
/// In en, this message translates to:
/// **'Send image'**
String get chat_sendImage;
/// **'Send image via meshcore'**
String get chat_sendImageLora;
/// Shown when picking or reading a photo to send fails
///
@@ -2770,6 +2794,12 @@ abstract class AppLocalizations {
/// **'Me'**
String get chat_me;
/// No description provided for @reaction_report.
///
/// In en, this message translates to:
/// **'Emoji Reactions'**
String get reaction_report;
/// No description provided for @emojiCategorySmileys.
///
/// In en, this message translates to:
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsBg extends AppLocalizations {
@override
String get messageStatus_repeated => 'Повторно чуто';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => 'Рестартирай';
@@ -622,6 +628,9 @@ class AppLocalizationsBg extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Публичен ключ';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => 'Брой контакти';
@@ -1489,11 +1498,14 @@ class AppLocalizationsBg extends AppLocalizations {
return 'Опитай отново $current/$max';
}
@override
String get chat_selectSendAction => 'Изберете действие за изпращане';
@override
String get chat_sendGif => 'Изпрати GIF';
@override
String get chat_sendImage => 'Изпрати изображение';
String get chat_sendImageLora => 'Изпращане на изображение чрез MeshCore';
@override
String get chat_imagePickFailed => 'Не мог да откривам та изображин';
@@ -1510,6 +1522,9 @@ class AppLocalizationsBg extends AppLocalizations {
@override
String get chat_me => 'Аз';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Емотикони';
+17 -1
View File
@@ -110,6 +110,13 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get messageStatus_repeated => 'Mehrfach gehört';
@override
String get urlImage_enable => 'URL-Bilder anzeigen';
@override
String get urlImage_possible =>
'Mögliches URL-Bild; in den Einstellungen aktivieren.';
@override
String get common_reboot => 'Neustart';
@@ -618,6 +625,9 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Öffentlicher Schlüssel';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => 'Kontakte';
@@ -1488,11 +1498,14 @@ class AppLocalizationsDe extends AppLocalizations {
return 'Wiederholen $current/$max';
}
@override
String get chat_selectSendAction => 'Sendeaktion auswählen';
@override
String get chat_sendGif => 'GIF senden';
@override
String get chat_sendImage => 'Bild senden';
String get chat_sendImageLora => 'Bild über MeshCore senden';
@override
String get chat_imagePickFailed => 'Konnte dieses Bild nicht öffnen.';
@@ -1509,6 +1522,9 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get chat_me => 'Ich';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Emoticons';
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get messageStatus_repeated => 'Heard repeated';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => 'Reboot';
@@ -605,6 +611,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Public Key';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => 'Contacts Count';
@@ -1456,11 +1465,14 @@ class AppLocalizationsEn extends AppLocalizations {
return 'Retry $current/$max';
}
@override
String get chat_selectSendAction => 'Select send action';
@override
String get chat_sendGif => 'Send GIF';
@override
String get chat_sendImage => 'Send image';
String get chat_sendImageLora => 'Send image via meshcore';
@override
String get chat_imagePickFailed => 'Couldn\'t open that image';
@@ -1477,6 +1489,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get chat_me => 'Me';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Smileys';
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get messageStatus_repeated => 'Escuchado repetidamente';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => 'Reiniciar';
@@ -617,6 +623,9 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Clave pública';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => 'Número de contactos';
@@ -1484,11 +1493,14 @@ class AppLocalizationsEs extends AppLocalizations {
return 'Reintentar $current/$max';
}
@override
String get chat_selectSendAction => 'Seleccionar acción de envío';
@override
String get chat_sendGif => 'Enviar GIF';
@override
String get chat_sendImage => 'Enviar imagen';
String get chat_sendImageLora => 'Enviar imagen mediante MeshCore';
@override
String get chat_imagePickFailed => 'No pude abrir esa imagen';
@@ -1505,6 +1517,9 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get chat_me => 'Yo';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Emoticones';
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get messageStatus_repeated => 'Reçu plusieurs fois';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => 'Redémarrer';
@@ -622,6 +628,9 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Clé publique';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => 'Nombre de contacts';
@@ -1487,11 +1496,14 @@ class AppLocalizationsFr extends AppLocalizations {
return 'Essai $current/$max';
}
@override
String get chat_selectSendAction => 'Sélectionner une action d’envoi';
@override
String get chat_sendGif => 'Envoyer un GIF';
@override
String get chat_sendImage => 'Envoyer l\'image';
String get chat_sendImageLora => 'Envoyer une image via MeshCore';
@override
String get chat_imagePickFailed => 'Je n\'ai pas pu ouvrir cette image';
@@ -1508,6 +1520,9 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get chat_me => 'Moi';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Émojis';
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsHu extends AppLocalizations {
@override
String get messageStatus_repeated => '– ismételte Heard';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => 'Indítsa újra';
@@ -614,6 +620,9 @@ class AppLocalizationsHu extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Nyilvános kulcs';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => 'Névjegyek száma';
@@ -1479,11 +1488,14 @@ class AppLocalizationsHu extends AppLocalizations {
return 'Próbálja újra $current/$max';
}
@override
String get chat_selectSendAction => 'Küldési művelet kiválasztása';
@override
String get chat_sendGif => 'GIF küldése';
@override
String get chat_sendImage => 'Felhasználj az image';
String get chat_sendImageLora => 'Kép küldése MeshCore-on keresztül';
@override
String get chat_imagePickFailed => 'Nem tudtam ezt a fenti fényre kapni';
@@ -1500,6 +1512,9 @@ class AppLocalizationsHu extends AppLocalizations {
@override
String get chat_me => 'Nekem';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Hangulatjelek';
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get messageStatus_repeated => 'Ricevuto ripetutamente';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => 'Riavvia';
@@ -621,6 +627,9 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Chiave Pubblica';
@override
String get settings_publicKeyCopied => 'Chiave pubblica copiata';
@override
String get settings_infoContactsCount => 'Numero di contatti';
@@ -1487,11 +1496,14 @@ class AppLocalizationsIt extends AppLocalizations {
return 'Riprova $current/$max';
}
@override
String get chat_selectSendAction => 'Seleziona azione di invio';
@override
String get chat_sendGif => 'Invia GIF';
@override
String get chat_sendImage => 'Invia immagine';
String get chat_sendImageLora => 'Invia immagine tramite MeshCore';
@override
String get chat_imagePickFailed =>
@@ -1509,6 +1521,9 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get chat_me => 'Io';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Emoji';
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get messageStatus_repeated => '何度も聞いた';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => '再起動';
@@ -587,6 +593,9 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get settings_infoPublicKey => '公開鍵';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => '連絡先数';
@@ -1412,11 +1421,14 @@ class AppLocalizationsJa extends AppLocalizations {
return '$current/$max 回目';
}
@override
String get chat_selectSendAction => '送信アクションを選択';
@override
String get chat_sendGif => 'GIF を送信';
@override
String get chat_sendImage => '画像を送信';
String get chat_sendImageLora => 'MeshCore経由で画像を送信';
@override
String get chat_imagePickFailed => 'その画像を開けませんでした';
@@ -1433,6 +1445,9 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get chat_me => '私';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => '顔文字';
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsKo extends AppLocalizations {
@override
String get messageStatus_repeated => '반복 수신됨';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => '재부팅';
@@ -588,6 +594,9 @@ class AppLocalizationsKo extends AppLocalizations {
@override
String get settings_infoPublicKey => '공개 키';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => '연락처 수';
@@ -1415,11 +1424,14 @@ class AppLocalizationsKo extends AppLocalizations {
return '$current/$max 시도';
}
@override
String get chat_selectSendAction => '전송 작업 선택';
@override
String get chat_sendGif => 'GIF 보내기';
@override
String get chat_sendImage => '이미지를 보내세요';
String get chat_sendImageLora => 'MeshCore를 통해 이미지 보내기';
@override
String get chat_imagePickFailed => '그 이미지를 열 수 없었어요.';
@@ -1436,6 +1448,9 @@ class AppLocalizationsKo extends AppLocalizations {
@override
String get chat_me => '나';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => '이모티콘';
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsNl extends AppLocalizations {
@override
String get messageStatus_repeated => 'Hearsay, herhaald';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => 'Herstarten';
@@ -614,6 +620,9 @@ class AppLocalizationsNl extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Openbare Sleutel';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => 'Aantal Contacten';
@@ -1474,11 +1483,14 @@ class AppLocalizationsNl extends AppLocalizations {
return 'Poging opnieuw $current/$max';
}
@override
String get chat_selectSendAction => 'Verzendactie selecteren';
@override
String get chat_sendGif => 'GIF verzenden';
@override
String get chat_sendImage => 'Beeld verzenden';
String get chat_sendImageLora => 'Afbeelding verzenden via MeshCore';
@override
String get chat_imagePickFailed => 'Kunde die afbeelding niet openen';
@@ -1495,6 +1507,9 @@ class AppLocalizationsNl extends AppLocalizations {
@override
String get chat_me => 'Mijn';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Emoji\'s';
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsPl extends AppLocalizations {
@override
String get messageStatus_repeated => 'Usłyszałem to wielokrotnie';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => 'Uruchom ponownie';
@@ -622,6 +628,9 @@ class AppLocalizationsPl extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Klucz Publiczny';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => 'Liczba kontaktów';
@@ -1497,11 +1506,14 @@ class AppLocalizationsPl extends AppLocalizations {
return 'Próba $current/$max';
}
@override
String get chat_selectSendAction => 'Wybierz czynność wysyłania';
@override
String get chat_sendGif => 'Wyślij GIF';
@override
String get chat_sendImage => 'Wyślij obraz';
String get chat_sendImageLora => 'Wyślij obraz przez MeshCore';
@override
String get chat_imagePickFailed => 'Nie mogłem otworzyć tego obrazu';
@@ -1518,6 +1530,9 @@ class AppLocalizationsPl extends AppLocalizations {
@override
String get chat_me => 'Ja';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Emoji';
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get messageStatus_repeated => 'Ouvi repetidamente';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => 'Reiniciar';
@@ -619,6 +625,9 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Chave Pública';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => 'Número de Contatos';
@@ -1483,11 +1492,14 @@ class AppLocalizationsPt extends AppLocalizations {
return 'Tentar $current/$max';
}
@override
String get chat_selectSendAction => 'Selecionar ação de envio';
@override
String get chat_sendGif => 'Enviar GIF';
@override
String get chat_sendImage => 'Enviar imagem';
String get chat_sendImageLora => 'Enviar imagem via MeshCore';
@override
String get chat_imagePickFailed => 'Não consegui abrir essa imagem';
@@ -1504,6 +1516,9 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get chat_me => 'Eu';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Emojis';
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get messageStatus_repeated => 'Услышал несколько раз';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => 'Перезагрузить';
@@ -620,6 +626,9 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Публичный ключ';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => 'Количество контактов';
@@ -1487,11 +1496,14 @@ class AppLocalizationsRu extends AppLocalizations {
return 'Попытка $current/$max';
}
@override
String get chat_selectSendAction => 'Выберите действие отправки';
@override
String get chat_sendGif => 'Отправить GIF';
@override
String get chat_sendImage => 'Отправьте изображение';
String get chat_sendImageLora => 'Отправить изображение через MeshCore';
@override
String get chat_imagePickFailed => 'Не удалось открыть это изображение';
@@ -1508,6 +1520,9 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get chat_me => 'Я';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Смайлы';
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsSk extends AppLocalizations {
@override
String get messageStatus_repeated => 'Slyšal som to opakovane';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => 'Restartovať';
@@ -612,6 +618,9 @@ class AppLocalizationsSk extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Verejný kľúč';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => 'Počet kontaktov';
@@ -1472,11 +1481,14 @@ class AppLocalizationsSk extends AppLocalizations {
return 'Skúsiť $current/$max';
}
@override
String get chat_selectSendAction => 'Vybrať akciu odoslania';
@override
String get chat_sendGif => 'Odoslať GIF';
@override
String get chat_sendImage => 'Vyslat obraz';
String get chat_sendImageLora => 'Odoslať obrázok cez MeshCore';
@override
String get chat_imagePickFailed => 'Nesmiela jsem otvoriť tento obrázok';
@@ -1493,6 +1505,9 @@ class AppLocalizationsSk extends AppLocalizations {
@override
String get chat_me => 'Mne';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Emoji';
+16 -1
View File
@@ -111,6 +111,12 @@ class AppLocalizationsSl extends AppLocalizations {
@override
String get messageStatus_repeated => 'Slišal sem večkrat';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => 'Ponoviti';
@@ -611,6 +617,9 @@ class AppLocalizationsSl extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Javni ključ';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => 'Število stikov';
@@ -1472,11 +1481,14 @@ class AppLocalizationsSl extends AppLocalizations {
return 'Ponovit $current/$max';
}
@override
String get chat_selectSendAction => 'Izberite dejanje pošiljanja';
@override
String get chat_sendGif => 'Pošlji GIF';
@override
String get chat_sendImage => 'Sločaji slik';
String get chat_sendImageLora => 'Pošlji sliko prek MeshCore';
@override
String get chat_imagePickFailed => 'Nispeval sem tega ta slik';
@@ -1493,6 +1505,9 @@ class AppLocalizationsSl extends AppLocalizations {
@override
String get chat_me => 'jaz';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Emoji';
File diff suppressed because it is too large. Load diff
+16 -2
View File
@@ -110,6 +110,12 @@ class AppLocalizationsUk extends AppLocalizations {
@override
String get messageStatus_repeated => 'Почув неодноразово';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => 'Перезавантажити';
@@ -615,6 +621,9 @@ class AppLocalizationsUk extends AppLocalizations {
@override
String get settings_infoPublicKey => 'Відкритий ключ';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => 'Кількість контактів';
@@ -1477,12 +1486,14 @@ class AppLocalizationsUk extends AppLocalizations {
return 'Повторна спроба $current/$max';
}
@override
String get chat_selectSendAction => 'Виберіть дію надсилання';
@override
String get chat_sendGif => 'Надіслати GIF';
@override
String get chat_sendImage =>
'Нашкоду зовні\n\n(or more naturally, depending on context)\n\nПошукуєте изображення';
String get chat_sendImageLora => 'Надіслати зображення через MeshCore';
@override
String get chat_imagePickFailed => 'Неможливо відкрити це изображення';
@@ -1499,6 +1510,9 @@ class AppLocalizationsUk extends AppLocalizations {
@override
String get chat_me => 'Я';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => 'Емодзі';
+16 -1
View File
@@ -110,6 +110,12 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get messageStatus_repeated => '多次听到';
@override
String get urlImage_enable => 'Enable URL images';
@override
String get urlImage_possible => 'Possible URL image; enable it in Settings.';
@override
String get common_reboot => '重启';
@@ -580,6 +586,9 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get settings_infoPublicKey => '公钥';
@override
String get settings_publicKeyCopied => 'Public key copied';
@override
String get settings_infoContactsCount => '联系人数量';
@@ -1398,11 +1407,14 @@ class AppLocalizationsZh extends AppLocalizations {
return '重试 $current/$max';
}
@override
String get chat_selectSendAction => '选择发送操作';
@override
String get chat_sendGif => '发送 GIF';
@override
String get chat_sendImage => '发送图片';
String get chat_sendImageLora => '通过 MeshCore 发送图片';
@override
String get chat_imagePickFailed => '无法打开该图片';
@@ -1419,6 +1431,9 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get chat_me => '我';
@override
String get reaction_report => 'Emoji Reactions';
@override
String get emojiCategorySmileys => '表情';
+2 -1
View File
@@ -485,6 +485,7 @@
}
}
},
"chat_selectSendAction": "Verzendactie selecteren",
"chat_sendGif": "GIF verzenden",
"chat_reply": "Reageren",
"chat_addReaction": "Reactie toevoegen",
@@ -2791,7 +2792,7 @@
"channels_regionNotSet": "Regio: geen",
"channels_regionSelect_Title": "Kies een regio",
"channels_clearRegion": "Duidelijke regio",
"chat_sendImage": "Beeld verzenden",
"chat_sendImageLora": "Afbeelding verzenden via MeshCore",
"chat_imagePickFailed": "Kunde die afbeelding niet openen",
"chat_receivedGif": "Ontvangen van een GIF",
"repeater_keySettings": "Verander de Identiteitskies",
+2 -1
View File
@@ -495,6 +495,7 @@
}
}
},
"chat_selectSendAction": "Wybierz czynność wysyłania",
"chat_sendGif": "Wyślij GIF",
"chat_reply": "Odpowiedz",
"chat_addReaction": "Dodaj Reakcję",
@@ -2823,7 +2824,7 @@
"channels_regionNotSet": "Region: brak",
"channels_regionSelect_Title": "Wybierz region",
"channels_clearRegion": "Przejrzyste obszar",
"chat_sendImage": "Wyślij obraz",
"chat_sendImageLora": "Wyślij obraz przez MeshCore",
"chat_imagePickFailed": "Nie mogłem otworzyć tego obrazu",
"chat_receivedGif": "Otrzymano GIF",
"repeater_keySettings": "Zmiana kluczy tożsamości",
+2 -1
View File
@@ -485,6 +485,7 @@
}
}
},
"chat_selectSendAction": "Selecionar ação de envio",
"chat_sendGif": "Enviar GIF",
"chat_reply": "Responder",
"chat_addReaction": "Adicionar Reação",
@@ -2791,7 +2792,7 @@
"channels_regionNotSet": "Região: nenhuma",
"channels_regionSelect_Title": "Escolha uma região",
"channels_clearRegion": "Região desimpedida",
"chat_sendImage": "Enviar imagem",
"chat_sendImageLora": "Enviar imagem via MeshCore",
"chat_imagePickFailed": "Não consegui abrir essa imagem",
"chat_receivedGif": "Recebi um GIF",
"repeater_keySettings": "Alterar Chaves de Identidade",
+2 -1
View File
@@ -316,6 +316,7 @@
"chat_messageDeleted": "Сообщение удалено",
"chat_retryingMessage": "Повтор отправки сообщения",
"chat_retryCount": "Попытка {current}/{max}",
"chat_selectSendAction": "Выберите действие отправки",
"chat_sendGif": "Отправить GIF",
"chat_reply": "Ответить",
"chat_addReaction": "Добавить реакцию",
@@ -2088,7 +2089,7 @@
"channels_regionNotSet": "Регион: отсутствует",
"channels_regionSelect_Title": "Выберите регион",
"channels_clearRegion": "Чистый регион",
"chat_sendImage": "Отправьте изображение",
"chat_sendImageLora": "Отправить изображение через MeshCore",
"chat_imagePickFailed": "Не удалось открыть это изображение",
"chat_receivedGif": "Получен GIF",
"repeater_keySettings": "Изменить ключи идентичности",
+2 -1
View File
@@ -485,6 +485,7 @@
}
}
},
"chat_selectSendAction": "Vybrať akciu odoslania",
"chat_sendGif": "Odoslať GIF",
"chat_reply": "Odpovedať",
"chat_addReaction": "Pridať Reakciu",
@@ -2791,7 +2792,7 @@
"channels_regionNotSet": "Region: žiadné",
"channels_regionSelect_Title": "Vyberte region",
"channels_clearRegion": "Jasný údajný oblasť",
"chat_sendImage": "Vyslat obraz",
"chat_sendImageLora": "Odoslať obrázok cez MeshCore",
"chat_imagePickFailed": "Nesmiela jsem otvoriť tento obrázok",
"chat_receivedGif": "Odeslaný GIF",
"repeater_keySettings": "Zmena identititačných klíčov",
+2 -1
View File
@@ -485,6 +485,7 @@
}
}
},
"chat_selectSendAction": "Izberite dejanje pošiljanja",
"chat_sendGif": "Pošlji GIF",
"chat_reply": "Odgovori",
"chat_addReaction": "Dodaj reakcijo",
@@ -2791,7 +2792,7 @@
"channels_regionNotSet": "Region: brak",
"channels_regionSelect_Title": "Vablajte region",
"channels_clearRegion": "Jasna regija",
"chat_sendImage": "Sločaji slik",
"chat_sendImageLora": "Pošlji sliko prek MeshCore",
"chat_imagePickFailed": "Nispeval sem tega ta slik",
"chat_receivedGif": "Otrvljen GIF",
"repeater_keySettings": "Zmeničke ključe identitete",
+436 -434
View File
File diff suppressed because it is too large. Load diff
+2 -1
View File
@@ -488,6 +488,7 @@
}
}
},
"chat_selectSendAction": "Виберіть дію надсилання",
"chat_sendGif": "Надіслати GIF",
"chat_reply": "Відповісти",
"chat_addReaction": "Додати реакцію",
@@ -2771,7 +2772,7 @@
"channels_regionNotSet": "Ріон: нема",
"channels_regionSelect_Title": "Вybірте регіон",
"channels_clearRegion": "Чистя зона",
"chat_sendImage": "Нашкоду зовні\n\n(or more naturally, depending on context)\n\nПошукуєте изображення",
"chat_sendImageLora": "Надіслати зображення через MeshCore",
"chat_imagePickFailed": "Неможливо відкрити це изображення",
"chat_receivedGif": "Підймовано GIF",
"repeater_keySettings": "Зміна ключів ідентифікації",
+2 -1
View File
@@ -512,6 +512,7 @@
}
}
},
"chat_selectSendAction": "选择发送操作",
"chat_sendGif": "发送 GIF",
"chat_reply": "回复",
"chat_addReaction": "添加表情",
@@ -2796,7 +2797,7 @@
"channels_regionNotSet": "地区:无",
"channels_regionSelect_Title": "选择一个地区",
"channels_clearRegion": "无碍区域",
"chat_sendImage": "发送图片",
"chat_sendImageLora": "通过 MeshCore 发送图片",
"chat_imagePickFailed": "无法打开该图片",
"chat_receivedGif": "收到一个GIF",
"repeater_keySettings": "更改身份密钥",
+34 -5
View File
@@ -50,7 +50,7 @@ class ChannelMessage {
final String? replyToMessageId;
final String? replyToSenderName;
final String? replyToText;
final Map<String, int> reactions;
final Map<String, List<String?>> reactions;
ChannelMessage({
this.senderKey,
@@ -76,7 +76,7 @@ class ChannelMessage {
this.replyToMessageId,
this.replyToSenderName,
this.replyToText,
Map<String, int>? reactions,
Map<String, List<String?>>? reactions,
}) : messageId =
messageId ??
'${timestamp.millisecondsSinceEpoch}_${senderName.hashCode}_${text.hashCode}',
@@ -107,7 +107,7 @@ class ChannelMessage {
Object? translatedLanguageCode = _unset,
MessageTranslationStatus? translationStatus,
Object? translationModelId = _unset,
Map<String, int>? reactions,
Map<String, List<String?>>? reactions,
}) {
return ChannelMessage(
senderKey: senderKey,
@@ -297,8 +297,37 @@ class ChannelMessage {
);
}
static ReactionInfo? parseReaction(String text) {
return ReactionHelper.parseReaction(text);
ReactionInfo? parseReaction() {
final reactionInfo = ReactionHelper.parseReaction(text);
reactionInfo?.senderName = senderName;
return reactionInfo;
}
String computeReactionHash() {
return ReactionHelper.computeReactionHash(
timestamp.millisecondsSinceEpoch ~/ 1000,
senderName,
text,
);
}
List<ReactionInfo> reactionList() {
final String hash = computeReactionHash();
List<ReactionInfo> reactionList = [];
for (final entry in reactions.entries) {
final emoji = entry.key;
for (final senderName in entry.value) {
reactionList.add(
ReactionInfo(
targetHash: hash, // won't be used for anything
emoji: emoji,
senderName: senderName,
hashType: HashType.ours, // also not used for anything
),
);
}
}
return reactionList;
}
}
+4 -4
View File
@@ -8,7 +8,7 @@ enum MessageStatus { pending, sent, delivered, failed }
class Message {
static const Object _unset = Object();
final Uint8List senderKey;
final Uint8List senderKey; // For outgoing msgs, gets used as recipientKey
final String text;
final DateTime timestamp;
final bool isOutgoing;
@@ -30,7 +30,7 @@ class Message {
final int? tripTimeMs;
final int? pathLength;
final Uint8List pathBytes;
final Map<String, int> reactions;
final Map<String, List<String?>> reactions;
final Map<String, MessageStatus> reactionStatuses;
final Uint8List fourByteRoomContactKey;
@@ -56,7 +56,7 @@ class Message {
this.pathLength,
Uint8List? pathBytes,
Uint8List? fourByteRoomContactKey,
Map<String, int>? reactions,
Map<String, List<String?>>? reactions,
Map<String, MessageStatus>? reactionStatuses,
}) : messageId =
messageId ??
@@ -84,7 +84,7 @@ class Message {
Object? translatedLanguageCode = _unset,
MessageTranslationStatus? translationStatus,
Object? translationModelId = _unset,
Map<String, int>? reactions,
Map<String, List<String?>>? reactions,
Map<String, MessageStatus>? reactionStatuses,
Uint8List? fourByteRoomContactKey,
}) {
+12 -2
View File
@@ -478,7 +478,17 @@ class RadioSettings {
bandwidth: LoRaBandwidth.bw62_5,
spreadingFactor: LoRaSpreadingFactor.sf9,
codingRate: LoRaCodingRate.cr4_8,
txPowerDbm: 20,
txPowerDbm: 22,
),
),
(
'USA Philly',
RadioSettings(
frequencyMHz: 902.250,
bandwidth: LoRaBandwidth.bw500,
spreadingFactor: LoRaSpreadingFactor.sf11,
codingRate: LoRaCodingRate.cr4_5,
txPowerDbm: 22,
),
),
(
@@ -488,7 +498,7 @@ class RadioSettings {
bandwidth: LoRaBandwidth.bw62_5,
spreadingFactor: LoRaSpreadingFactor.sf7,
codingRate: LoRaCodingRate.cr4_5,
txPowerDbm: 20,
txPowerDbm: 22,
),
),
(
+266 -93
View File
@@ -18,6 +18,7 @@ import '../helpers/chat_scroll_controller.dart';
import '../connector/meshcore_protocol.dart';
import '../helpers/cyr2lat.dart';
import '../helpers/gif_helper.dart';
import '../helpers/message_url_image_helper.dart';
import '../helpers/path_helper.dart';
import '../helpers/reaction_helper.dart';
import '../helpers/snack_bar_builder.dart';
@@ -41,7 +42,6 @@ import '../widgets/emoji_picker.dart';
import '../widgets/gif_message.dart';
import '../widgets/jump_to_bottom_button.dart';
import '../widgets/gif_picker.dart';
import '../widgets/image_send_button.dart';
import '../widgets/image_send_codec_binding.dart';
import '../widgets/image_send_preview_sheet.dart';
import '../widgets/message_translation_button.dart';
@@ -413,6 +413,9 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
);
}
final urlImagesEnabled = connector.isChannelUrlImagesEnabled(
widget.channel.index,
);
// Images are not ChannelMessages: they arrive as GRP_DATA
// chunks and are owned by ReceivedImageStore, so the two
// sources are merged here in timestamp order and the list
@@ -501,7 +504,11 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
);
final message = row.message;
final bubble = message != null
? _buildMessageBubble(message, textScale)
? _buildMessageBubble(
message,
textScale,
urlImagesEnabled,
)
: _buildImageBubble(
row.image!,
textScale,
@@ -525,7 +532,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
},
),
),
_buildMessageComposer(),
_buildInputBar(),
],
),
),
@@ -544,7 +551,11 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
connector.setChannelUnreadCount(widget.channel.index, count);
}
Widget _buildMessageBubble(ChannelMessage message, double textScale) {
Widget _buildMessageBubble(
ChannelMessage message,
double textScale,
bool urlImagesEnabled,
) {
final settingsService = context.watch<AppSettingsService>();
final enableTracing = settingsService.settings.enableMessageTracing;
final isOutgoing = message.isOutgoing;
@@ -584,6 +595,33 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
final metaColor = textColor.withValues(alpha: 0.65);
const bodyFontSize = 14.0;
Widget buildTextContent() {
return Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Flexible(
child: TranslatedMessageContent(
displayText: translatedDisplayText,
originalText: originalDisplayText,
style: TextStyle(
color: textColor,
fontSize: bodyFontSize * textScale,
),
originalStyle: TextStyle(
fontSize: bodyFontSize * textScale,
fontStyle: FontStyle.italic,
color: textColor.withValues(alpha: 0.72),
),
onSecondaryTap: PlatformInfo.isDesktop
? () => _showMessageActions(message)
: null,
),
),
],
);
}
// Asymmetric radius matching chat_screen bubbles.
final borderRadius = isOutgoing
? const BorderRadius.only(
@@ -689,29 +727,76 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
),
],
)
else if (urlImagesEnabled)
MessageUrlImageFutureBuilder(
messageId: message.messageId,
text: message.text,
builder: (context, snapshot) {
final imageAttachment = snapshot.data;
if (imageAttachment != null) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(
vertical: 4,
),
child: Align(
alignment: isOutgoing
? Alignment.centerRight
: Alignment.centerLeft,
child: MessageUrlImagePreview(
imageUrl: imageAttachment,
),
),
),
Padding(
padding: const EdgeInsets.only(top: 8),
child: TranslatedMessageContent(
displayText: translatedDisplayText,
originalText: originalDisplayText,
style: TextStyle(
color: textColor,
fontSize: bodyFontSize * textScale,
),
originalStyle: TextStyle(
fontSize: bodyFontSize * textScale,
fontStyle: FontStyle.italic,
color: textColor.withValues(
alpha: 0.72,
),
),
onSecondaryTap: PlatformInfo.isDesktop
? () => _showMessageActions(message)
: null,
),
),
],
);
}
return buildTextContent();
},
)
else
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: TranslatedMessageContent(
displayText: translatedDisplayText,
originalText: originalDisplayText,
style: TextStyle(
color: textColor,
fontSize: bodyFontSize * textScale,
if (MessageUrlImageHelper.hasPotentialImageUrl(
message.text,
))
Padding(
padding: const EdgeInsets.only(bottom: 4),
child: Text(
context.l10n.urlImage_possible,
style: TextStyle(
color: metaColor,
fontSize: 11 * textScale,
),
),
originalStyle: TextStyle(
fontSize: bodyFontSize * textScale,
fontStyle: FontStyle.italic,
color: textColor.withValues(alpha: 0.72),
),
onSecondaryTap: PlatformInfo.isDesktop
? () => _showMessageActions(message)
: null,
),
),
buildTextContent(),
],
),
if (enableTracing && displayPath.isNotEmpty) ...[
@@ -961,7 +1046,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
runSpacing: 6,
children: message.reactions.entries.map((entry) {
final emoji = entry.key;
final count = entry.value;
final int count = entry.value.length;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
@@ -970,35 +1055,97 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
borderRadius: BorderRadius.circular(MeshRadii.pill),
border: Border.all(color: scheme.outlineVariant, width: 1),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
emoji,
style: MeshTheme.emoji(fontSize: 16),
textHeightBehavior: const TextHeightBehavior(
applyHeightToFirstAscent: false,
applyHeightToLastDescent: false,
),
),
if (count > 1) ...[
const SizedBox(width: 4),
child: InkWell(
onTap: () => _showReactionsReport(message),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'$count',
style: MeshTheme.mono(
fontSize: 11,
fontWeight: FontWeight.w700,
color: scheme.onSurface,
emoji,
style: MeshTheme.emoji(fontSize: 16),
textHeightBehavior: const TextHeightBehavior(
applyHeightToFirstAscent: false,
applyHeightToLastDescent: false,
),
),
if (count > 1) ...[
const SizedBox(width: 4),
Text(
'$count',
style: MeshTheme.mono(
fontSize: 11,
fontWeight: FontWeight.w700,
color: scheme.onSurface,
),
),
],
],
],
),
),
);
}).toList(),
);
}
void _showReactionsReport(ChannelMessage message) {
final scheme = Theme.of(context).colorScheme;
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(context.l10n.reaction_report),
content: SizedBox(
width: double.maxFinite,
child: Scrollbar(
child: ListView(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(vertical: 4),
children: message.reactionList().map((reaction) {
return Container(
padding: const EdgeInsetsDirectional.symmetric(vertical: 4),
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
decoration: BoxDecoration(
color: scheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(MeshRadii.pill),
border: Border.all(
color: scheme.outlineVariant,
width: 1,
),
),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
reaction.emoji,
style: MeshTheme.emoji(fontSize: 16),
textHeightBehavior: const TextHeightBehavior(
applyHeightToFirstAscent: false,
applyHeightToLastDescent: false,
),
),
const SizedBox(width: 12),
Expanded(child: Text(reaction.senderName ?? '???')),
],
),
),
),
);
}).toList(),
),
),
),
),
);
}
Widget _buildPoiMessage(
BuildContext context,
MarkerPayload poi,
@@ -1079,10 +1226,9 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
/// Whether the image codec model is currently downloading.
///
/// The image button must stay hidden while the model downloads: an encode
/// cannot start until the weights are on disk, and the preview sheet would
/// have nothing to show but a spinner.
bool get _imageCodecDownloading {
/// This must be read while [context] is building; popup item builders run
/// from an overlay and cannot listen to a provider.
bool _isImageCodecDownloading(BuildContext context) {
try {
return context.watch<ImageCodecService>().isDownloading;
} on ProviderNotFoundException {
@@ -1603,41 +1749,84 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
);
}
Widget _buildMessageComposer() {
Widget _buildInputBar() {
final connector = context.watch<MeshCoreConnector>();
final maxBytes = maxChannelMessageBytes(connector.selfName);
final settings = context.watch<AppSettingsService>().settings;
final imageCodecDownloading = _isImageCodecDownloading(context);
final showImageAction =
settings.imageMessagesEnabled && !imageCodecDownloading;
final scheme = Theme.of(context).colorScheme;
return Column(
mainAxisSize: MainAxisSize.min,
children: [
if (_replyingToMessage != null)
Builder(
builder: (context) {
final textScale = context.select<ChatTextScaleService, double>(
(service) => service.scale,
);
return _buildReplyBanner(textScale);
},
),
if (_imageSendTotal > 0) _buildImageSendProgress(scheme),
Container(
decoration: BoxDecoration(
color: scheme.surface,
border: Border(
top: BorderSide(color: scheme.outlineVariant, width: 1),
),
),
child: SafeArea(
child: Padding(
return Container(
decoration: BoxDecoration(
color: scheme.surface,
border: Border(top: BorderSide(color: scheme.outlineVariant, width: 1)),
),
child: SafeArea(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (_replyingToMessage != null)
Builder(
builder: (context) {
final textScale = context
.select<ChatTextScaleService, double>(
(service) => service.scale,
);
return _buildReplyBanner(textScale);
},
),
if (_imageSendTotal > 0) _buildImageSendProgress(scheme),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
IconButton(
icon: const Icon(Icons.gif_box),
onPressed: () => _showGifPicker(context),
tooltip: context.l10n.chat_sendGif,
PopupMenuButton<String>(
icon: const Icon(Icons.add_circle_outline),
position: PopupMenuPosition.over,
offset: Offset(0, showImageAction ? -112 : -64),
tooltip: context.l10n.chat_selectSendAction,
onSelected: (action) {
switch (action) {
case 'gif':
_showGifPicker(context);
break;
case 'meshcore-image':
_showImageSendPreview();
break;
}
},
itemBuilder: (context) => [
PopupMenuItem(
value: 'gif',
child: Row(
children: [
const Icon(Icons.gif_box),
const SizedBox(width: 12),
Text(context.l10n.chat_sendGif),
],
),
),
if (showImageAction)
PopupMenuItem(
value: 'meshcore-image',
// Gated on the codec, not just the setting. The preview
// sheet explains why a send is impossible, but a fully
// live button in a build that cannot encode invites the
// tap that produces that explanation.
enabled:
_imageCodec?.availability ==
ImageCodecAvailability.ready,
child: Row(
children: [
const Icon(Icons.image_outlined),
const SizedBox(width: 12),
Text(context.l10n.chat_sendImageLora),
],
),
),
],
),
if (settings.translationEnabled)
MessageTranslationButton(
@@ -1645,17 +1834,6 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
languageCode: settings.translationTargetLanguageCode,
onPressed: _showTranslationOptions,
),
if (settings.imageMessagesEnabled && !_imageCodecDownloading)
ImageSendButton(
// Gated on the codec, not just the setting. The preview
// sheet explains why a send is impossible, but a fully
// live button in a build that cannot encode invites the
// tap that produces that explanation.
enabled:
_imageCodec?.availability ==
ImageCodecAvailability.ready,
onPressed: () => _showImageSendPreview(),
),
Expanded(
child: ValueListenableBuilder<TextEditingValue>(
valueListenable: _textController,
@@ -1787,9 +1965,9 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
],
),
),
),
],
),
],
),
);
}
@@ -2037,12 +2215,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
final connector = context.read<MeshCoreConnector>();
final emojiIndex = ReactionHelper.emojiToIndex(emoji);
if (emojiIndex == null) return; // Unknown emoji, skip
final timestampSecs = message.timestamp.millisecondsSinceEpoch ~/ 1000;
final hash = ReactionHelper.computeReactionHash(
timestampSecs,
message.senderName,
message.text,
);
final hash = message.computeReactionHash();
final reactionText = ReactionHelper.encodeReaction(hash, emojiIndex);
connector.sendChannelMessage(widget.channel, reactionText);
}
+12
View File
@@ -1533,6 +1533,7 @@ class _ChannelsScreenState extends State<ChannelsScreen>
final pskController = TextEditingController(text: channel.pskHex);
bool smazEnabled = connector.isChannelSmazEnabled(channel.index);
bool cyr2latEnabled = connector.isChannelCyr2LatEnabled(channel.index);
bool urlImagesEnabled = connector.isChannelUrlImagesEnabled(channel.index);
String? selectedCyr2LatProfileId = connector.getChannelCyr2LatProfileId(
channel.index,
);
@@ -1635,6 +1636,13 @@ class _ChannelsScreenState extends State<ChannelsScreen>
),
),
],
SwitchListTile(
contentPadding: EdgeInsets.zero,
title: Text(sheetContext.l10n.urlImage_enable),
value: urlImagesEnabled,
onChanged: (value) =>
setSheetState(() => urlImagesEnabled = value),
),
const SizedBox(height: 24),
],
),
@@ -1684,6 +1692,10 @@ class _ChannelsScreenState extends State<ChannelsScreen>
channel.index,
cyr2latEnabled,
);
await connector.setChannelUrlImagesEnabled(
channel.index,
urlImagesEnabled,
);
await connector.setChannelCyr2LatProfileId(
channel.index,
selectedCyr2LatProfileId,
+133 -23
View File
@@ -7,11 +7,13 @@ import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import '../utils/app_logger.dart';
import '../utils/platform_info.dart';
import '../connector/meshcore_connector.dart';
import '../connector/meshcore_protocol.dart';
import '../helpers/cyr2lat.dart';
import '../helpers/message_url_image_helper.dart';
import '../helpers/path_helper.dart';
import '../helpers/reaction_helper.dart';
import '../widgets/message_status_icon.dart';
@@ -477,10 +479,26 @@ class _ChatScreenState extends State<ChatScreen> {
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
IconButton(
icon: const Icon(Icons.gif_box),
onPressed: () => _showGifPicker(context),
tooltip: context.l10n.chat_sendGif,
PopupMenuButton<String>(
icon: const Icon(Icons.add_circle_outline),
position: PopupMenuPosition.over,
offset: const Offset(0, -64),
tooltip: context.l10n.chat_selectSendAction,
onSelected: (action) {
if (action == 'gif') _showGifPicker(context);
},
itemBuilder: (context) => [
PopupMenuItem(
value: 'gif',
child: Row(
children: [
const Icon(Icons.gif_box),
const SizedBox(width: 12),
Text(context.l10n.chat_sendGif),
],
),
),
],
),
if (settings.translationEnabled)
MessageTranslationButton(
@@ -878,6 +896,9 @@ class _ChatScreenState extends State<ChatScreen> {
bool cyr2latEnabled = connector.isContactCyr2LatEnabled(
contact.publicKeyHex,
);
bool urlImagesEnabled = connector.isContactUrlImagesEnabled(
contact.publicKeyHex,
);
String? selectedCyr2LatProfileId = connector.getContactCyr2LatProfileId(
contact.publicKeyHex,
);
@@ -977,6 +998,19 @@ class _ChatScreenState extends State<ChatScreen> {
),
],
const Divider(height: 8),
SwitchListTile(
contentPadding: EdgeInsets.zero,
title: Text(context.l10n.urlImage_enable),
value: urlImagesEnabled,
onChanged: (value) {
connector.setContactUrlImagesEnabled(
contact.publicKeyHex,
value,
);
setDialogState(() => urlImagesEnabled = value);
},
),
const Divider(height: 8),
SwitchListTile(
contentPadding: EdgeInsets.zero,
title: Text(context.l10n.contact_teleBase),
@@ -1281,6 +1315,7 @@ class _ChatScreenState extends State<ChatScreen> {
final senderName = liveContact.type == advTypeRoom
? senderContact.name
: null;
appLogger.info('Sending reaction using senderName: $senderName');
final hash = ReactionHelper.computeReactionHash(
timestampSecs,
senderName,
@@ -1317,6 +1352,9 @@ class _MessageBubble extends StatelessWidget {
final gifId = GifHelper.parseGif(message.text);
final poi = parseMarkerText(message.text);
final isFailed = message.status == MessageStatus.failed;
final urlImagesEnabled = context.select<MeshCoreConnector, bool>(
(connector) => connector.isContactUrlImagesEnabled(sourceId),
);
// Bubble colors — outgoing uses MeshPalette.me / meBorder / meInk.
final bubbleColor = isFailed
@@ -1364,6 +1402,30 @@ class _MessageBubble extends StatelessWidget {
? message.originalText
: (translatedDisplayText != messageText ? messageText : null);
Widget buildTextContent() {
return Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Flexible(
child: TranslatedMessageContent(
displayText: translatedDisplayText,
originalText: originalDisplayText,
style: TextStyle(
color: textColor,
fontSize: bodyFontSize * textScale,
),
originalStyle: TextStyle(
color: textColor.withValues(alpha: 0.72),
fontSize: bodyFontSize * textScale,
),
onSecondaryTap: PlatformInfo.isDesktop ? onLongPress : null,
),
),
],
);
}
return Padding(
padding: const EdgeInsets.symmetric(vertical: 3),
child: Column(
@@ -1451,28 +1513,76 @@ class _MessageBubble extends StatelessWidget {
),
],
)
else if (urlImagesEnabled)
MessageUrlImageFutureBuilder(
messageId: message.messageId,
text: message.text,
builder: (context, snapshot) {
final imageAttachment = snapshot.data;
if (imageAttachment != null) {
return Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.symmetric(
vertical: 4,
),
child: Align(
alignment: isOutgoing
? Alignment.centerRight
: Alignment.centerLeft,
child: MessageUrlImagePreview(
imageUrl: imageAttachment,
),
),
),
Padding(
padding: const EdgeInsets.only(top: 8),
child: TranslatedMessageContent(
displayText: translatedDisplayText,
originalText: originalDisplayText,
style: TextStyle(
color: textColor,
fontSize: bodyFontSize * textScale,
),
originalStyle: TextStyle(
color: textColor.withValues(
alpha: 0.72,
),
fontSize: bodyFontSize * textScale,
),
onSecondaryTap: PlatformInfo.isDesktop
? onLongPress
: null,
),
),
],
);
}
return buildTextContent();
},
)
else
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: TranslatedMessageContent(
displayText: translatedDisplayText,
originalText: originalDisplayText,
style: TextStyle(
color: textColor,
fontSize: bodyFontSize * textScale,
if (MessageUrlImageHelper.hasPotentialImageUrl(
message.text,
))
Padding(
padding: const EdgeInsets.only(bottom: 4),
child: Text(
context.l10n.urlImage_possible,
style: TextStyle(
color: metaColor,
fontSize: 11 * textScale,
),
),
originalStyle: TextStyle(
color: textColor.withValues(alpha: 0.72),
fontSize: bodyFontSize * textScale,
),
onSecondaryTap: PlatformInfo.isDesktop
? onLongPress
: null,
),
),
buildTextContent(),
],
),
if (enableTracing &&
@@ -1654,7 +1764,7 @@ class _MessageBubble extends StatelessWidget {
runSpacing: 6,
children: message.reactions.entries.map((entry) {
final emoji = entry.key;
final count = entry.value;
final count = entry.value.length;
final status = message.reactionStatuses[emoji];
final isPending =
status == MessageStatus.pending || status == MessageStatus.sent;
+28 -4
View File
@@ -1,5 +1,6 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:meshcore_open/utils/gpx_export.dart';
import 'package:meshcore_open/widgets/elements_ui.dart';
import 'package:provider/provider.dart';
@@ -299,12 +300,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
value: connector.selfName!,
),
if (connector.selfPublicKey != null)
_infoRow(
_publicKeyRow(
context,
label: l10n.settings_infoPublicKey,
value:
'${pubKeyToHex(connector.selfPublicKey!).substring(0, 16)}...',
mono: true,
publicKeyHex: pubKeyToHex(connector.selfPublicKey!),
),
_infoRow(
context,
@@ -325,6 +324,31 @@ class _SettingsScreenState extends State<SettingsScreen> {
);
}
/// Copies the key rendered in the row, not whatever the connector holds when
/// the tap lands: a disconnect in between clears `selfPublicKey`.
Widget _publicKeyRow(
BuildContext context, {
required String label,
required String publicKeyHex,
}) {
return _infoRow(
context,
label: label,
value: publicKeyHex,
mono: true,
onTap: () => _copyPublicKey(context, publicKeyHex),
);
}
Future<void> _copyPublicKey(BuildContext context, String publicKeyHex) async {
await Clipboard.setData(ClipboardData(text: publicKeyHex));
if (!context.mounted) return;
showDismissibleSnackBar(
context,
content: Text(context.l10n.settings_publicKeyCopied),
);
}
Widget _infoRow(
BuildContext context, {
required String label,
+74
View File
@@ -3,7 +3,9 @@ import 'dart:ui';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import '../helpers/message_url_image_helper.dart';
import '../helpers/reaction_helper.dart';
import '../l10n/app_localizations.dart';
import '../utils/platform_info.dart';
@@ -196,14 +198,40 @@ class NotificationService {
return text;
}
Future<String?> _resolveNotificationImagePath(
String text, {
required bool urlImagesEnabled,
}) async {
if (!urlImagesEnabled) return null;
final imageUrl = await MessageUrlImageHelper.parseVerified(text);
if (imageUrl == null) return null;
try {
// Cache the image so notification platforms can read it from disk.
final imageFile = await DefaultCacheManager().getSingleFile(imageUrl);
if (!imageFile.existsSync()) return null;
return imageFile.path;
} catch (e) {
debugPrint('Failed to resolve notification image: $e');
return null;
}
}
Future<void> _showMessageNotificationImpl({
required String contactName,
required String message,
required bool urlImagesEnabled,
String? contactId,
int? badgeCount,
}) async {
if (!await _ensureCanNotify()) return;
final imagePath = await _resolveNotificationImagePath(
message,
urlImagesEnabled: urlImagesEnabled,
);
final androidDetails = AndroidNotificationDetails(
'messages',
'Messages',
@@ -212,6 +240,12 @@ class NotificationService {
priority: Priority.high,
icon: '@mipmap/ic_launcher',
number: badgeCount,
styleInformation: imagePath != null
? BigPictureStyleInformation(
FilePathAndroidBitmap(imagePath),
summaryText: formatNotificationText(message),
)
: null,
);
final iosDetails = DarwinNotificationDetails(
@@ -219,6 +253,11 @@ class NotificationService {
presentBadge: true,
presentSound: true,
badgeNumber: badgeCount,
attachments: imagePath != null
? <DarwinNotificationAttachment>[
DarwinNotificationAttachment(imagePath),
]
: null,
);
final macDetails = DarwinNotificationDetails(
@@ -226,6 +265,11 @@ class NotificationService {
presentBadge: true,
presentSound: true,
badgeNumber: badgeCount,
attachments: imagePath != null
? <DarwinNotificationAttachment>[
DarwinNotificationAttachment(imagePath),
]
: null,
);
final notificationDetails = NotificationDetails(
@@ -299,11 +343,17 @@ class NotificationService {
Future<void> _showChannelMessageNotificationImpl({
required String channelName,
required String message,
required bool urlImagesEnabled,
int? channelIndex,
int? badgeCount,
}) async {
if (!await _ensureCanNotify()) return;
final imagePath = await _resolveNotificationImagePath(
message,
urlImagesEnabled: urlImagesEnabled,
);
final androidDetails = AndroidNotificationDetails(
'channel_messages',
'Channel Messages',
@@ -312,6 +362,12 @@ class NotificationService {
priority: Priority.high,
icon: '@mipmap/ic_launcher',
number: badgeCount,
styleInformation: imagePath != null
? BigPictureStyleInformation(
FilePathAndroidBitmap(imagePath),
summaryText: formatNotificationText(message),
)
: null,
);
final iosDetails = DarwinNotificationDetails(
@@ -319,6 +375,11 @@ class NotificationService {
presentBadge: true,
presentSound: true,
badgeNumber: badgeCount,
attachments: imagePath != null
? <DarwinNotificationAttachment>[
DarwinNotificationAttachment(imagePath),
]
: null,
);
final macDetails = DarwinNotificationDetails(
@@ -326,6 +387,11 @@ class NotificationService {
presentBadge: true,
presentSound: true,
badgeNumber: badgeCount,
attachments: imagePath != null
? <DarwinNotificationAttachment>[
DarwinNotificationAttachment(imagePath),
]
: null,
);
final notificationDetails = NotificationDetails(
@@ -448,6 +514,7 @@ class NotificationService {
Future<void> showMessageNotification({
required String contactName,
required String message,
required bool urlImagesEnabled,
String? contactId,
int? badgeCount,
}) async {
@@ -458,6 +525,7 @@ class NotificationService {
type: _NotificationType.message,
title: contactName,
body: message,
urlImagesEnabled: urlImagesEnabled,
id: contactId,
badgeCount: badgeCount,
),
@@ -485,6 +553,7 @@ class NotificationService {
required String channelName,
required String senderName,
required String message,
required bool urlImagesEnabled,
int? channelIndex,
int? badgeCount,
}) async {
@@ -495,6 +564,7 @@ class NotificationService {
type: _NotificationType.channelMessage,
title: channelName,
body: '$senderName: $message',
urlImagesEnabled: urlImagesEnabled,
id: channelIndex?.toString(),
badgeCount: badgeCount,
),
@@ -556,6 +626,7 @@ class NotificationService {
await _showMessageNotificationImpl(
contactName: notification.title,
message: notification.body,
urlImagesEnabled: notification.urlImagesEnabled,
contactId: notification.id,
badgeCount: notification.badgeCount,
);
@@ -571,6 +642,7 @@ class NotificationService {
await _showChannelMessageNotificationImpl(
channelName: notification.title,
message: notification.body,
urlImagesEnabled: notification.urlImagesEnabled,
channelIndex: int.tryParse(notification.id ?? ''),
badgeCount: notification.badgeCount,
);
@@ -647,6 +719,7 @@ class _PendingNotification {
final _NotificationType type;
final String title;
final String body;
final bool urlImagesEnabled;
final String? id;
final int? badgeCount;
@@ -654,6 +727,7 @@ class _PendingNotification {
required this.type,
required this.title,
required this.body,
this.urlImagesEnabled = false,
this.id,
this.badgeCount,
});
@@ -4,6 +4,16 @@ import '../models/path_selection.dart';
import '../connector/meshcore_connector.dart';
import '../connector/meshcore_protocol.dart';
/// Companion firmware (MeshCore commit 4a869163, 2025-12-30) replaces the CLI
/// frame timestamp with the companion node's RTC for TXT_TYPE_CLI_DATA, so a
/// plain "clock sync" sets the repeater clock to the node clock. The official
/// meshcore-cli translates it to an explicit `time <epoch>` command instead;
/// do the same so the repeater always gets the phone's time.
String normalizeRepeaterClockSyncCommand(String command, {int? nowSeconds}) {
final epoch = nowSeconds ?? DateTime.now().millisecondsSinceEpoch ~/ 1000;
return command.trim().toLowerCase() == 'clock sync' ? 'time $epoch' : command;
}
class RepeaterCommandService {
final MeshCoreConnector _connector;
final Map<String, Completer<String>> _pendingCommands = {};
@@ -25,6 +35,7 @@ class RepeaterCommandService {
Function(int)? onAttempt,
int retries = maxRetries,
}) async {
command = normalizeRepeaterClockSyncCommand(command);
final attemptCount = retries < 1 ? 1 : retries;
final selection = await _connector.preparePathForContactSend(repeater);
+6 -1
View File
@@ -195,7 +195,12 @@ class ChannelMessageStore {
replyToText: json['replyToText'] as String?,
reactions:
(json['reactions'] as Map<String, dynamic>?)?.map(
(key, value) => MapEntry(key, value as int),
(key, value) => MapEntry(
key,
(value is int)
? List<String?>.filled(value, null)
: List<String?>.from(value),
),
) ??
{},
);
+27
View File
@@ -4,6 +4,7 @@ import 'prefs_manager.dart';
class ChannelSettingsStore {
static const String _keyPrefix = 'channel_smaz_';
static const String _cyr2latKeyPrefix = 'channel_cyr2lat_';
static const String _urlImagesKeyPrefix = 'channel_url_images_';
String publicKeyHex = '';
set setPublicKeyHex(String value) =>
@@ -11,6 +12,7 @@ class ChannelSettingsStore {
String get keyFor => '$_keyPrefix$publicKeyHex';
String get keyForCyr2Lat => '$_cyr2latKeyPrefix$publicKeyHex';
String get keyForUrlImages => '$_urlImagesKeyPrefix$publicKeyHex';
Future<bool> loadSmazEnabled(int channelIndex) async {
if (publicKeyHex.isEmpty) {
@@ -73,6 +75,31 @@ class ChannelSettingsStore {
await prefs.setBool(key, enabled);
}
Future<bool> loadUrlImagesEnabled(int channelIndex) async {
if (publicKeyHex.isEmpty) {
appLogger.warn(
'Public key hex is not set. Cannot load channel URL image settings.',
);
return false;
}
final prefs = PrefsManager.instance;
final key = '$keyForUrlImages$channelIndex';
return prefs.getBool(key) ?? false;
}
Future<void> saveUrlImagesEnabled(int channelIndex, bool enabled) async {
if (publicKeyHex.isEmpty) {
appLogger.warn(
'Public key hex is not set. Cannot save channel URL image settings.',
);
return;
}
await PrefsManager.instance.setBool(
'$keyForUrlImages$channelIndex',
enabled,
);
}
Future<String?> loadCyr2LatProfileId(int channelIndex) async {
if (publicKeyHex.isEmpty) {
appLogger.warn(
+27
View File
@@ -4,6 +4,7 @@ import 'prefs_manager.dart';
class ContactSettingsStore {
static const String _keyPrefix = 'contact_smaz_';
static const String _cyr2latKeyPrefix = 'contact_cyr2lat_';
static const String _urlImagesKeyPrefix = 'contact_url_images_';
String publicKeyHex = '';
set setPublicKeyHex(String value) =>
@@ -11,6 +12,7 @@ class ContactSettingsStore {
String get keyFor => '$_keyPrefix$publicKeyHex';
String get keyForCyr2Lat => '$_cyr2latKeyPrefix$publicKeyHex';
String get keyForUrlImages => '$_urlImagesKeyPrefix$publicKeyHex';
Future<bool> loadSmazEnabled(String contactKeyHex) async {
if (publicKeyHex.isEmpty) {
@@ -73,6 +75,31 @@ class ContactSettingsStore {
await prefs.setBool(key, enabled);
}
Future<bool> loadUrlImagesEnabled(String contactKeyHex) async {
if (publicKeyHex.isEmpty) {
appLogger.warn(
'Public key hex is not set. Cannot load contact URL image settings.',
);
return false;
}
final prefs = PrefsManager.instance;
final key = '$keyForUrlImages$contactKeyHex';
return prefs.getBool(key) ?? false;
}
Future<void> saveUrlImagesEnabled(String contactKeyHex, bool enabled) async {
if (publicKeyHex.isEmpty) {
appLogger.warn(
'Public key hex is not set. Cannot save contact URL image settings.',
);
return;
}
await PrefsManager.instance.setBool(
'$keyForUrlImages$contactKeyHex',
enabled,
);
}
Future<String?> loadCyr2LatProfileId(String contactKeyHex) async {
if (publicKeyHex.isEmpty) {
appLogger.warn(
+6 -1
View File
@@ -171,7 +171,12 @@ class MessageStore {
pathBytes: decodedPathBytes,
reactions:
(json['reactions'] as Map<String, dynamic>?)?.map(
(key, value) => MapEntry(key, value as int),
(key, value) => MapEntry(
key,
(value is int)
? List<String?>.filled(value, null)
: List<String?>.from(value),
),
) ??
{},
reactionStatuses:
+23 -2
View File
@@ -7,6 +7,7 @@ import 'dart:io';
import '../utils/platform_info.dart';
import 'package:share_plus/share_plus.dart';
import 'package:file_selector/file_selector.dart';
class ContactExport {
final String name;
@@ -161,7 +162,6 @@ class GpxExport {
final xml = GpxWriter().asString(gpx, pretty: true);
// 2. Save to file
final dir = await getApplicationDocumentsDirectory();
final timestamp = DateTime.now()
.toUtc()
.toIso8601String()
@@ -169,8 +169,29 @@ class GpxExport {
.replaceAll('.', '-')
.split('T')
.join('_');
final suggestedName = '$filename$timestamp.gpx';
final path = '${dir.path}/$filename$timestamp.gpx';
// share_plus cannot share files on desktop: Linux throws outright
// ("Sharing files not supported on Linux") and Windows only supports it
// from build 10.0.17763 up. Desktops have a real file system and a save
// dialog, so write the file where the user asks instead of sharing it.
if (PlatformInfo.isDesktop) {
final location = await getSaveLocation(
suggestedName: suggestedName,
acceptedTypeGroups: const [
XTypeGroup(label: 'GPX', extensions: ['gpx']),
],
);
if (location == null) {
debugPrint('Save dialog was dismissed / cancelled by user.');
return gpxExportCancelled;
}
await File(location.path).writeAsString(xml);
return gpxExportSuccess;
}
final dir = await getApplicationDocumentsDirectory();
final path = '${dir.path}/$suggestedName';
final file = File(path);
await file.writeAsString(xml);
-25
View File
@@ -1,25 +0,0 @@
import 'package:flutter/material.dart';
import '../l10n/l10n.dart';
class ImageSendButton extends StatelessWidget {
final bool enabled;
final VoidCallback onPressed;
final String? tooltip;
const ImageSendButton({
super.key,
required this.enabled,
required this.onPressed,
this.tooltip,
});
@override
Widget build(BuildContext context) {
return IconButton(
icon: Icon(enabled ? Icons.image : Icons.image_outlined),
onPressed: enabled ? onPressed : null,
tooltip: tooltip ?? context.l10n.chat_sendImage,
);
}
}
+5 -1
View File
@@ -7,6 +7,7 @@ import '../l10n/l10n.dart';
import '../models/contact.dart';
import '../l10n/contact_localization.dart';
import '../services/storage_service.dart';
import '../services/repeater_command_service.dart';
import '../connector/meshcore_connector.dart';
import '../connector/meshcore_protocol.dart';
import '../theme/mesh_theme.dart';
@@ -201,7 +202,10 @@ class _RepeaterLoginDialogState extends State<RepeaterLoginDialog> {
await _connector.sendFrame(
buildSendCliCommandFrame(
repeater.publicKey,
'clock sync',
normalizeRepeaterClockSyncCommand(
'clock sync',
nowSeconds: timestampSeconds,
),
timestampSeconds: timestampSeconds,
),
);
+2 -1
View File
@@ -42,7 +42,7 @@ dependencies:
flserial:
git:
url: https://github.com/MeshEnvy/flserial.git
ref: 48216310061efc8d5d217cc18014fc2cb501646e
ref: e1864de9b65cda9656dba804329bdd2890dd5a92
provider: ^6.1.5+1
shared_preferences: ^2.2.2
uuid: ^4.3.3
@@ -83,6 +83,7 @@ dependencies:
# the abiFilters note in android/app/build.gradle.kts; a universal APK pays
# ~56 MB for ORT instead of ~18 MB.
flutter_onnxruntime: ^1.8.3
base32: ^2.2.0
hooks:
user_defines:
@@ -0,0 +1,108 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:http/http.dart' as http;
import 'package:http/testing.dart';
import 'package:meshcore_open/helpers/message_url_image_helper.dart';
void main() {
group('MessageUrlImageHelper', () {
tearDown(() => MessageUrlImageHelper.httpClient = null);
void mockPyxPage(String id) {
MessageUrlImageHelper.httpClient = MockClient((request) async {
expect(request.url.toString(), 'https://pyx.li/?i=$id');
return http.Response(
'<html><body><img src="/i/$id.jpg"></body></html>',
200,
headers: {'content-type': 'text/html; charset=utf-8'},
);
});
}
test('parses short pyx ids', () async {
mockPyxPage('RzmdkTsE');
final attachment = await MessageUrlImageHelper.parse(
'my picture: https://pyx.li/?i=RzmdkTsE text',
);
expect(attachment, 'https://pyx.li/i/RzmdkTsE.jpg');
});
test('parses direct pyx image urls', () async {
mockPyxPage('Cd1KFiwu');
final attachment = await MessageUrlImageHelper.parse(
'https://pyx.li/?i=Cd1KFiwu',
);
expect(attachment, 'https://pyx.li/i/Cd1KFiwu.jpg');
});
test('parses provider-hosted ipfs links', () async {
final attachment = await MessageUrlImageHelper.parse(
'my picture: https://uneven-plum-tarantula.myfilebase.com/ipfs/bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text',
);
expect(attachment, isNotNull);
expect(
attachment,
'https://uneven-plum-tarantula.myfilebase.com/ipfs/bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly',
);
});
test('parses direct ipfs cid urls', () async {
final attachment = await MessageUrlImageHelper.parse(
'my picture: ipfs://bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text',
);
expect(attachment, isNotNull);
expect(
attachment,
'https://ipfs.io/ipfs/bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly',
);
});
test('parses direct ipfs cid urls without double slashes', () async {
final attachment = await MessageUrlImageHelper.parse(
'my picture: ipfs:bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly text',
);
expect(
attachment,
'https://ipfs.io/ipfs/bafybeibq75ws6nwk6wi473dch42wwy6woyj4dwdfy7nfz3buqx2caieoly',
);
});
test('parses http image urls', () async {
final attachment = await MessageUrlImageHelper.parse(
'see this image https://example.com/picture.png?size=large additional text',
);
expect(attachment, isNotNull);
expect(attachment, 'https://example.com/picture.png?size=large');
});
test('returns null for plain text', () async {
expect(await MessageUrlImageHelper.parse('hello world'), isNull);
});
test('detects supported image URLs without resolving them', () {
expect(
MessageUrlImageHelper.hasPotentialImageUrl(
'https://pyx.li/?i=RzmdkTsE',
),
isTrue,
);
expect(
MessageUrlImageHelper.hasPotentialImageUrl('hello world'),
isFalse,
);
});
test('returns null for non-image ipfs gateway URL', () async {
final attachment = await MessageUrlImageHelper.parseVerified(
'https://lime-famous-rat-748.mypinata.cloud/ipfs/bafybeih3jqv36rsxqx7yw3k3ixhganrevrk7xmcxgkr2zuzjegxdytb3nq',
);
expect(attachment, isNull);
});
});
}
+157
View File
@@ -1,3 +1,4 @@
import 'package:characters/characters.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/helpers/reaction_helper.dart';
import 'package:meshcore_open/widgets/emoji_picker.dart';
@@ -340,6 +341,162 @@ void main() {
});
});
group('MeshCoreOne Reactions', () {
test('emoji validation sanity checks', () {
// This is more a test of expectations than of app code, but it was
// a good place to get this sorted out cleanly, and I leave it for
// anyone interested in understanding the emoji validation and tests.
expect('🥳'.length, equals(2));
expect('\u{1f44c}\u{1f3ff}'.length, equals(4));
final oneChar = RegExp(r'^(.)$');
final twoChar = RegExp(r'^(..)$');
expect(oneChar.firstMatch('🥳'), isNull);
expect(oneChar.firstMatch('\u{1F642}'), isNull);
expect(oneChar.firstMatch('\u{1f44c}\u{1f3ff}'), isNull);
expect(twoChar.firstMatch('\u{1f44c}\u{1f3ff}'), isNull);
final regex = RegExp(r'^(.{1,4})$');
expect(regex.firstMatch('🥳'), isNotNull);
expect(regex.firstMatch('😀'), isNotNull);
expect(regex.firstMatch('\u{1F642}'), isNotNull);
expect(regex.firstMatch('\u{1f44c}\u{1f3ff}'), isNotNull);
expect(Characters('🥳').length, equals(1));
expect(Characters('\u{1F642}').length, equals(1));
expect(Characters('\u{1F642}').length, equals(1));
expect(Characters('\u{1f44c}\u{1f3ff}').length, equals(1));
expect(Characters('🧑‍🧑‍🧒‍🧒').length, equals(1));
});
test('parse MeshCoreOne reaction', () {
final emoji = '🥳';
final senderName = 'entropy 📓';
final hash = 'b3je6qf7';
final info = ReactionHelper.parseReactionMC1(
'@[$senderName]$emoji\n$hash',
);
expect(info, isNotNull);
expect(info!.targetHash, equals('$hash:$senderName'));
expect(info.emoji, equals(emoji));
List<String> messages = [
'🥳\n01234567',
'@[entropy]🥳\n01234567',
'\u{1f44c}\u{1f3ff}\n01234567',
'@[entropy]\u{1f44c}\u{1f3ff}\n01234567',
'@[entropy]🧑‍🧑‍🧒\n01234567', // long composite emoji - 21 bytes
'🧑‍🧑‍🧒‍🧒\n01234567', // long composite emoji - 25 bytes
];
for (String txt in messages) {
final info = ReactionHelper.parseReactionMC1(txt);
expect(info, isNotNull, reason: "$txt did not parse");
}
});
test('parse MeshCoreOne reaction - avoid false positives', () {
List<String> messages = [
'test\nabcdefgh',
'🥳\nhashistoolong',
'🥳\nshort',
'🥳🥳\n01234567', // two emojis not composed into one grapheme
'X\n01234567',
'🥳\nabcuuxyz', // u is not valid as we don't support checksums
];
for (String txt in messages) {
final info = ReactionHelper.parseReactionMC1(txt);
expect(info, isNull, reason: "$txt should not have parsed");
}
});
test('parse MeshCoreOne reaction - Legacy format', () {
final emoji = '🥳';
final senderName = 'entropy 📓';
final hash = 'b3je6qf7';
final info = ReactionHelper.parseReactionMC1Legacy(
'$emoji@[$senderName]\n$hash',
);
expect(info, isNotNull);
expect(info!.targetHash, equals('$hash:$senderName'));
expect(info.emoji, equals(emoji));
List<String> messages = [
'🥳\n01234567',
'🥳@[entropy]\n01234567',
'\u{1f44c}\u{1f3ff}\n01234567',
'\u{1f44c}\u{1f3ff}@[entropy]\n01234567',
'🧑‍🧑‍🧒@[entropy]\n01234567', // long composite emoji - 21 bytes
'🧑‍🧑‍🧒‍🧒\n01234567', // long composite emoji - 25 bytes
];
for (String txt in messages) {
final info = ReactionHelper.parseReactionMC1Legacy(txt);
expect(info, isNotNull, reason: "$txt did not parse");
}
});
test(
'parse MeshCoreOne reaction - Legacy format - avoid false positives',
() {
List<String> messages = [
'test\nabcdefgh',
'🥳\nhashistoolong',
'🥳\nshort',
'🥳🥳\n01234567', // two emojis not composed into one grapheme
'X\n01234567',
'🥳\nabcuuxyz', // u is not valid as we don't support checksums
];
for (String txt in messages) {
final info = ReactionHelper.parseReactionMC1Legacy(txt);
expect(info, isNull, reason: "$txt should not have parsed");
}
},
);
test('parse MeshCoreOne reaction - main entry', () {
final emoji = '🥳';
final senderName = 'entropy 📓';
final hash = 'b3je6qf7';
final info = ReactionHelper.parseReaction(
'@[$senderName]$emoji\n$hash',
);
expect(info, isNotNull);
expect(info!.targetHash, equals('$hash:$senderName'));
expect(info.emoji, equals(emoji));
});
test('parse MeshCoreOne reaction Legacy format - main entry', () {
final emoji = '🥳';
final senderName = 'entropy 📓';
final hash = 'b3je6qf7';
final info = ReactionHelper.parseReaction(
'$emoji@[$senderName]\n$hash',
);
expect(info, isNotNull);
expect(info!.targetHash, equals('$hash:$senderName'));
expect(info.emoji, equals(emoji));
});
test('parse MeshCoreOne reaction for DM chats', () {
final emoji = '🥳';
final hash = 'b3je6qf7';
final info = ReactionHelper.parseReaction('$emoji\n$hash');
expect(info, isNotNull);
expect(info!.targetHash, equals('$hash:'));
expect(info.emoji, equals(emoji));
});
test('computeq MeshCoreOne reaction hash', () {
const timestamp = 1234567890;
const senderName = 'Alice';
const messageText = 'Hello world!';
final hash = ReactionHelper.computeReactionHashMC1(
timestamp,
senderName,
messageText,
);
expect(hash, equals('tyvbkb33'));
});
});
group('full reaction flow', () {
test('should encode and decode reaction correctly', () {
// Simulate sending a reaction
@@ -0,0 +1,46 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/services/repeater_command_service.dart';
void main() {
group('normalizeRepeaterClockSyncCommand', () {
test('translates "clock sync" to explicit time command', () {
final result = normalizeRepeaterClockSyncCommand(
'clock sync',
nowSeconds: 1787900000,
);
expect(result, 'time 1787900000');
});
test('is case-insensitive and tolerates surrounding whitespace', () {
expect(
normalizeRepeaterClockSyncCommand(' Clock Sync ', nowSeconds: 1),
'time 1',
);
});
test('passes other commands through unchanged', () {
expect(
normalizeRepeaterClockSyncCommand('clock', nowSeconds: 1),
'clock',
);
expect(
normalizeRepeaterClockSyncCommand('get radio', nowSeconds: 1),
'get radio',
);
expect(
normalizeRepeaterClockSyncCommand('time 123', nowSeconds: 1),
'time 123',
);
});
test('uses current time when nowSeconds is omitted', () {
final before = DateTime.now().millisecondsSinceEpoch ~/ 1000;
final result = normalizeRepeaterClockSyncCommand('clock sync');
final after = DateTime.now().millisecondsSinceEpoch ~/ 1000;
expect(result, startsWith('time '));
final epoch = int.parse(result.substring('time '.length));
expect(epoch, inInclusiveRange(before, after));
});
});
}
+116 -1
View File
@@ -1 +1,116 @@
{}
{
"bg": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
],
"de": [
"settings_publicKeyCopied",
"reaction_report"
],
"es": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
],
"fr": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
],
"hu": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
],
"it": [
"urlImage_enable",
"urlImage_possible",
"reaction_report"
],
"ja": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
],
"ko": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
],
"nl": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
],
"pl": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
],
"pt": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
],
"ru": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
],
"sk": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
],
"sl": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
],
"sv": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied"
],
"uk": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
],
"zh": [
"urlImage_enable",
"urlImage_possible",
"settings_publicKeyCopied",
"reaction_report"
]
}