feat(block2): offline outbox — share now, publish when connected

Sender-side offline delivery hardening.
- OfferOutbox: a keystore-backed (no plaintext) queue of lot ids to publish
  later. Stores ids, not offers, so on flush each offer is rebuilt from the
  lot's CURRENT state — an offline edit is respected, a deleted lot drops out.
- flushOutbox(): on reconnect, republishes queued lots and clears them (no-op
  offline; drops ids whose lot is gone).
- Market screen: sharing offline parks the lots ('we'll share these when you're
  connected'); opening the market online auto-flushes the queue first.
- Wired via DI + TaneApp(outbox); i18n en/es/pt.

Tests: 4 outbox + 3 flush + market UI, 20 green. Analyzer clean for new code.
This commit is contained in:
vjrj 2026-07-10 10:45:53 +02:00
parent 2a6b4b0947
commit cf5d0243ee
15 changed files with 222 additions and 8 deletions

View file

@ -8,6 +8,7 @@ import 'data/species_repository.dart';
import 'data/variety_repository.dart';
import 'i18n/strings.g.dart';
import 'services/coarse_location.dart';
import 'services/offer_outbox.dart';
import 'services/onboarding_store.dart';
import 'services/social_service.dart';
import 'services/social_settings.dart';
@ -33,6 +34,7 @@ class TaneApp extends StatelessWidget {
this.social,
this.socialSettings,
this.location,
this.outbox,
this.showIntro = false,
super.key,
}) : _router = _buildRouter(
@ -42,6 +44,7 @@ class TaneApp extends StatelessWidget {
social,
socialSettings,
location,
outbox,
);
final VarietyRepository repository;
@ -55,6 +58,9 @@ class TaneApp extends StatelessWidget {
/// Optional device-location source for the market's "use my location".
final CoarseLocationProvider? location;
/// Optional offline outbox for the market's "share my seeds".
final OfferOutbox? outbox;
final bool showIntro;
final GoRouter _router;
@ -65,6 +71,7 @@ class TaneApp extends StatelessWidget {
SocialService? social,
SocialSettings? socialSettings,
CoarseLocationProvider? location,
OfferOutbox? outbox,
) {
return GoRouter(
initialLocation: showIntro ? '/intro' : '/',
@ -81,6 +88,7 @@ class TaneApp extends StatelessWidget {
social: social,
settings: socialSettings,
location: location,
outbox: outbox,
),
),
GoRoute(