fix(market): recover by itself when the shared connection comes up

Fresh installs could sit on 'can't reach the servers' forever: the offers
cubit captured the transport once at build time, the shared connection only
retried on a connectivity CHANGE, and a silently-filtered relay could stall
the pool for minutes.

- SocialConnection: retry with backoff after a failed attempt while started
  and not knowingly offline (injectable schedule for tests)
- OffersCubit: follow connection.sessions, re-attach the transport and re-run
  the last discovery on (re)connect; announce drops via connectionEpoch
- market _init: record the wanted area on the cubit even while offline
- NostrOfferTransport.discoverPage: sort a copy (channel lists may be
  unmodifiable)
This commit is contained in:
vjrj 2026-07-22 12:57:24 +02:00
parent 981cf10048
commit 8a7dc8d3dc
6 changed files with 273 additions and 9 deletions

View file

@ -122,10 +122,10 @@ class _MarketScreenState extends State<MarketScreen> {
_loading = false;
});
await previous?.close();
if (area.isNotEmpty && cubit.isOnline) {
if (area.isNotEmpty) {
// Flush anything parked while offline, then show what's out there.
final outbox = widget.outbox;
if (outbox != null && repo != null) {
if (outbox != null && repo != null && cubit.isOnline) {
await flushOutbox(
outbox: outbox,
cubit: cubit,
@ -136,6 +136,8 @@ class _MarketScreenState extends State<MarketScreen> {
}
if (mounted) {
final precision = await widget.settings.searchPrecision();
// Even when offline: this records the wanted area on the cubit, which
// re-runs the discovery by itself once the connection comes up.
if (mounted) await cubit.discover(searchPrefix(area, precision));
}
}