feat(#1030): reach Share logs and About from the connect screen
A radio that will not connect is exactly when a user needs the log, and the only way to it ran through device Settings, which needs a connected radio. The scanner now has a settings icon that opens an app-only settings screen: App Settings, Debug (Share logs, the logging switch, both log viewers) and About. Navigation only. How logs are written is untouched: Share logs calls the same LogExport.shareLogs the log screens use, on the same on-disk file. The device Settings screen keeps every category. Its About pane and the app-level Debug rows moved into AboutView and DebugLogTiles, which both screens now share; Device CLI, Serial capture and Mesh topology need the radio and stay in device Settings only. Export failures now persist until dismissed and are logged: "No log available to export" was a 4-second snackbar, and a share or save that threw had no handler at all. New owner-approved string: debugLog_exportFailed. Other locales fall back to English per untranslated.json. Tests pin both sides with the radio disconnected: Share logs hands the on-disk file to the share sheet, About shows the version, no device category or radio row appears, both error messages persist, and device Settings still has everything. Each check was made to fail against a deliberately broken build first. Part of Epic #693. Agent: BrightDog (session 38fb0e08) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>fix/1033-scan-location-message
parent
3ed11e00e4
commit
92a9cd75a2
@ -0,0 +1,134 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../helpers/snack_bar_builder.dart';
|
||||
import '../../l10n/l10n.dart';
|
||||
|
||||
/// The About pane: app identity, version, outbound links and licenses.
|
||||
///
|
||||
/// Needs no radio, so both the device Settings screen and the app-only
|
||||
/// settings reachable from the scanner show it (#693). Outbound links
|
||||
/// (offband.org / Play / donate) added by #527.
|
||||
class AboutView extends StatefulWidget {
|
||||
const AboutView({super.key});
|
||||
|
||||
@override
|
||||
State<AboutView> createState() => _AboutViewState();
|
||||
}
|
||||
|
||||
class _AboutViewState extends State<AboutView> {
|
||||
String _appVersion = '';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadVersionInfo();
|
||||
}
|
||||
|
||||
Future<void> _loadVersionInfo() async {
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_appVersion = '${packageInfo.version}+${packageInfo.buildNumber}';
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
return ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
Card(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.info_outline),
|
||||
title: Text(l10n.appTitle),
|
||||
subtitle: Text(
|
||||
l10n.settings_aboutVersion(
|
||||
_appVersion.isEmpty ? l10n.common_loading : _appVersion,
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(l10n.settings_aboutDescription),
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
l10n.settings_aboutLegalese,
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
l10n.settings_aboutPresetsAttribution,
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.language),
|
||||
title: Text(l10n.settings_aboutWebsite),
|
||||
trailing: const Icon(Icons.open_in_new, size: 18),
|
||||
onTap: () => _openExternalUrl('https://offband.org'),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.shop_outlined),
|
||||
title: Text(l10n.settings_aboutPlayStore),
|
||||
trailing: const Icon(Icons.open_in_new, size: 18),
|
||||
onTap: () => _openExternalUrl(
|
||||
'https://play.google.com/store/apps/details?id=app.offband.meshcore',
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.favorite_outline),
|
||||
title: Text(l10n.settings_aboutDonate),
|
||||
trailing: const Icon(Icons.open_in_new, size: 18),
|
||||
onTap: () => _openExternalUrl('https://offband.org/donate'),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.description_outlined),
|
||||
title: Text(l10n.settings_aboutLicenses),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () => showLicensePage(
|
||||
context: context,
|
||||
applicationName: l10n.appTitle,
|
||||
applicationVersion: _appVersion.isEmpty ? null : _appVersion,
|
||||
applicationLegalese: l10n.settings_aboutLegalese,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _openExternalUrl(String url) async {
|
||||
try {
|
||||
if (await launchUrl(
|
||||
Uri.parse(url),
|
||||
mode: LaunchMode.externalApplication,
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
} catch (_) {
|
||||
// fall through to the failure message
|
||||
}
|
||||
if (mounted) {
|
||||
showDismissibleSnackBar(
|
||||
context,
|
||||
content: Text(context.l10n.settings_aboutLinkFailed),
|
||||
persist: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../l10n/l10n.dart';
|
||||
import 'about_view.dart';
|
||||
import 'app_settings_view.dart';
|
||||
import 'debug_logs_view.dart';
|
||||
import 'settings_shell.dart';
|
||||
|
||||
/// The settings that need no radio, opened from the scanner (#693).
|
||||
///
|
||||
/// A user whose radio will not connect still has to be able to share the log,
|
||||
/// so this offers only app-level categories. Everything that reads or writes
|
||||
/// the radio stays in the device Settings screen, which is reachable only
|
||||
/// while connected. Add a category here only if it works with no radio.
|
||||
class AppOnlySettingsScreen extends StatelessWidget {
|
||||
const AppOnlySettingsScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
return SettingsShell(
|
||||
title: l10n.settings_title,
|
||||
categories: [
|
||||
SettingsCategory(
|
||||
icon: Icons.tune,
|
||||
title: l10n.settings_appSettings,
|
||||
subtitle: l10n.settings_appSettingsSubtitle,
|
||||
builder: (_) => const AppSettingsView(),
|
||||
),
|
||||
SettingsCategory(
|
||||
icon: Icons.build_outlined,
|
||||
title: l10n.settings_debug,
|
||||
builder: (_) => const DebugLogsView(),
|
||||
),
|
||||
SettingsCategory(
|
||||
icon: Icons.info_outline,
|
||||
title: l10n.settings_about,
|
||||
builder: (_) => const AboutView(),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,136 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../helpers/snack_bar_builder.dart';
|
||||
import '../../l10n/l10n.dart';
|
||||
import '../../services/app_debug_log_service.dart';
|
||||
import '../../services/app_settings_service.dart';
|
||||
import '../../utils/log_export.dart';
|
||||
import '../app_debug_log_screen.dart';
|
||||
import '../ble_debug_log_screen.dart';
|
||||
|
||||
/// The radio-independent rows of the Debug pane: share the log, the app debug
|
||||
/// logging switch, and the two log viewers.
|
||||
///
|
||||
/// Split out of the device Settings Debug pane (#693) so the scanner's
|
||||
/// app-only settings can offer them with no radio connected. The radio rows
|
||||
/// (Device CLI, serial capture, mesh topology) stay in device Settings.
|
||||
class DebugLogTiles extends StatelessWidget {
|
||||
const DebugLogTiles({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = context.l10n;
|
||||
final settingsService = context.watch<AppSettingsService>();
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: Icon(LogExport.icon),
|
||||
title: Text(LogExport.tooltip(context)),
|
||||
onTap: () => LogExport.shareLogs(
|
||||
context,
|
||||
webContent: () => LogExport.appLogText(
|
||||
context.read<AppDebugLogService>().entries.reversed,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
SwitchListTile(
|
||||
secondary: const Icon(Icons.bug_report_outlined),
|
||||
title: Text(l10n.appSettings_appDebugLogging),
|
||||
subtitle: Text(l10n.appSettings_appDebugLoggingSubtitle),
|
||||
value: settingsService.settings.appDebugLogEnabled,
|
||||
onChanged: (value) async {
|
||||
try {
|
||||
await settingsService.setAppDebugLogEnabled(value);
|
||||
} catch (_) {
|
||||
if (context.mounted) {
|
||||
showDismissibleSnackBar(
|
||||
context,
|
||||
content: const Text(
|
||||
'Could not change debug logging. Please try again.',
|
||||
),
|
||||
persist: true,
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!context.mounted) return;
|
||||
showDismissibleSnackBar(
|
||||
context,
|
||||
content: Text(
|
||||
value
|
||||
? l10n.appSettings_appDebugLoggingEnabled
|
||||
: l10n.appSettings_appDebugLoggingDisabled,
|
||||
),
|
||||
duration: const Duration(seconds: 2),
|
||||
);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.bluetooth_outlined),
|
||||
title: Text(l10n.settings_companionDebugLog),
|
||||
subtitle: Text(l10n.settings_companionDebugLogSubtitle),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const BleDebugLogScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.code_outlined),
|
||||
title: Text(l10n.settings_appDebugLog),
|
||||
subtitle: Text(l10n.settings_appDebugLogSubtitle),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const AppDebugLogScreen(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The Debug pane of the app-only settings: the log rows in their own card.
|
||||
class DebugLogsView extends StatelessWidget {
|
||||
const DebugLogsView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
Card(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 8),
|
||||
child: Text(
|
||||
context.l10n.settings_debug,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
const DebugLogTiles(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,333 @@
|
||||
// Pins #693: with no radio connected, the scanner reaches the app-level
|
||||
// settings (Share logs, the log viewers, About) and nothing that needs the
|
||||
// radio. Share logs must hand over the same on-disk log file the log screens
|
||||
// export, and an export that cannot happen must say so until dismissed.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meshcore_open/connector/meshcore_connector.dart';
|
||||
import 'package:meshcore_open/l10n/app_localizations.dart';
|
||||
import 'package:meshcore_open/screens/scanner_screen.dart';
|
||||
import 'package:meshcore_open/screens/settings/app_only_settings_screen.dart';
|
||||
import 'package:meshcore_open/screens/settings_screen.dart';
|
||||
import 'package:meshcore_open/services/app_debug_log_service.dart';
|
||||
import 'package:meshcore_open/services/app_settings_service.dart';
|
||||
import 'package:meshcore_open/services/file_log_service.dart';
|
||||
import 'package:meshcore_open/storage/drift/blob_store.dart';
|
||||
import 'package:meshcore_open/storage/drift/offband_database.dart';
|
||||
import 'package:meshcore_open/storage/prefs_manager.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
const _pathProvider = MethodChannel('plugins.flutter.io/path_provider');
|
||||
const _share = MethodChannel('dev.fluttercommunity.plus/share');
|
||||
|
||||
late Directory _supportDir;
|
||||
|
||||
/// Every share the app asked the OS for, as the paths it handed over.
|
||||
final List<List<String>> _shared = [];
|
||||
|
||||
/// When set, the share sheet fails the way a platform error would.
|
||||
bool _shareThrows = false;
|
||||
|
||||
Widget _app(MeshCoreConnector connector, Widget home) {
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider<MeshCoreConnector>.value(value: connector),
|
||||
ChangeNotifierProvider<AppSettingsService>(
|
||||
create: (_) => AppSettingsService(),
|
||||
),
|
||||
ChangeNotifierProvider<AppDebugLogService>(
|
||||
create: (_) => AppDebugLogService(),
|
||||
),
|
||||
],
|
||||
child: MaterialApp(
|
||||
locale: const Locale('en'),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: home,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _narrowView(WidgetTester tester) {
|
||||
tester.view.physicalSize = const Size(400, 900);
|
||||
tester.view.devicePixelRatio = 1.0;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
}
|
||||
|
||||
AppLocalizations _l10n(WidgetTester tester, Type screen) =>
|
||||
AppLocalizations.of(tester.element(find.byType(screen)));
|
||||
|
||||
/// From a scanner with no radio, open the settings gear.
|
||||
Future<AppLocalizations> _openFromScanner(WidgetTester tester) async {
|
||||
_narrowView(tester);
|
||||
final connector = MeshCoreConnector();
|
||||
expect(connector.state, MeshCoreConnectionState.disconnected);
|
||||
await tester.pumpWidget(_app(connector, const ScannerScreen()));
|
||||
await tester.pumpAndSettle();
|
||||
final l10n = _l10n(tester, ScannerScreen);
|
||||
await tester.tap(find.byTooltip(l10n.settings_title));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byType(AppOnlySettingsScreen), findsOneWidget);
|
||||
return l10n;
|
||||
}
|
||||
|
||||
/// Run the real-IO export in the real zone and wait for it to settle, either
|
||||
/// at the share sheet or at a message on screen.
|
||||
Future<void> _tapShareAndSettle(WidgetTester tester, String label) async {
|
||||
final before = _shared.length;
|
||||
await tester.runAsync(() async {
|
||||
await tester.tap(find.text(label));
|
||||
for (var i = 0; i < 100 && _shared.length == before; i++) {
|
||||
await Future<void>.delayed(const Duration(milliseconds: 20));
|
||||
}
|
||||
});
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
/// Drain ScannerScreen's dispose-time disconnect before teardown.
|
||||
Future<void> _unmount(WidgetTester tester) async {
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
await tester.pump(const Duration(milliseconds: 60));
|
||||
}
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
setUpAll(() async {
|
||||
_supportDir = Directory.systemTemp.createTempSync('offband_693_');
|
||||
final messenger =
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger;
|
||||
messenger.setMockMethodCallHandler(_pathProvider, (call) async {
|
||||
if (call.method == 'getApplicationSupportDirectory') {
|
||||
return _supportDir.path;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
messenger.setMockMethodCallHandler(_share, (call) async {
|
||||
if (_shareThrows) {
|
||||
throw PlatformException(code: 'share_failed');
|
||||
}
|
||||
_shared.add(List<String>.from((call.arguments as Map)['paths'] as List));
|
||||
return 'dev.fluttercommunity.plus/share/success';
|
||||
});
|
||||
await FileLogService.instance.init();
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
await FileLogService.instance.dispose();
|
||||
if (_supportDir.existsSync()) _supportDir.deleteSync(recursive: true);
|
||||
});
|
||||
|
||||
setUp(() async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
PrefsManager.reset();
|
||||
await PrefsManager.initialize();
|
||||
PackageInfo.setMockInitialValues(
|
||||
appName: 'Offband Meshcore',
|
||||
packageName: 'app.offband.meshcore',
|
||||
version: '9.9.9',
|
||||
buildNumber: '99',
|
||||
buildSignature: '',
|
||||
);
|
||||
_shareThrows = false;
|
||||
});
|
||||
|
||||
group('with no radio connected, the scanner', () {
|
||||
testWidgets('opens app-only settings: App Settings, Debug, About', (
|
||||
tester,
|
||||
) async {
|
||||
final l10n = await _openFromScanner(tester);
|
||||
|
||||
expect(find.text(l10n.settings_appSettings), findsOneWidget);
|
||||
expect(find.text(l10n.settings_debug), findsOneWidget);
|
||||
expect(find.text(l10n.settings_about), findsOneWidget);
|
||||
expect(find.byType(SettingsScreen), findsNothing);
|
||||
await _unmount(tester);
|
||||
});
|
||||
|
||||
testWidgets('offers no category that needs the radio', (tester) async {
|
||||
final l10n = await _openFromScanner(tester);
|
||||
|
||||
for (final deviceCategory in [
|
||||
l10n.settings_nodeSettings,
|
||||
l10n.settings_radioSettings,
|
||||
l10n.settings_location,
|
||||
l10n.radioStats_settingsTile,
|
||||
l10n.settings_privacy,
|
||||
l10n.contacts_title,
|
||||
l10n.block_settingsTitle,
|
||||
l10n.settings_messageSettings,
|
||||
'Observer',
|
||||
l10n.settings_deviceInfo,
|
||||
l10n.settings_actions,
|
||||
l10n.settings_experimental,
|
||||
]) {
|
||||
expect(find.text(deviceCategory), findsNothing, reason: deviceCategory);
|
||||
}
|
||||
await _unmount(tester);
|
||||
});
|
||||
|
||||
testWidgets('Debug has the log rows and none of the radio rows', (
|
||||
tester,
|
||||
) async {
|
||||
final l10n = await _openFromScanner(tester);
|
||||
await tester.tap(find.text(l10n.settings_debug));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text(l10n.debugLog_shareLog), findsOneWidget);
|
||||
expect(find.text(l10n.appSettings_appDebugLogging), findsOneWidget);
|
||||
expect(find.text(l10n.settings_companionDebugLog), findsOneWidget);
|
||||
expect(find.text(l10n.settings_appDebugLog), findsOneWidget);
|
||||
|
||||
expect(find.text(l10n.deviceCli_title), findsNothing);
|
||||
expect(find.text('Serial capture'), findsNothing);
|
||||
expect(find.text('Mesh topology'), findsNothing);
|
||||
await _unmount(tester);
|
||||
});
|
||||
|
||||
testWidgets('About shows the app version', (tester) async {
|
||||
final l10n = await _openFromScanner(tester);
|
||||
await tester.tap(find.text(l10n.settings_about));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text(l10n.settings_aboutVersion('9.9.9+99')), findsOneWidget);
|
||||
await _unmount(tester);
|
||||
});
|
||||
});
|
||||
|
||||
group('Share logs with no radio', () {
|
||||
testWidgets('hands the on-disk log file to the share sheet', (
|
||||
tester,
|
||||
) async {
|
||||
const marker = 'issue-693 marker line';
|
||||
FileLogService.instance.write(marker);
|
||||
final l10n = await _openFromScanner(tester);
|
||||
await tester.tap(find.text(l10n.settings_debug));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final sharesBefore = _shared.length;
|
||||
await _tapShareAndSettle(tester, l10n.debugLog_shareLog);
|
||||
|
||||
expect(_shared.length, sharesBefore + 1);
|
||||
final logDir = FileLogService.instance.logDir!.path;
|
||||
final handedOver = _shared.last;
|
||||
expect(handedOver, isNotEmpty);
|
||||
expect(handedOver.first, startsWith(logDir));
|
||||
final text = await tester.runAsync(
|
||||
() => File(handedOver.first).readAsString(),
|
||||
);
|
||||
expect(text, contains(marker));
|
||||
expect(find.text(l10n.debugLog_logUnavailable), findsNothing);
|
||||
expect(find.text(l10n.debugLog_exportFailed), findsNothing);
|
||||
await _unmount(tester);
|
||||
});
|
||||
|
||||
testWidgets('a failing share says so, and the message stays', (
|
||||
tester,
|
||||
) async {
|
||||
FileLogService.instance.write('issue-693 failing share');
|
||||
_shareThrows = true;
|
||||
final l10n = await _openFromScanner(tester);
|
||||
await tester.tap(find.text(l10n.settings_debug));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await _tapShareAndSettle(tester, l10n.debugLog_shareLog);
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
expect(find.text(l10n.debugLog_exportFailed), findsOneWidget);
|
||||
|
||||
// Well past the 4 second default: an error must wait to be dismissed.
|
||||
// Settle afterwards, or a timed-out message is caught mid-exit and
|
||||
// still found, and this check could never fail.
|
||||
await tester.pump(const Duration(seconds: 10));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(l10n.debugLog_exportFailed), findsOneWidget);
|
||||
await _unmount(tester);
|
||||
});
|
||||
|
||||
testWidgets('no log on disk says so, and the message stays', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.runAsync(() async {
|
||||
await FileLogService.instance.flushAndGetActiveFile();
|
||||
for (final f in FileLogService.instance.logDir!.listSync()) {
|
||||
f.deleteSync(recursive: true);
|
||||
}
|
||||
});
|
||||
final l10n = await _openFromScanner(tester);
|
||||
await tester.tap(find.text(l10n.settings_debug));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
final sharesBefore = _shared.length;
|
||||
await _tapShareAndSettle(tester, l10n.debugLog_shareLog);
|
||||
await tester.pump(const Duration(seconds: 1));
|
||||
expect(_shared.length, sharesBefore, reason: 'nothing to hand over');
|
||||
expect(find.text(l10n.debugLog_logUnavailable), findsOneWidget);
|
||||
|
||||
await tester.pump(const Duration(seconds: 10));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(l10n.debugLog_logUnavailable), findsOneWidget);
|
||||
await _unmount(tester);
|
||||
});
|
||||
});
|
||||
|
||||
group('device Settings, connected, is unchanged by the split', () {
|
||||
late OffbandDatabase db;
|
||||
late MeshCoreConnector connector;
|
||||
|
||||
setUp(() {
|
||||
db = OffbandDatabase(NativeDatabase.memory());
|
||||
BlobStore.overrideForTest(BlobStore(db));
|
||||
connector = MeshCoreConnector();
|
||||
connector.sendFrameOverrideForTest = (_) {};
|
||||
connector.setConnectedForTest();
|
||||
});
|
||||
|
||||
tearDown(() async {
|
||||
BlobStore.clearTestOverride();
|
||||
await db.close();
|
||||
});
|
||||
|
||||
testWidgets('keeps its device categories and its radio debug rows', (
|
||||
tester,
|
||||
) async {
|
||||
_narrowView(tester);
|
||||
await tester.pumpWidget(_app(connector, const SettingsScreen()));
|
||||
await tester.pumpAndSettle();
|
||||
final l10n = _l10n(tester, SettingsScreen);
|
||||
|
||||
for (final category in [
|
||||
l10n.settings_nodeSettings,
|
||||
l10n.settings_radioSettings,
|
||||
l10n.settings_deviceInfo,
|
||||
l10n.settings_actions,
|
||||
l10n.settings_debug,
|
||||
l10n.settings_about,
|
||||
]) {
|
||||
await tester.scrollUntilVisible(find.text(category), 200);
|
||||
expect(find.text(category), findsOneWidget, reason: category);
|
||||
}
|
||||
|
||||
await tester.tap(find.text(l10n.settings_debug));
|
||||
await tester.pumpAndSettle();
|
||||
for (final row in [
|
||||
l10n.debugLog_shareLog,
|
||||
l10n.appSettings_appDebugLogging,
|
||||
l10n.settings_companionDebugLog,
|
||||
l10n.settings_appDebugLog,
|
||||
'Serial capture',
|
||||
'Mesh topology',
|
||||
]) {
|
||||
await tester.scrollUntilVisible(find.text(row), 200);
|
||||
expect(find.text(row), findsOneWidget, reason: row);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Reference in new issue