Merge branch 'dev' into ez_bookmark
This commit is contained in:
49 files changed
+3932
-149
No files matched your search
@@ -30,11 +30,14 @@ import '../services/linux_ble_pairing_service_stub.dart'
|
||||
if (dart.library.io) '../services/linux_ble_pairing_service.dart';
|
||||
import '../services/image_chunk_transport.dart'
|
||||
show
|
||||
ImageChunkHeader,
|
||||
ImageChunkOutcome,
|
||||
ImageChunkTransport,
|
||||
buildSendChannelDataFrame,
|
||||
dataTypeAeicImage,
|
||||
kImageReassemblyTtl,
|
||||
outPathUnknown,
|
||||
parseImageChunkHeader,
|
||||
respCodeChannelDataRecv,
|
||||
senderPrefixFromKey;
|
||||
import '../services/image_codec_service.dart';
|
||||
@@ -2196,6 +2199,8 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> reloadChannelOrder() => _loadChannelOrder();
|
||||
|
||||
/// History is stored by channel ID, so it may carry the slot the channel
|
||||
/// sat in when it was saved; rebind it to the slot it is shown in now.
|
||||
List<ChannelMessage> _bindToSlot(List<ChannelMessage> messages, int slot) => [
|
||||
@@ -5777,7 +5782,9 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
/// queued a packet to the radio. It says nothing about transmission or
|
||||
/// delivery — GRP_DATA is unacknowledged flood traffic, there is no
|
||||
/// PUSH_CODE_SEND_CONFIRMED for it, and a chunk may still be lost on air.
|
||||
/// That is what the XOR parity chunk is for.
|
||||
/// That is what the XOR parity chunk is for, and why repeater echoes are
|
||||
/// counted afterwards ([ownImageEchoes]). With [repairUnheardChunks], chunks
|
||||
/// no repeater echoed are resent once (see [_repairUnheardImageChunks]).
|
||||
///
|
||||
/// Returns false when the transport is unavailable (disconnected or firmware
|
||||
/// too old); throws whatever [_sendFrameAndWaitForCommandAck] throws, i.e.
|
||||
@@ -5790,9 +5797,47 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
required int channelIndex,
|
||||
required Duration interChunkDelay,
|
||||
void Function(int sent, int total)? onProgress,
|
||||
bool repairUnheardChunks = true,
|
||||
}) async {
|
||||
if (blobs.isEmpty) return false;
|
||||
if (!supportsChannelData) return false;
|
||||
final header = parseImageChunkHeader(blobs.first);
|
||||
final key = header == null ? null : (channelIndex, header.imgId);
|
||||
if (key != null && repairUnheardChunks) {
|
||||
// Index == chunk index: data chunks first, the parity chunk (index ==
|
||||
// total) last, so blobs.length slots cover every chunk we send.
|
||||
_ownImageEchoes.remove(key);
|
||||
_ownImageEchoes[key] = List<int>.filled(blobs.length, 0);
|
||||
while (_ownImageEchoes.length > _maxTrackedOwnImages) {
|
||||
_ownImageEchoes.remove(_ownImageEchoes.keys.first);
|
||||
}
|
||||
}
|
||||
final startedAt = DateTime.now();
|
||||
final sentAll = await _transmitImageBlobs(
|
||||
blobs,
|
||||
channelIndex: channelIndex,
|
||||
interChunkDelay: interChunkDelay,
|
||||
onProgress: onProgress,
|
||||
);
|
||||
if (sentAll && key != null && repairUnheardChunks) {
|
||||
unawaited(
|
||||
_repairUnheardImageChunks(
|
||||
key,
|
||||
blobs,
|
||||
interChunkDelay: interChunkDelay,
|
||||
startedAt: startedAt,
|
||||
),
|
||||
);
|
||||
}
|
||||
return sentAll;
|
||||
}
|
||||
|
||||
Future<bool> _transmitImageBlobs(
|
||||
List<Uint8List> blobs, {
|
||||
required int channelIndex,
|
||||
required Duration interChunkDelay,
|
||||
void Function(int sent, int total)? onProgress,
|
||||
}) async {
|
||||
// `return` inside the scoped callback only exits the callback, so a
|
||||
// disconnect mid-send used to fall through to `return true` below and the
|
||||
// caller would record a complete outgoing image and tell the user "sent"
|
||||
@@ -5823,6 +5868,142 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
return sentAll;
|
||||
}
|
||||
|
||||
// ---- repeater echoes of our own image chunks -------------------------------
|
||||
//
|
||||
// GRP_DATA is never acknowledged. What we can observe is a repeater
|
||||
// re-flooding one of our chunks: the radio reports it in the raw RX log, the
|
||||
// same way repeats of channel text are counted. A chunk nobody echoed while
|
||||
// other chunks of the same image were echoed was most likely lost, so it is
|
||||
// sent once more.
|
||||
|
||||
/// How long to listen for echoes after the last chunk before repairing.
|
||||
static const Duration _imageEchoWait = Duration(seconds: 15);
|
||||
|
||||
/// Receivers drop a partial image [kImageReassemblyTtl] after its first
|
||||
/// chunk. A repair that cannot land well inside that window is skipped.
|
||||
static const Duration _imageRepairDeadline = Duration(seconds: 45);
|
||||
|
||||
static const int _maxTrackedOwnImages = 16;
|
||||
|
||||
final Map<(int, int), List<int>> _ownImageEchoes = {};
|
||||
final Set<(int, int)> _imageRepairsInFlight = {};
|
||||
|
||||
/// Repeater echoes heard for each chunk of one of our own images sent this
|
||||
/// session (data chunks, then the parity chunk), or null if not tracked.
|
||||
List<int>? ownImageEchoes(int channelIndex, int imgId) {
|
||||
final echoes = _ownImageEchoes[(channelIndex, imgId)];
|
||||
return echoes == null ? null : List<int>.unmodifiable(echoes);
|
||||
}
|
||||
|
||||
/// Non-null while unheard chunks of that image are being resent.
|
||||
({int resends, int maxResends})? imageResendProgress(
|
||||
int channelIndex,
|
||||
int imgId,
|
||||
) => _imageRepairsInFlight.contains((channelIndex, imgId))
|
||||
? (resends: 1, maxResends: 1)
|
||||
: null;
|
||||
|
||||
/// A GRP_DATA packet from the raw RX log. Other people's images arrive
|
||||
/// already decrypted through RESP_CODE_CHANNEL_DATA_RECV; here we only look
|
||||
/// for repeaters re-flooding one of our own chunks.
|
||||
void _handleImageEcho(_RawPacket packet) {
|
||||
final self = senderPrefixFromKey(_selfPublicKey);
|
||||
if (self == null || packet.payload.length < 2) return;
|
||||
final channelHash = packet.payload[0];
|
||||
final encrypted = Uint8List.fromList(packet.payload.sublist(1));
|
||||
final channels = _channels.isNotEmpty ? _channels : _cachedChannels;
|
||||
for (final channel in channels) {
|
||||
if (channel.isEmpty) continue;
|
||||
if (_computeChannelHash(channel.psk) != channelHash) continue;
|
||||
// Null unless the MAC matches this channel's key.
|
||||
final plain = _decryptPayload(channel.psk, encrypted);
|
||||
if (plain == null || plain.length < 3) continue;
|
||||
// Plaintext: data_type (uint16 LE), data_len, blob (padded to 16).
|
||||
final dataType = plain[0] | (plain[1] << 8);
|
||||
final length = plain[2];
|
||||
if (dataType != dataTypeAeicImage || plain.length < 3 + length) return;
|
||||
final header = parseImageChunkHeader(
|
||||
Uint8List.sublistView(plain, 3, 3 + length),
|
||||
);
|
||||
if (header == null || header.senderPrefix != self) return;
|
||||
final channelId = channel.storageId;
|
||||
final slot = _channelMapConfirmed && channelId != null
|
||||
? _slotForChannelId(channelId)
|
||||
: channel.index;
|
||||
if (slot == null) return;
|
||||
_recordOwnImageEcho(slot, header);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void _recordOwnImageEcho(int slot, ImageChunkHeader header) {
|
||||
final echoes = _ownImageEchoes[(slot, header.imgId)];
|
||||
if (echoes == null || header.index >= echoes.length) return;
|
||||
echoes[header.index]++;
|
||||
unawaited(
|
||||
_receivedImageStore?.setOutgoingEchoes(
|
||||
channelIndex: slot,
|
||||
senderPrefix: header.senderPrefix,
|
||||
imgId: header.imgId,
|
||||
echoes: List<int>.of(echoes),
|
||||
),
|
||||
);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// One repair round: resend the chunks no repeater was heard echoing, but
|
||||
/// only when some other chunk of the image was echoed. With no echo at all
|
||||
/// we cannot tell a lost image from a sender with no repeater in earshot,
|
||||
/// and resending would double every such user's airtime for nothing.
|
||||
///
|
||||
/// The resent chunk is byte-identical, so a repeater that did forward it
|
||||
/// (and we just missed the echo) drops the copy as already seen. Receivers
|
||||
/// missing it merge it into the image they are still holding.
|
||||
Future<void> _repairUnheardImageChunks(
|
||||
(int, int) key,
|
||||
List<Uint8List> blobs, {
|
||||
required Duration interChunkDelay,
|
||||
required DateTime startedAt,
|
||||
}) async {
|
||||
await Future<void>.delayed(_imageEchoWait);
|
||||
final echoes = _ownImageEchoes[key];
|
||||
if (echoes == null || echoes.length != blobs.length || !isConnected) {
|
||||
return;
|
||||
}
|
||||
final unheard = <Uint8List>[
|
||||
for (var i = 0; i < blobs.length; i++)
|
||||
if (echoes[i] == 0) blobs[i],
|
||||
];
|
||||
if (unheard.isEmpty || unheard.length == blobs.length) return;
|
||||
if (DateTime.now().difference(startedAt) > _imageRepairDeadline) {
|
||||
_appDebugLogService?.info(
|
||||
'Image ${key.$2}: ${unheard.length} chunk(s) unheard, too late to '
|
||||
'resend before receivers give up',
|
||||
tag: 'Image resend',
|
||||
);
|
||||
return;
|
||||
}
|
||||
_appDebugLogService?.info(
|
||||
'Image ${key.$2}: resending ${unheard.length} of ${blobs.length} '
|
||||
'chunk(s) no repeater echoed',
|
||||
tag: 'Image resend',
|
||||
);
|
||||
_imageRepairsInFlight.add(key);
|
||||
notifyListeners();
|
||||
try {
|
||||
await _transmitImageBlobs(
|
||||
unheard,
|
||||
channelIndex: key.$1,
|
||||
interChunkDelay: interChunkDelay,
|
||||
);
|
||||
} catch (e) {
|
||||
_appDebugLogService?.warn('Image resend failed: $e', tag: 'Image resend');
|
||||
} finally {
|
||||
_imageRepairsInFlight.remove(key);
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _runScopedChannelSend(
|
||||
Future<void> Function() action, {
|
||||
required String region,
|
||||
@@ -8459,7 +8640,12 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
|
||||
final raw = reader.readRemainingBytes();
|
||||
final packet = _parseRawPacket(raw);
|
||||
if (packet == null || packet.payloadType != _payloadTypeGroupText) return;
|
||||
if (packet == null) return;
|
||||
if (packet.payloadType == _payloadTypeGroupData) {
|
||||
_handleImageEcho(packet);
|
||||
return;
|
||||
}
|
||||
if (packet.payloadType != _payloadTypeGroupText) return;
|
||||
|
||||
final payload = BufferReader(packet.payload);
|
||||
final channelHash = payload.readByte();
|
||||
@@ -10541,6 +10727,7 @@ const int _routeFlood = 0x01;
|
||||
const int _routeTransportDirect = 0x03;
|
||||
|
||||
const int _payloadTypeGroupText = 0x05;
|
||||
const int _payloadTypeGroupData = 0x06;
|
||||
const int _cipherMacSize = 2;
|
||||
|
||||
bool _isPathLenValidForMode(
|
||||
|
||||
@@ -3509,6 +3509,44 @@
|
||||
"imageSend_viewOriginal": "Original",
|
||||
"imageSend_viewReconstruction": "What recipients see",
|
||||
"imageSend_reconstructionUnavailable": "This device can't preview the reconstruction.",
|
||||
"receivedImage_packetEchoes": "Packet {number}: {count, plural, =0{no repeater heard} =1{repeated once} other{repeated {count} times}}",
|
||||
"@receivedImage_packetEchoes": {
|
||||
"placeholders": {
|
||||
"number": {
|
||||
"type": "int"
|
||||
},
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"receivedImage_recoveryPacketEchoes": "Recovery packet: {count, plural, =0{no repeater heard} =1{repeated once} other{repeated {count} times}}",
|
||||
"@receivedImage_recoveryPacketEchoes": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"imageSend_preparingPreview": "Preparing preview…",
|
||||
"imageSend_tryAnother": "Try another version",
|
||||
"imageSend_versionsHint": "Each version is reconstructed a little differently. Pick the one that looks most like your photo.",
|
||||
"imageSend_versionLabel": "Version {number}",
|
||||
"@imageSend_versionLabel": {
|
||||
"placeholders": {
|
||||
"number": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"imageSend_versionPackets": "{count, plural, =1{1 packet} other{{count} packets}}",
|
||||
"@imageSend_versionPackets": {
|
||||
"placeholders": {
|
||||
"count": {
|
||||
"type": "int"
|
||||
}
|
||||
}
|
||||
},
|
||||
"imageSend_modelNotDownloaded": "The image model isn't downloaded yet. Download it in Settings to send images.",
|
||||
"imageSend_originalSize": "Original",
|
||||
"imageSend_onAirSize": "On air",
|
||||
|
||||
@@ -10643,6 +10643,48 @@ abstract class AppLocalizations {
|
||||
/// **'This device can\'t preview the reconstruction.'**
|
||||
String get imageSend_reconstructionUnavailable;
|
||||
|
||||
/// No description provided for @receivedImage_packetEchoes.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Packet {number}: {count, plural, =0{no repeater heard} =1{repeated once} other{repeated {count} times}}'**
|
||||
String receivedImage_packetEchoes(int number, int count);
|
||||
|
||||
/// No description provided for @receivedImage_recoveryPacketEchoes.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Recovery packet: {count, plural, =0{no repeater heard} =1{repeated once} other{repeated {count} times}}'**
|
||||
String receivedImage_recoveryPacketEchoes(int count);
|
||||
|
||||
/// No description provided for @imageSend_preparingPreview.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Preparing preview…'**
|
||||
String get imageSend_preparingPreview;
|
||||
|
||||
/// No description provided for @imageSend_tryAnother.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Try another version'**
|
||||
String get imageSend_tryAnother;
|
||||
|
||||
/// No description provided for @imageSend_versionsHint.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Each version is reconstructed a little differently. Pick the one that looks most like your photo.'**
|
||||
String get imageSend_versionsHint;
|
||||
|
||||
/// No description provided for @imageSend_versionLabel.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Version {number}'**
|
||||
String imageSend_versionLabel(int number);
|
||||
|
||||
/// No description provided for @imageSend_versionPackets.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'{count, plural, =1{1 packet} other{{count} packets}}'**
|
||||
String imageSend_versionPackets(int count);
|
||||
|
||||
/// No description provided for @imageSend_modelNotDownloaded.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
||||
@@ -6285,6 +6285,56 @@ class AppLocalizationsBg extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Това устройство не може да покаже реконструкцията.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'Моделът за изображения още не е изтеглен. Изтеглете го в настройките, за да изпращате изображения.';
|
||||
|
||||
@@ -6271,6 +6271,56 @@ class AppLocalizationsCs extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Toto zařízení nemůže zobrazit náhled rekonstrukce.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'Model obrázků ještě není stažen. Pro odesílání obrázků jej stáhněte v Nastavení.';
|
||||
|
||||
@@ -6303,6 +6303,56 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Dieses Gerät kann die Rekonstruktion nicht in der Vorschau anzeigen.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'Das Bildmodell wurde noch nicht heruntergeladen. Laden Sie es in den Einstellungen herunter, um Bilder zu senden.';
|
||||
|
||||
@@ -6199,6 +6199,56 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'This device can\'t preview the reconstruction.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'The image model isn\'t downloaded yet. Download it in Settings to send images.';
|
||||
|
||||
@@ -6287,6 +6287,56 @@ class AppLocalizationsEs extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Este dispositivo no puede previsualizar la reconstrucción.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'El modelo de imagen aún no se ha descargado. Descárgalo en Configuración para enviar imágenes.';
|
||||
|
||||
@@ -6310,6 +6310,56 @@ class AppLocalizationsFr extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Cet appareil ne peut pas prévisualiser la reconstitution.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'Le modèle d\'image n\'est pas encore téléchargé. Téléchargez-le dans Paramètres pour envoyer des images.';
|
||||
|
||||
@@ -6284,6 +6284,56 @@ class AppLocalizationsHu extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Ezen az eszközön nem jeleníthető meg a rekonstrukció előnézete.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'A képmodell még nincs letöltve. Töltse le a Beállításokban a képek küldéséhez.';
|
||||
|
||||
@@ -6292,6 +6292,56 @@ class AppLocalizationsIt extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Questo dispositivo non può mostrare un\'anteprima della ricostruzione.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'Il modello di immagine non è ancora stato scaricato. Scaricalo nelle Impostazioni per inviare immagini.';
|
||||
|
||||
@@ -5984,6 +5984,56 @@ class AppLocalizationsJa extends AppLocalizations {
|
||||
@override
|
||||
String get imageSend_reconstructionUnavailable => 'このデバイスでは復元結果をプレビューできません。';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'画像モデルがまだダウンロードされていません。設定でダウンロードすると画像を送信できます。';
|
||||
|
||||
@@ -6000,6 +6000,56 @@ class AppLocalizationsKo extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'이 장치에서는 복원 결과를 미리 볼 수 없습니다.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'이미지 모델이 아직 다운로드되지 않았습니다. 설정에서 다운로드하면 이미지를 보낼 수 있습니다.';
|
||||
|
||||
@@ -6256,6 +6256,56 @@ class AppLocalizationsNl extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Dit apparaat kan geen voorbeeld van de reconstructie tonen.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'Het afbeeldingsmodel is nog niet gedownload. Download het in Instellingen om afbeeldingen te verzenden.';
|
||||
|
||||
@@ -6330,6 +6330,56 @@ class AppLocalizationsPl extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'To urządzenie nie może wyświetlić podglądu rekonstrukcji.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'Model obrazowy nie jest jeszcze pobrany. Pobierz go w Ustawieniach, aby wysyłać obrazy.';
|
||||
|
||||
@@ -6281,6 +6281,56 @@ class AppLocalizationsPt extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Este dispositivo não pode pré-visualizar a reconstrução.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'O modelo de imagem ainda não foi transferido. Transfira-o nas Configurações para enviar imagens.';
|
||||
|
||||
@@ -6306,6 +6306,56 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Это устройство не может показать реконструкцию.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'Модель изображения ещё не загружена. Загрузите её в настройках, чтобы отправлять изображения.';
|
||||
|
||||
@@ -6280,6 +6280,56 @@ class AppLocalizationsSk extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Toto zariadenie nedokáže zobraziť náhľad rekonštrukcie.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'Model obrazu ešte nie je stiahnutý. Stiahnite ho v Nastaveniach, aby ste mohli posielať obrázky.';
|
||||
|
||||
@@ -6272,6 +6272,56 @@ class AppLocalizationsSl extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Ta naprava ne more prikazati predogleda rekonstrukcije.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'Obrazni model še ni prenesen. Prenesite ga v Nastavitvah, da boste lahko pošiljali slike.';
|
||||
|
||||
@@ -6239,6 +6239,56 @@ class AppLocalizationsSv extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Enheten kan inte förhandsgranska rekonstruktionen.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'Bildmodellen har ännu inte laddats ner. Ladda ner den i Inställningar för att skicka bilder.';
|
||||
|
||||
@@ -6312,6 +6312,56 @@ class AppLocalizationsUk extends AppLocalizations {
|
||||
String get imageSend_reconstructionUnavailable =>
|
||||
'Цей пристрій не може показати відтворення.';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded =>
|
||||
'Модель зображення ще не завантажена. Завантажте її в налаштуваннях, щоб надсилати зображення.';
|
||||
|
||||
@@ -5847,6 +5847,56 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
@override
|
||||
String get imageSend_reconstructionUnavailable => '此设备无法预览重建结果。';
|
||||
|
||||
@override
|
||||
String receivedImage_packetEchoes(int number, int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Packet $number: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String receivedImage_recoveryPacketEchoes(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: 'repeated $count times',
|
||||
one: 'repeated once',
|
||||
zero: 'no repeater heard',
|
||||
);
|
||||
return 'Recovery packet: $_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_preparingPreview => 'Preparing preview…';
|
||||
|
||||
@override
|
||||
String get imageSend_tryAnother => 'Try another version';
|
||||
|
||||
@override
|
||||
String get imageSend_versionsHint =>
|
||||
'Each version is reconstructed a little differently. Pick the one that looks most like your photo.';
|
||||
|
||||
@override
|
||||
String imageSend_versionLabel(int number) {
|
||||
return 'Version $number';
|
||||
}
|
||||
|
||||
@override
|
||||
String imageSend_versionPackets(int count) {
|
||||
String _temp0 = intl.Intl.pluralLogic(
|
||||
count,
|
||||
locale: localeName,
|
||||
other: '$count packets',
|
||||
one: '1 packet',
|
||||
);
|
||||
return '$_temp0';
|
||||
}
|
||||
|
||||
@override
|
||||
String get imageSend_modelNotDownloaded => '图像模型尚未下载。在设置中下载后才能发送图像。';
|
||||
|
||||
|
||||
@@ -140,6 +140,8 @@ void main() async {
|
||||
<Uint8List>[blob],
|
||||
channelIndex: channelIndex,
|
||||
interChunkDelay: Duration.zero,
|
||||
// One blob at a time: echo tracking needs the whole chunk set.
|
||||
repairUnheardChunks: false,
|
||||
),
|
||||
// Overwritten by onImageSenderPrefix as soon as SELF_INFO lands.
|
||||
senderPrefix: 0,
|
||||
|
||||
@@ -16,6 +16,7 @@ import '../services/app_settings_service.dart';
|
||||
import '../services/backup_service.dart';
|
||||
import '../services/image_codec_service.dart';
|
||||
import '../services/translation_service.dart';
|
||||
import '../services/ui_view_state_service.dart';
|
||||
import '../services/message_filter/message_filter_service.dart';
|
||||
import '../utils/platform_info.dart';
|
||||
import '../utils/share_origin.dart';
|
||||
@@ -437,6 +438,7 @@ class _BackupRestoreScreenState extends State<BackupRestoreScreen> {
|
||||
final l10n = context.l10n;
|
||||
final connector = context.read<MeshCoreConnector>();
|
||||
final appSettingsService = context.read<AppSettingsService>();
|
||||
final uiViewStateService = context.read<UiViewStateService>();
|
||||
final messageFilterService = context.read<MessageFilterService>();
|
||||
final translationService = context.read<TranslationService>();
|
||||
final imageCodecService = context.read<ImageCodecService>();
|
||||
@@ -459,6 +461,7 @@ class _BackupRestoreScreenState extends State<BackupRestoreScreen> {
|
||||
)) {
|
||||
await appSettingsService.loadSettings();
|
||||
if (_selectedItems.contains(BackupItem.appSettings)) {
|
||||
await uiViewStateService.reload();
|
||||
await _offerMissingModels(
|
||||
appSettingsService,
|
||||
translationService,
|
||||
|
||||
@@ -1917,9 +1917,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
final connector = context.read<MeshCoreConnector>();
|
||||
|
||||
// The picked bytes are kept past the preview on purpose: the sender's own
|
||||
// bubble renders from them (see [_registerOutgoingImage]). The bitstream
|
||||
// cannot serve — turning it back into pixels is a ~2.16 GiB, ~1 s decode
|
||||
// of an image the sender is already holding.
|
||||
// bubble falls back to them (see [_registerOutgoingImage]) when the sheet
|
||||
// could not decode the chosen version on this device.
|
||||
final XFile? picked;
|
||||
try {
|
||||
picked = await ImagePicker().pickImage(
|
||||
@@ -2095,8 +2094,11 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
/// GRP_DATA is not echoed back to the sender and an image is not a
|
||||
/// [ChannelMessage], so without this the sender sees a "sent" snack bar and
|
||||
/// an otherwise empty conversation. The entry lands in `decoded` directly —
|
||||
/// an outgoing image is never queued for inference, so showing your own
|
||||
/// photo costs no model memory.
|
||||
/// an outgoing image is never queued for inference.
|
||||
///
|
||||
/// The bubble shows the version the user picked, decoded as recipients see
|
||||
/// it ([ImageSendPreviewResult.previewPng]). Only when this device could not decode does it fall back
|
||||
/// to the stretched original.
|
||||
///
|
||||
/// Best effort throughout: a failure here has already been preceded by a
|
||||
/// successful transmission, so it must not turn into an error the user sees.
|
||||
@@ -2112,7 +2114,8 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
} on ProviderNotFoundException {
|
||||
return; // screen test without the store
|
||||
}
|
||||
final previewPng = await _squarePreviewPng(sourceBytes);
|
||||
final previewPng =
|
||||
result.previewPng ?? await _squarePreviewPng(sourceBytes);
|
||||
if (previewPng == null) return;
|
||||
try {
|
||||
await store.registerOutgoing(
|
||||
@@ -2126,6 +2129,18 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
rate: aeicRatePointForUi(result.rate),
|
||||
chunkCount: chunkSet.dataChunkCount,
|
||||
aspectCode: await _aspectCodeOf(sourceBytes),
|
||||
// The decoded version is model output and carries the AI label; the
|
||||
// stretched-original fallback is the sender's own pixels.
|
||||
synthesized: result.previewPng != null,
|
||||
payloadBytes: result.payload.length,
|
||||
// Repeaters may already have echoed the first chunks while the rest
|
||||
// were still going out.
|
||||
chunkEchoes: mounted
|
||||
? context.read<MeshCoreConnector>().ownImageEchoes(
|
||||
widget.channel.index,
|
||||
chunkSet.imgId,
|
||||
)
|
||||
: null,
|
||||
);
|
||||
} on Exception catch (error) {
|
||||
debugPrint('outgoing image registration failed: $error');
|
||||
@@ -2153,11 +2168,9 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
|
||||
/// [imageBytes] stretched to 512x512, as PNG.
|
||||
///
|
||||
/// This is what the preview sheet showed (`BoxFit.fill` on a 1:1 box is
|
||||
/// exactly the stretch the codec applies) and what the codec actually
|
||||
/// encoded, so the sender's bubble matches both. Deliberately not a decode of the
|
||||
/// bitstream: that would cost ~2.16 GiB and ~1 s to reproduce, less well, an
|
||||
/// image this device is already holding in memory.
|
||||
/// Fallback for the sender's bubble when the preview sheet had no decoded
|
||||
/// version to hand over (a device that cannot decode). It is the input the
|
||||
/// codec stretched, not what recipients see, so it is only a stand-in.
|
||||
///
|
||||
/// Returns null rather than throwing on an undecodable source — the send has
|
||||
/// already happened by the time this runs.
|
||||
@@ -2411,12 +2424,35 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
right: 8,
|
||||
bottom: 4,
|
||||
),
|
||||
child: Text(
|
||||
formatChatTime(context, entry.firstSeen),
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 12 * textScale,
|
||||
color: metaColor,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
formatChatTime(context, entry.firstSeen),
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 12 * textScale,
|
||||
color: metaColor,
|
||||
),
|
||||
),
|
||||
if (isOutgoing) ...[
|
||||
const SizedBox(width: 4),
|
||||
// Same status as channel text: repeats heard, here
|
||||
// for the least-heard data chunk.
|
||||
MessageStatusIcon(
|
||||
size: 16 * textScale,
|
||||
isAcked: false,
|
||||
isChannel: true,
|
||||
repeatCount: entry.minDataChunkEchoes ?? 0,
|
||||
resendProgress: context
|
||||
.watch<MeshCoreConnector>()
|
||||
.imageResendProgress(
|
||||
entry.channelIndex,
|
||||
entry.imgId,
|
||||
),
|
||||
onColor: metaColor,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -2549,6 +2585,15 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
||||
if (entry.recoveredWithParity)
|
||||
Text(l10n.receivedImage_parityRecovered),
|
||||
if (decodeMs != null) Text(l10n.receivedImage_decodeTime(decodeMs)),
|
||||
if (entry.chunkEchoes case final echoes?) ...[
|
||||
const SizedBox(height: 8),
|
||||
for (var i = 0; i < echoes.length; i++)
|
||||
Text(
|
||||
i < entry.totalChunks
|
||||
? l10n.receivedImage_packetEchoes(i + 1, echoes[i])
|
||||
: l10n.receivedImage_recoveryPacketEchoes(echoes[i]),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
|
||||
@@ -487,6 +487,12 @@ class BackupService {
|
||||
);
|
||||
}
|
||||
}
|
||||
if (selectedItems.contains(BackupItem.appSettings)) {
|
||||
await appSettingsService.loadSettings();
|
||||
}
|
||||
if (selectedItems.contains(BackupItem.channelSettings)) {
|
||||
await connector.reloadChannelOrder();
|
||||
}
|
||||
if (!importingIdentity &&
|
||||
selectedItems.contains(BackupItem.discoveredContacts)) {
|
||||
await connector.reloadDiscoveredContacts();
|
||||
|
||||
@@ -970,15 +970,17 @@ class ImageCodecService extends ChangeNotifier implements ImageSendCodec {
|
||||
|
||||
/// [ImageSendCodec] entry point used by `ImageSendPreviewSheet`.
|
||||
///
|
||||
/// Takes the raw picked file (JPEG/PNG/HEIC/…), centre-crops and scales it to
|
||||
/// [kImageCodecSquareSize] square, then encodes. Throws on failure so the
|
||||
/// Takes the raw picked file (JPEG/PNG/HEIC/…), stretches the part of it
|
||||
/// that [variant] selects (see [rerollSourceRect]; 0 is the whole photo) to
|
||||
/// a [kImageCodecSquareSize] square, then encodes. Throws on failure so the
|
||||
/// sheet can surface it — unlike the nullable service-level methods below,
|
||||
/// whose contract is "null means not available".
|
||||
@override
|
||||
Future<Uint8List> encode(
|
||||
Uint8List imageBytes,
|
||||
ImageCodecRatePoint rate,
|
||||
) async {
|
||||
ImageCodecRatePoint rate, {
|
||||
int variant = 0,
|
||||
}) async {
|
||||
if (!kImageCodecBitstreamPathAvailable) {
|
||||
// Fail here rather than after a 512x512 raster and a session load, and
|
||||
// fail with the specific exception so the sheet can say why.
|
||||
@@ -990,7 +992,7 @@ class ImageCodecService extends ChangeNotifier implements ImageSendCodec {
|
||||
throw const ImageCodecBundleIncomplete();
|
||||
}
|
||||
final result = await encodeImage(
|
||||
rgbBytes: await _toSquareRgb(imageBytes),
|
||||
rgbBytes: await _toSquareRgb(imageBytes, variant: variant),
|
||||
ratePoint: aeicRatePointForUi(rate),
|
||||
);
|
||||
final bitstream = result?.bitstream;
|
||||
@@ -1300,14 +1302,18 @@ class ImageCodecService extends ChangeNotifier implements ImageSendCodec {
|
||||
|
||||
static const int _bytesPerPixel = 3;
|
||||
|
||||
/// Centre-crops [imageBytes] to a square and scales it to
|
||||
/// [kImageCodecSquareSize], returning packed 8-bit RGB.
|
||||
/// Stretches the [variant] region of [imageBytes] (see [rerollSourceRect];
|
||||
/// 0 is the whole frame) to a [kImageCodecSquareSize] square, returning
|
||||
/// packed 8-bit RGB.
|
||||
///
|
||||
/// Uses `dart:ui` rather than a decode package so this adds no dependency.
|
||||
/// It runs on the root isolate, which is acceptable: it is a single 512x512
|
||||
/// raster, three orders of magnitude cheaper than the 1385 GFLOP inference
|
||||
/// that follows in the worker.
|
||||
Future<Uint8List> _toSquareRgb(Uint8List imageBytes) async {
|
||||
Future<Uint8List> _toSquareRgb(
|
||||
Uint8List imageBytes, {
|
||||
int variant = 0,
|
||||
}) async {
|
||||
final codec = await ui.instantiateImageCodec(imageBytes);
|
||||
final frame = await codec.getNextFrame();
|
||||
final source = frame.image;
|
||||
@@ -1317,16 +1323,11 @@ class ImageCodecService extends ChangeNotifier implements ImageSendCodec {
|
||||
// Aspect ratio is deliberately not preserved: the codec's graph is
|
||||
// statically 512x512, so something has to give, and losing 25% of a 4:3
|
||||
// photo (44% of 16:9, or the subject's head in a portrait) is worse than
|
||||
// distorting it. Nothing outside the frame is discarded this way.
|
||||
// NOTE: the aspect ratio is NOT transmitted, so the receiver cannot undo
|
||||
// the stretch — see the note in image_chunk_transport.dart on the
|
||||
// metadata byte.
|
||||
final src = ui.Rect.fromLTWH(
|
||||
0,
|
||||
0,
|
||||
source.width.toDouble(),
|
||||
source.height.toDouble(),
|
||||
);
|
||||
// distorting it. The source shape travels in the metadata byte's aspect
|
||||
// nibble, so the receiver un-stretches it. Re-roll variants trim at most
|
||||
// ~2% at an edge, so they keep the same shape and aspect code.
|
||||
final r = rerollSourceRect(source.width, source.height, variant);
|
||||
final src = ui.Rect.fromLTWH(r.left, r.top, r.width, r.height);
|
||||
final dstSize = kImageCodecSquareSize.toDouble();
|
||||
final recorder = ui.PictureRecorder();
|
||||
ui.Canvas(recorder).drawImageRect(
|
||||
|
||||
@@ -197,13 +197,30 @@ class ReceivedImageEntry {
|
||||
/// One chunk was rebuilt from the XOR parity chunk.
|
||||
final bool recoveredWithParity;
|
||||
|
||||
/// This is the local user's own send. Its PNG is their real 512x512 crop, so
|
||||
/// [synthesized] is false and the R6 label must NOT be shown.
|
||||
/// This is the local user's own send.
|
||||
final bool isOutgoing;
|
||||
|
||||
/// Whether the pixels are generative-model output. Derived, never supplied:
|
||||
/// `synthesized == !isOutgoing`.
|
||||
bool get synthesized => !isOutgoing;
|
||||
/// Whether the pixels are generative-model output, so the R6 label must be
|
||||
/// shown. Always true for received images. For the user's own send it is
|
||||
/// true when the PNG is the version they picked, decoded as recipients see
|
||||
/// it, and false only when it is the stretched original (a device that
|
||||
/// could not decode).
|
||||
final bool synthesized;
|
||||
|
||||
/// Our own image only: repeater echoes heard for each chunk, data chunks
|
||||
/// first and the parity chunk last. Null when not tracked.
|
||||
final List<int>? chunkEchoes;
|
||||
|
||||
/// The fewest echoes any data chunk got: every data chunk was heard
|
||||
/// repeated at least this many times. Null when not tracked.
|
||||
int? get minDataChunkEchoes {
|
||||
final echoes = chunkEchoes;
|
||||
if (echoes == null || echoes.isEmpty) return null;
|
||||
final data = echoes.length > totalChunks
|
||||
? echoes.sublist(0, totalChunks)
|
||||
: echoes;
|
||||
return data.reduce((a, b) => a < b ? a : b);
|
||||
}
|
||||
|
||||
final int? decodeMs;
|
||||
final String? error;
|
||||
@@ -237,6 +254,8 @@ class ReceivedImageEntry {
|
||||
this.metadataAssumed = true,
|
||||
this.recoveredWithParity = false,
|
||||
this.isOutgoing = false,
|
||||
bool? synthesized,
|
||||
this.chunkEchoes,
|
||||
this.decodeMs,
|
||||
this.error,
|
||||
this.needsManualDecode = false,
|
||||
@@ -245,7 +264,7 @@ class ReceivedImageEntry {
|
||||
this.bitstreamByteCount = 0,
|
||||
this.pngByteCount = 0,
|
||||
this.pngBytes,
|
||||
});
|
||||
}) : synthesized = synthesized ?? !isOutgoing;
|
||||
|
||||
ImageStreamKey get key => ImageStreamKey(
|
||||
senderPrefix: senderPrefix,
|
||||
@@ -282,6 +301,7 @@ class ReceivedImageEntry {
|
||||
int? bitstreamByteCount,
|
||||
int? pngByteCount,
|
||||
Object? pngBytes = _unset,
|
||||
List<int>? chunkEchoes,
|
||||
}) {
|
||||
return ReceivedImageEntry(
|
||||
streamId: streamId,
|
||||
@@ -299,6 +319,8 @@ class ReceivedImageEntry {
|
||||
metadataAssumed: metadataAssumed ?? this.metadataAssumed,
|
||||
recoveredWithParity: recoveredWithParity ?? this.recoveredWithParity,
|
||||
isOutgoing: isOutgoing,
|
||||
synthesized: synthesized,
|
||||
chunkEchoes: chunkEchoes ?? this.chunkEchoes,
|
||||
decodeMs: identical(decodeMs, _unset) ? this.decodeMs : decodeMs as int?,
|
||||
error: identical(error, _unset) ? this.error : error as String?,
|
||||
needsManualDecode: needsManualDecode ?? this.needsManualDecode,
|
||||
@@ -329,6 +351,7 @@ class ReceivedImageEntry {
|
||||
'recoveredWithParity': recoveredWithParity,
|
||||
'isOutgoing': isOutgoing,
|
||||
'synthesized': synthesized,
|
||||
if (chunkEchoes != null) 'chunkEchoes': chunkEchoes,
|
||||
'needsManualDecode': needsManualDecode,
|
||||
'bitstreamStored': bitstreamStored,
|
||||
'pngStored': pngStored,
|
||||
@@ -357,6 +380,10 @@ class ReceivedImageEntry {
|
||||
metadataAssumed: json['metadataAssumed'] as bool? ?? true,
|
||||
recoveredWithParity: json['recoveredWithParity'] as bool? ?? false,
|
||||
isOutgoing: json['isOutgoing'] as bool? ?? false,
|
||||
synthesized: json['synthesized'] as bool?,
|
||||
chunkEchoes: (json['chunkEchoes'] as List<dynamic>?)
|
||||
?.whereType<int>()
|
||||
.toList(),
|
||||
decodeMs: json['decodeMs'] as int?,
|
||||
error: json['error'] as String?,
|
||||
needsManualDecode: json['needsManualDecode'] as bool? ?? false,
|
||||
@@ -1041,6 +1068,9 @@ class ReceivedImageStore extends ChangeNotifier {
|
||||
required AeicRatePoint rate,
|
||||
required int chunkCount,
|
||||
int aspectCode = 0,
|
||||
bool synthesized = false,
|
||||
List<int>? chunkEchoes,
|
||||
int payloadBytes = 0,
|
||||
DateTime? at,
|
||||
}) async {
|
||||
final now = at ?? _clock();
|
||||
@@ -1069,6 +1099,11 @@ class ReceivedImageStore extends ChangeNotifier {
|
||||
aspectCode: aspectCode,
|
||||
metadataAssumed: false,
|
||||
isOutgoing: true,
|
||||
synthesized: synthesized,
|
||||
chunkEchoes: chunkEchoes,
|
||||
// The size of what was sent, for the caption and packet info. The
|
||||
// bitstream itself is not kept, so bitstreamStored stays false.
|
||||
bitstreamByteCount: payloadBytes,
|
||||
pngStored: pngWritten,
|
||||
pngByteCount: pngWritten ? previewPng.length : 0,
|
||||
pngBytes: previewPng,
|
||||
@@ -1078,6 +1113,31 @@ class ReceivedImageStore extends ChangeNotifier {
|
||||
return stored;
|
||||
}
|
||||
|
||||
/// Records repeater echoes of the user's own image (see
|
||||
/// `MeshCoreConnector.ownImageEchoes`). Echoes that land before the image is
|
||||
/// registered are passed to [registerOutgoing] instead.
|
||||
Future<void> setOutgoingEchoes({
|
||||
required int channelIndex,
|
||||
required int senderPrefix,
|
||||
required int imgId,
|
||||
required List<int> echoes,
|
||||
}) async {
|
||||
ReceivedImageEntry? match;
|
||||
for (final entry in _entries.values) {
|
||||
if (!entry.isOutgoing ||
|
||||
entry.imgId != imgId ||
|
||||
entry.channelIndex != channelIndex ||
|
||||
entry.senderPrefix != senderPrefix) {
|
||||
continue;
|
||||
}
|
||||
if (match == null || entry.firstSeen.isAfter(match.firstSeen)) {
|
||||
match = entry;
|
||||
}
|
||||
}
|
||||
if (match == null) return;
|
||||
await _store(match.copyWith(chunkEchoes: List<int>.unmodifiable(echoes)));
|
||||
}
|
||||
|
||||
// ---- decode scheduling ---------------------------------------------------
|
||||
|
||||
/// App lifecycle gate. Backgrounding cancels an in-flight decode and returns
|
||||
|
||||
@@ -109,6 +109,11 @@ class UiViewStateService extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> reload() async {
|
||||
await initialize();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void setContactsSelectedGroupName(String value) {
|
||||
if (_contactsSelectedGroupName == value) return;
|
||||
_contactsSelectedGroupName = value;
|
||||
|
||||
@@ -98,6 +98,54 @@ class ImageCodecRateStats {
|
||||
}
|
||||
}
|
||||
|
||||
/// Input tweaks for "Try another version", as `(zoom, dx, dy)` fractions of
|
||||
/// the source photo. Index == version variant; 0 is the untouched photo.
|
||||
///
|
||||
/// The decoder is generative and very sensitive to its input: a near-identical
|
||||
/// photo can come back with different invented detail. Measured on Kodak, the
|
||||
/// best of three versions raised CLIP agreement with the source from 0.828 to
|
||||
/// 0.853 and fixed 3 of 8 photos that came back as something else
|
||||
/// (`tools/aeic/eval`, `reroll*` variants, which mirror this table). The tweaks
|
||||
/// drop at most ~2% at an edge, so every version still shows the whole photo
|
||||
/// and keeps the same aspect code.
|
||||
const List<(double, double, double)> kImageSendRerollTweaks = [
|
||||
(1.0, 0.0, 0.0),
|
||||
(1.02, 0.005, 0.0),
|
||||
(1.02, -0.005, 0.005),
|
||||
(1.04, 0.0, -0.005),
|
||||
(1.03, 0.01, 0.01),
|
||||
(1.03, -0.01, -0.01),
|
||||
];
|
||||
|
||||
/// Most versions the send sheet will make of one photo.
|
||||
final int kImageSendMaxVersions = kImageSendRerollTweaks.length;
|
||||
|
||||
/// The part of a [width] x [height] photo that version [variant] encodes.
|
||||
///
|
||||
/// Variant 0 is the full frame, so the first version is exactly what the app
|
||||
/// sent before versions existed. Other variants zoom in by `zoom`, shift by
|
||||
/// `dx`/`dy` of the photo size, and are clamped to stay inside the photo.
|
||||
({double left, double top, double width, double height}) rerollSourceRect(
|
||||
int width,
|
||||
int height,
|
||||
int variant,
|
||||
) {
|
||||
if (variant < 0 || variant >= kImageSendRerollTweaks.length) {
|
||||
throw RangeError.range(
|
||||
variant,
|
||||
0,
|
||||
kImageSendRerollTweaks.length - 1,
|
||||
'variant',
|
||||
);
|
||||
}
|
||||
final (zoom, dx, dy) = kImageSendRerollTweaks[variant];
|
||||
final w = width / zoom;
|
||||
final h = height / zoom;
|
||||
final left = ((width - w) / 2 + dx * width).clamp(0.0, width - w);
|
||||
final top = ((height - h) / 2 + dy * height).clamp(0.0, height - h);
|
||||
return (left: left, top: top, width: w, height: h);
|
||||
}
|
||||
|
||||
/// The encode interface the preview sheet consumes.
|
||||
abstract class ImageSendCodec {
|
||||
/// Current availability. The sheet renders a non-interactive explanation for
|
||||
@@ -118,9 +166,14 @@ abstract class ImageSendCodec {
|
||||
/// Encode [imageBytes] (any common still format) at [rate], returning the
|
||||
/// compressed bitstream that will be chunked onto the air.
|
||||
///
|
||||
/// Implementations are expected to centre-crop to
|
||||
/// [kImageCodecSquareSize] square first.
|
||||
Future<Uint8List> encode(Uint8List imageBytes, ImageCodecRatePoint rate);
|
||||
/// Implementations stretch the part of the photo given by
|
||||
/// [rerollSourceRect] for [variant] into a [kImageCodecSquareSize] square
|
||||
/// first. Variant 0 is the whole photo.
|
||||
Future<Uint8List> encode(
|
||||
Uint8List imageBytes,
|
||||
ImageCodecRatePoint rate, {
|
||||
int variant = 0,
|
||||
});
|
||||
|
||||
/// Decodes [payload] to PNG exactly as a recipient would, or null when this
|
||||
/// device cannot decode.
|
||||
@@ -142,26 +195,44 @@ class FakeImageSendCodec implements ImageSendCodec {
|
||||
|
||||
final Duration latency;
|
||||
|
||||
/// Returned by [decodePreview]; null means "this device cannot decode".
|
||||
final Uint8List? previewPng;
|
||||
|
||||
const FakeImageSendCodec({
|
||||
this.availability = ImageCodecAvailability.ready,
|
||||
this.unavailableReason,
|
||||
this.latency = const Duration(milliseconds: 250),
|
||||
this.previewPng,
|
||||
});
|
||||
|
||||
/// Payload size the fake produces for [variant]: the measured mean, plus a
|
||||
/// little per variant so versions are told apart.
|
||||
static int payloadBytesFor(ImageCodecRatePoint rate, int variant) =>
|
||||
ImageCodecRateStats.forRate(rate).meanBytes + variant * 3;
|
||||
|
||||
@override
|
||||
Future<Uint8List> encode(
|
||||
Uint8List imageBytes,
|
||||
ImageCodecRatePoint rate,
|
||||
) async {
|
||||
ImageCodecRatePoint rate, {
|
||||
int variant = 0,
|
||||
}) async {
|
||||
if (latency > Duration.zero) {
|
||||
await Future<void>.delayed(latency);
|
||||
}
|
||||
final size = ImageCodecRateStats.forRate(rate).meanBytes;
|
||||
final size = payloadBytesFor(rate, variant);
|
||||
return Uint8List.fromList(
|
||||
List<int>.generate(size, (i) => (i * 31 + rate.index) & 0xFF),
|
||||
List<int>.generate(
|
||||
size,
|
||||
(i) => (i * 31 + rate.index + variant * 7) & 0xFF,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Uint8List?> decodePreview(Uint8List payload) async => null;
|
||||
Future<Uint8List?> decodePreview(Uint8List payload) async {
|
||||
if (latency > Duration.zero) {
|
||||
await Future<void>.delayed(latency);
|
||||
}
|
||||
return previewPng;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import 'package:provider/provider.dart';
|
||||
|
||||
import '../connector/meshcore_connector.dart';
|
||||
import '../l10n/l10n.dart';
|
||||
import '../theme/mesh_theme.dart';
|
||||
import '../services/image_chunk_transport.dart';
|
||||
import '../utils/lora_airtime.dart';
|
||||
import 'image_send_codec_binding.dart';
|
||||
@@ -37,6 +38,11 @@ class ImageSendPreviewResult {
|
||||
/// actually shown. Null when the radio settings were unknown.
|
||||
final Duration? wallClock;
|
||||
|
||||
/// The chosen version decoded as recipients will see it (a
|
||||
/// 512x512 PNG, stretched like the codec input), or null if this device
|
||||
/// could not decode. Used for the sender's own chat bubble.
|
||||
final Uint8List? previewPng;
|
||||
|
||||
const ImageSendPreviewResult({
|
||||
required this.payload,
|
||||
required this.rate,
|
||||
@@ -44,6 +50,7 @@ class ImageSendPreviewResult {
|
||||
required this.packetCount,
|
||||
required this.airtime,
|
||||
required this.wallClock,
|
||||
this.previewPng,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -141,29 +148,53 @@ class _RateEstimate {
|
||||
bool get isExact => payloadBytes != null;
|
||||
}
|
||||
|
||||
/// One encoded version of the photo: the whole photo with re-roll tweak
|
||||
/// [variant] (see [rerollSourceRect]), its bitstream, and what recipients will
|
||||
/// see when they decode it.
|
||||
class _Version {
|
||||
_Version(this.variant);
|
||||
|
||||
final int variant;
|
||||
Uint8List? payload;
|
||||
Uint8List? png;
|
||||
bool encoding = true;
|
||||
bool decoding = false;
|
||||
|
||||
/// The encode failed; there is nothing to send for this version.
|
||||
bool get failed => !encoding && payload == null;
|
||||
}
|
||||
|
||||
class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
|
||||
/// The encoded ft32 bitstream, once the encode finishes.
|
||||
Uint8List? _encoded;
|
||||
/// Versions made so far, in the order they were made. Version 1 (variant 0)
|
||||
/// is the photo exactly as the app has always encoded it; more are added only
|
||||
/// when the user taps "Try another version".
|
||||
final List<_Version> _versions = [];
|
||||
int _selected = 0;
|
||||
|
||||
late bool _parity;
|
||||
bool _encoding = false;
|
||||
bool _sending = false;
|
||||
bool _failed = false;
|
||||
|
||||
/// Latest radio params seen in build; used by [_onSend] so the confirm path
|
||||
/// does not have to touch an InheritedWidget after an await.
|
||||
ImageSendRadio? _radio;
|
||||
|
||||
/// Source `width / height`. Recipients un-stretch the 512x512 square back to
|
||||
/// this shape, so both preview views use it.
|
||||
/// Source `width / height`, used when the original is shown.
|
||||
double _aspect = 1;
|
||||
// The shape recipients restore: the nearest supported ratio, or square.
|
||||
double _recipientAspect = 1;
|
||||
|
||||
bool _showReconstruction = false;
|
||||
Uint8List? _reconstruction;
|
||||
bool _reconstructing = false;
|
||||
bool _reconstructionUnavailable = false;
|
||||
/// The main preview shows the original photo instead of the reconstruction.
|
||||
bool _showOriginal = false;
|
||||
|
||||
/// This device cannot decode, so there is no reconstruction to show and
|
||||
/// making more versions would be pointless.
|
||||
bool _previewUnavailable = false;
|
||||
|
||||
_Version? get _current => _versions.isEmpty ? null : _versions[_selected];
|
||||
|
||||
/// A version is being encoded or decoded. Codec jobs run one at a time, so
|
||||
/// "Try another version" waits for this to clear.
|
||||
bool get _working => _versions.any((v) => v.encoding || v.decoding);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -171,7 +202,7 @@ class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
|
||||
_parity = widget.initialParity;
|
||||
_probeAspect();
|
||||
if (widget.codec.availability == ImageCodecAvailability.ready) {
|
||||
_encode();
|
||||
_addVersion();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,59 +228,56 @@ class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
Future<void> _selectView(bool reconstruction) async {
|
||||
setState(() => _showReconstruction = reconstruction);
|
||||
final payload = _encoded;
|
||||
if (!reconstruction ||
|
||||
payload == null ||
|
||||
_reconstruction != null ||
|
||||
_reconstructing) {
|
||||
return;
|
||||
/// Encodes the next version, selects it, then decodes it so the user sees
|
||||
/// what recipients will get.
|
||||
Future<void> _addVersion() async {
|
||||
final version = _Version(_versions.length);
|
||||
setState(() {
|
||||
_versions.add(version);
|
||||
_selected = _versions.length - 1;
|
||||
_showOriginal = false;
|
||||
});
|
||||
Uint8List? payload;
|
||||
try {
|
||||
payload = await widget.codec.encode(
|
||||
widget.imageBytes,
|
||||
kImageSendRatePoint,
|
||||
variant: version.variant,
|
||||
);
|
||||
} catch (_) {
|
||||
payload = null;
|
||||
}
|
||||
setState(() => _reconstructing = true);
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
version.encoding = false;
|
||||
version.payload = payload;
|
||||
version.decoding = payload != null && !_previewUnavailable;
|
||||
});
|
||||
if (!version.decoding) return;
|
||||
Uint8List? png;
|
||||
try {
|
||||
png = await widget.codec.decodePreview(payload);
|
||||
png = await widget.codec.decodePreview(payload!);
|
||||
} catch (_) {
|
||||
png = null;
|
||||
}
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_reconstructing = false;
|
||||
_reconstruction = png;
|
||||
if (png == null) {
|
||||
_reconstructionUnavailable = true;
|
||||
_showReconstruction = false;
|
||||
version.decoding = false;
|
||||
version.png = png;
|
||||
if (png == null && !_versions.any((v) => v.png != null)) {
|
||||
// Nothing has ever decoded here: treat the device as unable to
|
||||
// preview and fall back to showing the original.
|
||||
_previewUnavailable = true;
|
||||
_showOriginal = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<Uint8List?> _encode() async {
|
||||
final cached = _encoded;
|
||||
if (cached != null) return cached;
|
||||
void _select(int index) {
|
||||
setState(() {
|
||||
_encoding = true;
|
||||
_failed = false;
|
||||
_selected = index;
|
||||
_showOriginal = false;
|
||||
});
|
||||
try {
|
||||
final bytes = await widget.codec.encode(
|
||||
widget.imageBytes,
|
||||
kImageSendRatePoint,
|
||||
);
|
||||
if (!mounted) return bytes;
|
||||
setState(() {
|
||||
_encoded = bytes;
|
||||
_encoding = false;
|
||||
});
|
||||
return bytes;
|
||||
} catch (_) {
|
||||
if (!mounted) return null;
|
||||
setState(() {
|
||||
_encoding = false;
|
||||
_failed = true;
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
ImageSendRadio _radioParams(BuildContext context) {
|
||||
@@ -264,7 +292,7 @@ class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
|
||||
}
|
||||
|
||||
_RateEstimate _estimateFor(ImageSendRadio radio) {
|
||||
final bytes = _encoded;
|
||||
final bytes = _current?.payload;
|
||||
if (bytes != null) {
|
||||
final exact = _estimate(bytes.length, radio);
|
||||
return _RateEstimate(
|
||||
@@ -293,14 +321,11 @@ class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _onSend() async {
|
||||
void _onSend() {
|
||||
final version = _current;
|
||||
final payload = version?.payload;
|
||||
if (version == null || payload == null) return;
|
||||
setState(() => _sending = true);
|
||||
final payload = await _encode();
|
||||
if (!mounted) return;
|
||||
if (payload == null) {
|
||||
setState(() => _sending = false);
|
||||
return;
|
||||
}
|
||||
final radio = _radio ?? const ImageSendRadio();
|
||||
final estimate = _estimate(payload.length, radio);
|
||||
Navigator.of(context).pop(
|
||||
@@ -311,6 +336,7 @@ class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
|
||||
packetCount: estimate.chunkCount,
|
||||
airtime: estimate.totalAirtime,
|
||||
wallClock: estimate.pacedWallClock,
|
||||
previewPng: version.png,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -375,7 +401,7 @@ class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
|
||||
..._warnings(theme, colors, radio, selected),
|
||||
const SizedBox(height: 4),
|
||||
_parityTile(theme, colors),
|
||||
if (_failed) ...[
|
||||
if (_current?.failed ?? false) ...[
|
||||
const SizedBox(height: 12),
|
||||
_banner(
|
||||
colors: colors,
|
||||
@@ -408,6 +434,9 @@ class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
|
||||
),
|
||||
);
|
||||
|
||||
/// The main preview: by default the selected version as recipients
|
||||
/// will see it, with the original one tap away for comparison.
|
||||
///
|
||||
/// The preview is deliberately capped in height: the packet count and airtime
|
||||
/// below it are the reason this screen exists and must not be pushed off the
|
||||
/// first screenful by a full-width square.
|
||||
@@ -419,59 +448,96 @@ class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
|
||||
) {
|
||||
final l10n = context.l10n;
|
||||
final maxSide = MediaQuery.sizeOf(context).height * 0.28;
|
||||
final reconstruction = _showReconstruction ? _reconstruction : null;
|
||||
final version = _current;
|
||||
final canPreview = ready && !_previewUnavailable;
|
||||
final showReconstruction = canPreview && !_showOriginal && version != null;
|
||||
final png = showReconstruction ? version.png : null;
|
||||
final pending =
|
||||
showReconstruction &&
|
||||
png == null &&
|
||||
(version.encoding || version.decoding);
|
||||
final broken = showReconstruction && png == null && !pending;
|
||||
|
||||
Widget content;
|
||||
if (pending) {
|
||||
content = Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
l10n.imageSend_preparingPreview,
|
||||
textAlign: TextAlign.center,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (broken) {
|
||||
content = Center(
|
||||
child: Icon(
|
||||
Icons.broken_image_outlined,
|
||||
size: 48,
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
content = Image.memory(
|
||||
png ?? widget.imageBytes,
|
||||
// The reconstruction is the stretched square; fill undoes the stretch
|
||||
// into the recipient's shape.
|
||||
fit: png != null ? BoxFit.fill : BoxFit.contain,
|
||||
alignment: Alignment.center,
|
||||
gaplessPlayback: true,
|
||||
errorBuilder: (context, error, stack) => Center(
|
||||
child: Icon(
|
||||
Icons.broken_image_outlined,
|
||||
size: 48,
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
if (ready) ...[
|
||||
if (canPreview) ...[
|
||||
SegmentedButton<bool>(
|
||||
segments: [
|
||||
ButtonSegment(
|
||||
value: false,
|
||||
label: MeshSegmentLabel(l10n.imageSend_viewOriginal),
|
||||
label: MeshSegmentLabel(l10n.imageSend_viewReconstruction),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: true,
|
||||
label: MeshSegmentLabel(l10n.imageSend_viewReconstruction),
|
||||
enabled: _encoded != null && !_reconstructionUnavailable,
|
||||
label: MeshSegmentLabel(l10n.imageSend_viewOriginal),
|
||||
),
|
||||
],
|
||||
selected: {_showReconstruction},
|
||||
onSelectionChanged: (s) => _selectView(s.first),
|
||||
selected: {_showOriginal},
|
||||
onSelectionChanged: (s) => setState(() => _showOriginal = s.first),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: maxSide, maxWidth: maxSide),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(MeshRadii.md),
|
||||
child: AspectRatio(
|
||||
aspectRatio: reconstruction != null ? _recipientAspect : _aspect,
|
||||
child: Container(
|
||||
aspectRatio: showReconstruction ? _recipientAspect : _aspect,
|
||||
child: ColoredBox(
|
||||
color: colors.surfaceContainerHighest,
|
||||
child: _showReconstruction && _reconstructing
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: Image.memory(
|
||||
reconstruction ?? widget.imageBytes,
|
||||
// The reconstruction is the stretched square; fill
|
||||
// undoes the stretch into the recipient's shape.
|
||||
fit: reconstruction != null
|
||||
? BoxFit.fill
|
||||
: BoxFit.contain,
|
||||
alignment: Alignment.center,
|
||||
gaplessPlayback: true,
|
||||
errorBuilder: (context, error, stack) => Center(
|
||||
child: Icon(
|
||||
Icons.broken_image_outlined,
|
||||
size: 48,
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: content,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (_reconstructionUnavailable) ...[
|
||||
if (_previewUnavailable) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
l10n.imageSend_reconstructionUnavailable,
|
||||
@@ -481,6 +547,10 @@ class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
|
||||
),
|
||||
),
|
||||
],
|
||||
if (canPreview && _versions.isNotEmpty) ...[
|
||||
const SizedBox(height: 16),
|
||||
_versionsRow(theme, colors),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
l10n.imageSend_lossyNote(
|
||||
@@ -496,6 +566,152 @@ class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
|
||||
);
|
||||
}
|
||||
|
||||
/// The versions made so far, plus "Try another version".
|
||||
Widget _versionsRow(ThemeData theme, ColorScheme colors) {
|
||||
final l10n = context.l10n;
|
||||
return Column(
|
||||
children: [
|
||||
Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
for (var i = 0; i < _versions.length; i++)
|
||||
_versionTile(theme, colors, i),
|
||||
],
|
||||
),
|
||||
if (_versions.length < kImageSendMaxVersions) ...[
|
||||
const SizedBox(height: 12),
|
||||
OutlinedButton.icon(
|
||||
onPressed: (_working || _sending) ? null : _addVersion,
|
||||
icon: const Icon(Icons.refresh),
|
||||
label: Text(l10n.imageSend_tryAnother),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
l10n.imageSend_versionsHint,
|
||||
textAlign: TextAlign.center,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// One selectable version: its reconstruction, "Version n" and its packet
|
||||
/// count. Selection shows as a thick primary border plus a check badge, so
|
||||
/// it never relies on colour alone.
|
||||
Widget _versionTile(ThemeData theme, ColorScheme colors, int index) {
|
||||
final l10n = context.l10n;
|
||||
final version = _versions[index];
|
||||
final selected = index == _selected;
|
||||
final label = l10n.imageSend_versionLabel(index + 1);
|
||||
const maxSide = 80.0;
|
||||
final aspect = _recipientAspect;
|
||||
final width = aspect >= 1 ? maxSide : maxSide * aspect;
|
||||
final height = aspect >= 1 ? maxSide / aspect : maxSide;
|
||||
final payload = version.payload;
|
||||
final packets = payload == null
|
||||
? null
|
||||
: _estimate(
|
||||
payload.length,
|
||||
_radio ?? const ImageSendRadio(),
|
||||
).chunkCount;
|
||||
|
||||
final Widget thumb;
|
||||
if (version.png != null) {
|
||||
thumb = Image.memory(
|
||||
version.png!,
|
||||
fit: BoxFit.fill,
|
||||
gaplessPlayback: true,
|
||||
);
|
||||
} else if (version.encoding || version.decoding) {
|
||||
thumb = const Center(
|
||||
child: SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
thumb = Icon(Icons.broken_image_outlined, color: colors.onSurfaceVariant);
|
||||
}
|
||||
|
||||
return Semantics(
|
||||
button: true,
|
||||
selected: selected,
|
||||
label: label,
|
||||
excludeSemantics: true,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(MeshRadii.sm),
|
||||
onTap: _sending ? null : () => _select(index),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: width.clamp(48.0, maxSide),
|
||||
height: height.clamp(48.0, maxSide),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(MeshRadii.sm),
|
||||
border: Border.all(
|
||||
color: selected
|
||||
? colors.primary
|
||||
: colors.outlineVariant,
|
||||
width: selected ? 3 : 1,
|
||||
),
|
||||
),
|
||||
child: thumb,
|
||||
),
|
||||
if (selected)
|
||||
Positioned(
|
||||
top: 4,
|
||||
right: 4,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(2),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.primary,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
size: 16,
|
||||
color: colors.onPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
label,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: selected ? colors.onSurface : colors.onSurfaceVariant,
|
||||
fontWeight: selected ? FontWeight.w600 : null,
|
||||
),
|
||||
),
|
||||
if (packets != null)
|
||||
Text(
|
||||
l10n.imageSend_versionPackets(packets),
|
||||
style: MeshTheme.mono(
|
||||
fontSize: 12,
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _sizeRow(ThemeData theme, ColorScheme colors, _RateEstimate estimate) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -794,7 +1010,8 @@ class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
|
||||
|
||||
Widget _actions(ThemeData theme, bool ready) {
|
||||
final localizations = context.l10n;
|
||||
final busy = _sending || _encoding;
|
||||
final busy = _sending || (_current?.encoding ?? false);
|
||||
final canSend = ready && !_sending && _current?.payload != null;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 16),
|
||||
child: Row(
|
||||
@@ -810,7 +1027,7 @@ class _ImageSendPreviewSheetState extends State<ImageSendPreviewSheet> {
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: FilledButton.icon(
|
||||
onPressed: (!ready || busy) ? null : _onSend,
|
||||
onPressed: canSend ? _onSend : null,
|
||||
icon: busy
|
||||
? const SizedBox(
|
||||
width: 16,
|
||||
|
||||
@@ -19,10 +19,13 @@
|
||||
///
|
||||
/// Both are private to this file, are not parameterised, and are reused
|
||||
/// verbatim by the full-screen viewer this widget opens on tap, so there is no
|
||||
/// route in the app that can show the pixels without them. The only case in
|
||||
/// which they are absent is [ReceivedImageEntry.isOutgoing], where the PNG is
|
||||
/// the sender's own 512x512 crop and the label would be a falsehood — that is
|
||||
/// read from the store's sidecar, never from a constructor argument.
|
||||
/// route in the app that can show the pixels without them. They are absent
|
||||
/// only when [ReceivedImageEntry.synthesized] is false: the sender's own image
|
||||
/// on a device that could not decode, where the PNG is their stretched
|
||||
/// original and the label would be a falsehood. The sender's own image is
|
||||
/// otherwise the decoded version they picked, so it is labelled like any
|
||||
/// other. That is read from the store's sidecar, never from a constructor
|
||||
/// argument.
|
||||
///
|
||||
/// The widget deliberately exposes no share/save action: an exported raster
|
||||
/// would have to have the caption composited into it first, and that belongs
|
||||
|
||||
Reference in new issue
Block a user