mirror of
https://github.com/block/buzz.git
synced 2026-11-24 10:12:19 +00:00
A way to check that a build's diagnostic reporting works end to end, per
[mobile diagnostic
reporting](https://github.com/block/buzz/blob/main/docs/mobile-diagnostic-reporting.md).
A build with a reporting destination shows a Diagnostics card in
Settings with **Send test report** and **Test crash**. A build without
one, which includes every build from this repository alone, never shows
it and still reports nothing.
| Before | After |
| --- | --- |
| 
| 
|

### What's in it
- The reporter gains `reporting` (whether the build has a destination),
`sendTestReport()` and `crashForTest()`. The do-nothing reporter returns
false and does nothing.
- **Send test report** sends a fixed `DiagnosticTestError` tagged with a
new `testReport` operation. It passes through the same filter as every
report.
- **Test crash** asks for confirmation, then crashes in native code
through the SDK, so native crash reports can be checked too. The report
goes out the next time the app opens.
- The spec gains a "A way to check a build" decision.
### Regressions
None expected: builds without a destination render Settings exactly as
before.
### Validation
Added widget tests for the card being absent without reporting, sending
a test report, and the crash happening only once confirmed, plus a test
of what a sent test report contains and one that a second tap sends a
second report. The screenshots come from simulator builds of main and
this branch, both with the same placeholder destination.
A full-app simulator run at dec267f (placeholder destination) passed:
channel list, opening and scrolling a channel, search, the other
Settings sections, two test reports (a toast each time), cancelling Test
crash, confirming it (a native crash in the Sentry SDK) and relaunching
signed in.
---------
Signed-off-by: Tom Brow <tomb@block.xyz>
Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
45 lines
1.4 KiB
Dart
45 lines
1.4 KiB
Dart
part of '../settings_page.dart';
|
|
|
|
/// Checks that a build's diagnostic reporting works end to end. Shown only
|
|
/// in builds with a reporting destination, the internal dogfood builds.
|
|
class _DiagnosticsSection extends ConsumerWidget {
|
|
const _DiagnosticsSection();
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final reporter = ref.watch(diagnosticReporterProvider);
|
|
return AppListCard(
|
|
verticalPadding: Grid.twelve,
|
|
children: [
|
|
AppListRow(
|
|
key: const Key('settings-send-test-report'),
|
|
title: 'Send test report',
|
|
onTap: () {
|
|
reporter.sendTestReport();
|
|
ScaffoldMessenger.of(context).showFeedbackSnackBar(
|
|
const SnackBar(content: Text('Test report sent.')),
|
|
kind: ToastKind.success,
|
|
);
|
|
},
|
|
),
|
|
AppListRow(
|
|
key: const Key('settings-test-crash'),
|
|
title: 'Test crash',
|
|
titleColor: context.colors.error,
|
|
onTap: () async {
|
|
final confirmed = await showDestructiveConfirmation(
|
|
context: context,
|
|
title: 'Crash Buzz?',
|
|
message:
|
|
'Buzz closes at once. The crash report is sent the next '
|
|
'time you open it.',
|
|
confirmLabel: 'Crash',
|
|
);
|
|
if (confirmed) reporter.crashForTest();
|
|
},
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|