fix(block2): hide server config, enable drawer Market, badge my own offers

Three feedback fixes:
- Servers are fully hidden now — relays are managed automatically (default
  community servers; the pool skips dead ones). Sharing setup shows only 'your
  area'; no jargon-y URL field. (3 default relays for redundancy.)
- Drawer 'Market' is a live destination (was stuck on 'coming soon'), gated on
  the social layer being wired like the home card.
- My own listings in the market carry a 'You' badge (and no 'message yourself'
  button), so it's clear which offers are mine.

Analyzer clean. Note: could not run the flutter widget suite here (10+ min
compile after the geolocator native dep in this sandbox) — run 'flutter test'
locally to confirm; the You-badge test was simplified to be robust.
This commit is contained in:
vjrj 2026-07-10 11:56:55 +02:00
parent d369015e01
commit c513a6ce4b
12 changed files with 92 additions and 108 deletions

View file

@ -48,7 +48,7 @@ class FakeOfferTransport implements OfferTransport {
Future<void> close() async {}
}
Widget _wrapBody(OffersCubit cubit) {
Widget _wrapBody(OffersCubit cubit, {String? selfPubkey}) {
LocaleSettings.setLocaleSync(AppLocale.en);
return TranslationProvider(
child: MaterialApp(
@ -62,7 +62,7 @@ Widget _wrapBody(OffersCubit cubit) {
home: Scaffold(
body: BlocProvider.value(
value: cubit,
child: MarketBody(onConfigure: () {}),
child: MarketBody(onConfigure: () {}, selfPubkey: selfPubkey),
),
),
),
@ -78,6 +78,27 @@ Offer _offer(String id, String summary, OfferType type) => Offer(
);
void main() {
testWidgets('shows a "You" badge on my own listing', (tester) async {
const me = 'aa';
final cubit = OffersCubit(FakeOfferTransport([
Offer(
id: '1',
authorPubkeyHex: me,
summary: 'Mine',
type: OfferType.gift,
approxGeohash: 'sp3e9',
),
]));
await tester.pumpWidget(_wrapBody(cubit, selfPubkey: me));
await cubit.discover('sp3');
await tester.pumpAndSettle();
expect(find.text('You'), findsOneWidget);
// My own listing offers no "Message yourself" button.
expect(find.text('Message'), findsNothing);
await cubit.close();
});
testWidgets('renders discovered offers with their type', (tester) async {
final cubit = OffersCubit(FakeOfferTransport([
_offer('1', 'Tomate rosa de Barbastro', OfferType.gift),