Add review mode with a simulated radio

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/
This commit is contained in:
zjs81 committed 2026-10-07 20:38:59 -07:00
1 parent 9334d556fe
commit 11c94040e3
68 files changed
+3314 -197

No files matched your search

+172 -156
View File
@@ -35,6 +35,7 @@ import 'community_qr_scanner_screen.dart';
import 'contacts_screen.dart';
import 'map_screen.dart';
import 'settings_screen.dart';
import '../review_mode/review_mode_banner.dart';
class ChannelsScreen extends StatefulWidget {
final bool hideBackButton;
@@ -166,172 +167,187 @@ class _ChannelsScreenState extends State<ChannelsScreen>
),
],
),
body: RefreshIndicator(
onRefresh: () async {
await context.read<MeshCoreConnector>().getChannels(force: true);
},
child: () {
final channels = connector.channels;
final waitingForFirstChannel =
connector.isLoadingChannels && channels.isEmpty;
body: Column(
children: [
const ReviewModeBanner(),
Expanded(
child: RefreshIndicator(
onRefresh: () async {
await context.read<MeshCoreConnector>().getChannels(
force: true,
);
},
child: () {
final channels = connector.channels;
final waitingForFirstChannel =
connector.isLoadingChannels && channels.isEmpty;
// Only block the list while the first channel is actively loading.
// If the initial sync aborts, show cached/partial channels instead
// of trapping the user behind an idle spinner.
if (waitingForFirstChannel) {
return const Center(child: CircularProgressIndicator());
}
// Only block the list while the first channel is actively loading.
// If the initial sync aborts, show cached/partial channels instead
// of trapping the user behind an idle spinner.
if (waitingForFirstChannel) {
return const Center(child: CircularProgressIndicator());
}
if (channels.isEmpty) {
return ListView(
children: [
SizedBox(
height: MediaQuery.of(context).size.height - 200,
child: EmptyState(
icon: Icons.tag,
title: context.l10n.channels_noChannelsConfigured,
action: FilledButton.icon(
onPressed: () => _addPublicChannel(context, connector),
icon: const Icon(Icons.public),
label: Text(context.l10n.channels_addPublicChannel),
),
),
),
],
);
}
if (channels.isEmpty) {
return ListView(
children: [
SizedBox(
height: MediaQuery.of(context).size.height - 200,
child: EmptyState(
icon: Icons.tag,
title: context.l10n.channels_noChannelsConfigured,
action: FilledButton.icon(
onPressed: () =>
_addPublicChannel(context, connector),
icon: const Icon(Icons.public),
label: Text(
context.l10n.channels_addPublicChannel,
),
),
),
),
],
);
}
final filteredChannels = _filterAndSortChannels(
channels,
connector,
viewState,
);
final filteredChannels = _filterAndSortChannels(
channels,
connector,
viewState,
);
return Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
controller: _searchController,
decoration: InputDecoration(
hintText: context.l10n.channels_searchChannels,
prefixIcon: const Icon(Icons.search),
suffixIcon: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (viewState.channelsSearchText.isNotEmpty)
IconButton(
icon: const Icon(Icons.clear),
tooltip: context.l10n.common_clearSearch,
onPressed: () {
_searchDebounce?.cancel();
_searchDebounce = null;
_searchController.clear();
return Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
controller: _searchController,
decoration: InputDecoration(
hintText: context.l10n.channels_searchChannels,
prefixIcon: const Icon(Icons.search),
suffixIcon: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (viewState.channelsSearchText.isNotEmpty)
IconButton(
icon: const Icon(Icons.clear),
tooltip: context.l10n.common_clearSearch,
onPressed: () {
_searchDebounce?.cancel();
_searchDebounce = null;
_searchController.clear();
context
.read<UiViewStateService>()
.setChannelsSearchText('');
},
),
_buildFilterButton(viewState),
],
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
),
),
onChanged: (value) {
_searchDebounce?.cancel();
_searchDebounce = Timer(
const Duration(milliseconds: 300),
() {
if (!mounted) return;
context
.read<UiViewStateService>()
.setChannelsSearchText('');
.setChannelsSearchText(value);
},
),
_buildFilterButton(viewState),
],
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
),
),
onChanged: (value) {
_searchDebounce?.cancel();
_searchDebounce = Timer(
const Duration(milliseconds: 300),
() {
if (!mounted) return;
context
.read<UiViewStateService>()
.setChannelsSearchText(value);
},
);
},
),
),
Expanded(
child: filteredChannels.isEmpty
? LayoutBuilder(
builder: (context, constraints) => ListView(
physics: const AlwaysScrollableScrollPhysics(),
children: [
ConstrainedBox(
constraints: BoxConstraints(
minHeight: constraints.maxHeight,
),
child: EmptyState(
icon: Icons.search_off,
title: context.l10n.channels_noChannelsFound,
),
),
],
),
)
: (viewState.channelsSortOption ==
ChannelSortOption.manual &&
viewState.channelsSearchText.isEmpty)
? ReorderableListView.builder(
padding: const EdgeInsets.only(
left: 0,
right: 0,
top: 8,
bottom: 88,
),
buildDefaultDragHandles: false,
itemCount: filteredChannels.length,
onReorderItem: (oldIndex, newIndex) {
final reordered = List<Channel>.from(
filteredChannels,
);
final item = reordered.removeAt(oldIndex);
reordered.insert(newIndex, item);
unawaited(
connector.setChannelOrder(
reordered.map((c) => c.index).toList(),
),
);
},
itemBuilder: (context, index) {
final channel = filteredChannels[index];
return _buildChannelTile(
context,
connector,
channelMessageStore,
channel,
showDragHandle: true,
dragIndex: index,
listIndex: index,
);
},
)
: ListView.builder(
padding: const EdgeInsets.only(
left: 0,
right: 0,
top: 8,
bottom: 88,
),
itemCount: filteredChannels.length,
itemBuilder: (context, index) {
final channel = filteredChannels[index];
return _buildChannelTile(
context,
connector,
channelMessageStore,
channel,
listIndex: index,
);
},
),
),
],
);
}(),
),
Expanded(
child: filteredChannels.isEmpty
? LayoutBuilder(
builder: (context, constraints) => ListView(
physics:
const AlwaysScrollableScrollPhysics(),
children: [
ConstrainedBox(
constraints: BoxConstraints(
minHeight: constraints.maxHeight,
),
child: EmptyState(
icon: Icons.search_off,
title: context
.l10n
.channels_noChannelsFound,
),
),
],
),
)
: (viewState.channelsSortOption ==
ChannelSortOption.manual &&
viewState.channelsSearchText.isEmpty)
? ReorderableListView.builder(
padding: const EdgeInsets.only(
left: 0,
right: 0,
top: 8,
bottom: 88,
),
buildDefaultDragHandles: false,
itemCount: filteredChannels.length,
onReorderItem: (oldIndex, newIndex) {
final reordered = List<Channel>.from(
filteredChannels,
);
final item = reordered.removeAt(oldIndex);
reordered.insert(newIndex, item);
unawaited(
connector.setChannelOrder(
reordered.map((c) => c.index).toList(),
),
);
},
itemBuilder: (context, index) {
final channel = filteredChannels[index];
return _buildChannelTile(
context,
connector,
channelMessageStore,
channel,
showDragHandle: true,
dragIndex: index,
listIndex: index,
);
},
)
: ListView.builder(
padding: const EdgeInsets.only(
left: 0,
right: 0,
top: 8,
bottom: 88,
),
itemCount: filteredChannels.length,
itemBuilder: (context, index) {
final channel = filteredChannels[index];
return _buildChannelTile(
context,
connector,
channelMessageStore,
channel,
listIndex: index,
);
},
),
),
],
);
}(),
),
),
],
),
floatingActionButton: FloatingActionButton(
onPressed: () => _showAddChannelDialog(context),
+7 -1
View File
@@ -37,6 +37,7 @@ import 'chat_screen.dart';
import 'contact_qr_scanner_screen.dart';
import 'discovery_screen.dart';
import 'map_screen.dart';
import '../review_mode/review_mode_banner.dart';
import 'repeater_hub_screen.dart';
import 'settings_screen.dart';
@@ -477,7 +478,12 @@ class _ContactsScreenState extends State<ContactsScreen>
),
],
),
body: _buildContactsBody(context, connector),
body: Column(
children: [
const ReviewModeBanner(),
Expanded(child: _buildContactsBody(context, connector)),
],
),
floatingActionButton: FloatingActionButton(
onPressed: () => _showAddContactSheet(context),
child: const Icon(Icons.person_add),
+2 -8
View File
@@ -819,10 +819,7 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen>
(c) =>
c.hasLocation &&
c.path.isNotEmpty &&
_matchesHopPrefix(
_lastHopChunk(c.path, c.pathHashWidth),
hop,
),
_matchesHopPrefix(_lastHopChunk(c.path, c.pathHashWidth), hop),
)
.toList();
if (peers.isEmpty) return null;
@@ -862,10 +859,7 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen>
if (record.pathBytes.isEmpty) continue;
final recordHops = PathHelper.splitPathBytes(
record.pathBytes,
Contact.inferPathHashWidth(
record.hopCount,
record.pathBytes.length,
),
Contact.inferPathHashWidth(record.hopCount, record.pathBytes.length),
);
if (!seen.add(_pathKeyForHops(recordHops))) continue;
if (altIndex >= kAlternatePathColors.length) break;
+4 -1
View File
@@ -15,6 +15,7 @@ import '../widgets/device_tile.dart';
import '../widgets/empty_state.dart';
import '../widgets/mesh_ui.dart';
import '../helpers/snack_bar_builder.dart';
import '../review_mode/review_mode_entry.dart';
import 'channels_screen.dart';
import 'tcp_screen.dart';
import 'usb_screen.dart';
@@ -103,7 +104,9 @@ class _ScannerScreenState extends State<ScannerScreen> {
},
)
: null,
title: AdaptiveAppBarTitle(context.l10n.scanner_title),
title: ReviewModeLongPress(
child: AdaptiveAppBarTitle(context.l10n.scanner_title),
),
centerTitle: true,
automaticallyImplyLeading: false,
actions: [