feat(block2): messages inbox + drawer 'Chat' link (was unreachable)

Chat was only reachable via an offer's 'Message' button, and the drawer 'Chat'
sat on 'coming soon' — so messaging/trust were effectively hidden.
- MessageStore keeps a conversation index (the keystore has no key enumeration)
  and exposes conversations() — peers newest-active-first with their last line.
- ChatListScreen: the messages inbox (tap a conversation → /chat/:pubkey).
- Drawer 'Chat' is now a live destination -> /messages (gated like Market).
- i18n en/es/pt. conversations() covered by a plain test (no widget hang).

Analyzer clean.
This commit is contained in:
vjrj 2026-07-10 12:26:33 +02:00
parent 6d16656911
commit 7f1c520960
12 changed files with 211 additions and 3 deletions

View file

@ -34,6 +34,18 @@ void main() {
expect((await store.history('b')).single.text, 'toB');
});
test('conversations lists peers newest-first with their last message',
() async {
await store.append('peerA', msg('me', 'hi A', 1000));
await store.append('peerB', msg('peerB', 'yo B', 3000));
await store.append('peerA', msg('peerA', 'back A', 2000));
final convos = await store.conversations();
expect(convos.map((c) => c.peerPubkey), ['peerB', 'peerA']); // 3000 > 2000
expect(convos.first.lastText, 'yo B');
expect(convos.last.lastText, 'back A');
});
test('history is capped to the most recent 200', () async {
for (var i = 0; i < 210; i++) {
await store.append('peer', msg('me', 'm$i', i));