Store reviewers have no MeshCore radio, so they could not reach any screen past Connect or test the Android Auto messaging notifications. - Long-press the "MeshCore Open" title on the Connect screen to enter review mode on any platform - A simulated radio speaks the companion protocol as a fourth transport, so sync, messages, ACKs, notifications and notification replies run through the normal code paths - Seeded contacts, channels and history; a new incoming message every 45 s, auto-replies a few seconds after sending, and a banner with "Send test message" and "Exit" - Review data uses its own fixed key scope and is cleared on entry, exit and at startup; the review scope never adopts legacy unscoped keys, and channel mutes changed during review are restored - Code lives in lib/review_mode/ with tests in test/review_mode/
73 lines
2.3 KiB
Dart
73 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../connector/meshcore_connector.dart';
|
|
import '../l10n/l10n.dart';
|
|
import '../theme/mesh_theme.dart';
|
|
|
|
/// Strip shown on top of main screens while the simulated radio is active.
|
|
class ReviewModeBanner extends StatelessWidget {
|
|
const ReviewModeBanner({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final connector = context.watch<MeshCoreConnector>();
|
|
if (!connector.isReviewMode) return const SizedBox.shrink();
|
|
|
|
final l10n = context.l10n;
|
|
const textStyle = TextStyle(
|
|
color: MeshPalette.ink,
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w700,
|
|
);
|
|
final buttonStyle = TextButton.styleFrom(
|
|
foregroundColor: MeshPalette.warn,
|
|
textStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.w700),
|
|
minimumSize: const Size(48, 48),
|
|
);
|
|
|
|
return Container(
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
|
decoration: const BoxDecoration(
|
|
color: MeshPalette.bg3,
|
|
border: Border(bottom: BorderSide(color: MeshPalette.warnLine)),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
const Icon(Icons.science, color: MeshPalette.warn, size: 24),
|
|
const SizedBox(width: 8),
|
|
Expanded(child: Text(l10n.reviewMode_banner, style: textStyle)),
|
|
],
|
|
),
|
|
Wrap(
|
|
spacing: 8,
|
|
children: [
|
|
TextButton(
|
|
style: buttonStyle,
|
|
onPressed: () {
|
|
connector.sendReviewTestMessage();
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
SnackBar(content: Text(l10n.reviewMode_testSent)),
|
|
);
|
|
},
|
|
child: Text(l10n.reviewMode_sendTest),
|
|
),
|
|
TextButton(
|
|
style: buttonStyle,
|
|
// The screens hosting the banner return to the Connect screen
|
|
// themselves once disconnected.
|
|
onPressed: () => connector.disconnect(manual: true),
|
|
child: Text(l10n.reviewMode_exit),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|