Reception only ran inside an open ChatScreen for a known peer, so a first message from a new peer was invisible: nothing in local storage -> nothing in the inbox list -> you never opened the chat -> you never subscribed. Add InboxService: one long-lived NIP-17 inbox subscription for the whole app (foreground), persisting every incoming message to MessageStore and firing a 'changes' signal the inbox list live-reloads on. Reconnects when the network returns; degrades to nothing offline. Started from main when a social identity exists. Make MessageStore.append idempotent (dedup by sender+timestamp+text) and serialized behind a write lock — the global listener and an open chat's own subscription now write the same conversation concurrently and relays re-deliver stored gift wraps on every resubscribe. Tests for both. Known trade-offs (follow-ups): foreground-only (no push yet); each of InboxService/ChatScreen/MarketScreen opens its own RelayPool (a shared connection is a later optimization). |
||
|---|---|---|
| .. | ||
| data | ||
| db | ||
| domain | ||
| i18n | ||
| security | ||
| services | ||
| state | ||
| support | ||
| tool | ||
| ui | ||
| flutter_test_config.dart | ||