fix: Settings crash, photo preview before sending, incoming-content hardening

Settings crashed with a TypeError: the profile card passed a
SepotFingerprint object where the localized string formatter expects
a String (hidden behind a `dynamic` parameter). Also fixes RangeError
in avatar initials (empty names, double spaces) and switches initials
to grapheme clusters so emoji don't get split.

New photo preview screen: a captured or picked photo no longer sends
immediately — it opens in a preview with freehand drawing (7 colours,
undo), draggable text overlay, 90° rotation and a caption field.
Nothing leaves the device until Send is tapped.

Incoming-content hardening: decryption and content processing are now
separated in the delivery path. Once an envelope is decrypted the
ratchet has advanced, so redelivery can never help — permanently
malformed content (FormatException/TypeError) is acked and dropped
instead of poisoning the queue on every reconnect. Attachment metadata
now validates base64 of the crypto fields up front, and a corrupt
inline thumbnail no longer breaks bubble rendering.

PNG without real transparency (screenshots, edited photos) is now
re-encoded as JPEG — several times smaller on the wire.

Tests: 116 (new widget tests for Settings and the photo preview,
AttachmentMeta wire validation).
This commit is contained in:
Julius Joska
2026-07-13 08:15:01 +02:00
parent a60aaca326
commit 641d70b76e
24 changed files with 1299 additions and 41 deletions
@@ -2197,6 +2197,60 @@ abstract class AppLocalizations {
/// In cs, this message translates to:
/// **'End-to-end šifrováno'**
String get commonE2eBadgeFull;
/// hintText pole popisku na obrazovce náhledu fotky před odesláním
///
/// In cs, this message translates to:
/// **'Přidat popisek…'**
String get photoPreviewCaptionHint;
/// Tooltip nástroje kreslení prstem na náhledu fotky
///
/// In cs, this message translates to:
/// **'Kreslit'**
String get photoPreviewDraw;
/// Tooltip nástroje přidání textu na fotku
///
/// In cs, this message translates to:
/// **'Přidat text'**
String get photoPreviewAddText;
/// Tooltip otočení fotky o 90°
///
/// In cs, this message translates to:
/// **'Otočit'**
String get photoPreviewRotate;
/// Tooltip vrácení posledního tahu kreslení
///
/// In cs, this message translates to:
/// **'Zpět'**
String get photoPreviewUndo;
/// Tooltip tlačítka odeslání fotky z náhledu
///
/// In cs, this message translates to:
/// **'Poslat'**
String get photoPreviewSend;
/// Titulek dialogu pro zadání/úpravu textu na fotce
///
/// In cs, this message translates to:
/// **'Text na fotce'**
String get photoPreviewTextDialogTitle;
/// Tlačítko odebrání textu z fotky v dialogu úpravy
///
/// In cs, this message translates to:
/// **'Odebrat'**
String get photoPreviewRemoveText;
/// SnackBar, když se vybraná fotka nedá dekódovat — náhled se zavře bez odeslání
///
/// In cs, this message translates to:
/// **'Fotku se nepodařilo načíst'**
String get photoPreviewDecodeFailed;
}
class _AppLocalizationsDelegate
@@ -1248,4 +1248,31 @@ class AppLocalizationsCs extends AppLocalizations {
@override
String get commonE2eBadgeFull => 'End-to-end šifrováno';
@override
String get photoPreviewCaptionHint => 'Přidat popisek…';
@override
String get photoPreviewDraw => 'Kreslit';
@override
String get photoPreviewAddText => 'Přidat text';
@override
String get photoPreviewRotate => 'Otočit';
@override
String get photoPreviewUndo => 'Zpět';
@override
String get photoPreviewSend => 'Poslat';
@override
String get photoPreviewTextDialogTitle => 'Text na fotce';
@override
String get photoPreviewRemoveText => 'Odebrat';
@override
String get photoPreviewDecodeFailed => 'Fotku se nepodařilo načíst';
}
@@ -1270,4 +1270,31 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get commonE2eBadgeFull => 'Ende-zu-Ende-verschlüsselt';
@override
String get photoPreviewCaptionHint => 'Bildunterschrift hinzufügen…';
@override
String get photoPreviewDraw => 'Zeichnen';
@override
String get photoPreviewAddText => 'Text hinzufügen';
@override
String get photoPreviewRotate => 'Drehen';
@override
String get photoPreviewUndo => 'Rückgängig';
@override
String get photoPreviewSend => 'Senden';
@override
String get photoPreviewTextDialogTitle => 'Text auf dem Foto';
@override
String get photoPreviewRemoveText => 'Entfernen';
@override
String get photoPreviewDecodeFailed => 'Foto konnte nicht geladen werden';
}
@@ -1243,4 +1243,31 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get commonE2eBadgeFull => 'End-to-end encrypted';
@override
String get photoPreviewCaptionHint => 'Add a caption…';
@override
String get photoPreviewDraw => 'Draw';
@override
String get photoPreviewAddText => 'Add text';
@override
String get photoPreviewRotate => 'Rotate';
@override
String get photoPreviewUndo => 'Undo';
@override
String get photoPreviewSend => 'Send';
@override
String get photoPreviewTextDialogTitle => 'Text on photo';
@override
String get photoPreviewRemoveText => 'Remove';
@override
String get photoPreviewDecodeFailed => 'Couldn\'t load the photo';
}
@@ -1257,4 +1257,31 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get commonE2eBadgeFull => 'Cifrato end-to-end';
@override
String get photoPreviewCaptionHint => 'Aggiungi una didascalia…';
@override
String get photoPreviewDraw => 'Disegna';
@override
String get photoPreviewAddText => 'Aggiungi testo';
@override
String get photoPreviewRotate => 'Ruota';
@override
String get photoPreviewUndo => 'Annulla';
@override
String get photoPreviewSend => 'Invia';
@override
String get photoPreviewTextDialogTitle => 'Testo sulla foto';
@override
String get photoPreviewRemoveText => 'Rimuovi';
@override
String get photoPreviewDecodeFailed => 'Impossibile caricare la foto';
}
@@ -1282,4 +1282,31 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get commonE2eBadgeFull => 'Сквозное шифрование';
@override
String get photoPreviewCaptionHint => 'Добавить подпись…';
@override
String get photoPreviewDraw => 'Рисовать';
@override
String get photoPreviewAddText => 'Добавить текст';
@override
String get photoPreviewRotate => 'Повернуть';
@override
String get photoPreviewUndo => 'Отменить';
@override
String get photoPreviewSend => 'Отправить';
@override
String get photoPreviewTextDialogTitle => 'Текст на фото';
@override
String get photoPreviewRemoveText => 'Удалить';
@override
String get photoPreviewDecodeFailed => 'Не удалось загрузить фото';
}