mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-26 03:07:28 +01:00
app: report errors and slow waits to the board
crdt_sync_flutter 0.9.0 installAppErrors: uncaught errors and every loader over 1 s (WaitWatch) upload to RTDB with the versionCode; the PC app-errors ingest files board tickets. Bumps ssui 0.8.3, gda 0.5.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9663738843
commit
86e702b5e2
4
.github/workflows/release-apk.yml
vendored
4
.github/workflows/release-apk.yml
vendored
@ -108,7 +108,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
flutter build apk --release \
|
flutter build apk --release \
|
||||||
--build-name="${{ steps.ver.outputs.semver }}" \
|
--build-name="${{ steps.ver.outputs.semver }}" \
|
||||||
--build-number="${{ steps.vc.outputs.code }}"
|
--build-number="${{ steps.vc.outputs.code }}" \
|
||||||
|
--dart-define=APP_BUILD="${{ steps.vc.outputs.code }}" \
|
||||||
|
--dart-define=APP_VERSION="${{ steps.ver.outputs.semver }}"
|
||||||
|
|
||||||
# Fail closed. `findByName("release") ?: debug` silently falls back to
|
# Fail closed. `findByName("release") ?: debug` silently falls back to
|
||||||
# the debug key if key.properties is misplaced, producing a green build
|
# the debug key if key.properties is misplaced, producing a green build
|
||||||
|
|||||||
@ -3,6 +3,9 @@
|
|||||||
library;
|
library;
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:crdt_sync_flutter/crdt_sync_flutter.dart'
|
||||||
|
show AppErrors, AppErrorsConfig, AppErrorsRouteObserver, installAppErrors;
|
||||||
import 'package:diet_guard_app/screens/log_meal_screen.dart';
|
import 'package:diet_guard_app/screens/log_meal_screen.dart';
|
||||||
import 'package:diet_guard_app/services/app_settings_service.dart';
|
import 'package:diet_guard_app/services/app_settings_service.dart';
|
||||||
import 'package:diet_guard_app/services/background_tasks.dart';
|
import 'package:diet_guard_app/services/background_tasks.dart';
|
||||||
@ -10,6 +13,7 @@ import 'package:diet_guard_app/services/body_service.dart';
|
|||||||
import 'package:diet_guard_app/services/budget_history_service.dart';
|
import 'package:diet_guard_app/services/budget_history_service.dart';
|
||||||
import 'package:diet_guard_app/services/claude_relay_client.dart';
|
import 'package:diet_guard_app/services/claude_relay_client.dart';
|
||||||
import 'package:diet_guard_app/services/claude_relay_firebase.dart';
|
import 'package:diet_guard_app/services/claude_relay_firebase.dart';
|
||||||
|
import 'package:diet_guard_app/services/firebase_client.dart' show openFirebase;
|
||||||
import 'package:diet_guard_app/services/foodbank_service.dart';
|
import 'package:diet_guard_app/services/foodbank_service.dart';
|
||||||
import 'package:diet_guard_app/services/frame_stats.dart';
|
import 'package:diet_guard_app/services/frame_stats.dart';
|
||||||
import 'package:diet_guard_app/services/kuchnia_credential_service.dart';
|
import 'package:diet_guard_app/services/kuchnia_credential_service.dart';
|
||||||
@ -23,9 +27,27 @@ import 'package:material_ui/material_ui.dart';
|
|||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
// Every error and every wait over 1 s goes to the PC's app-errors ingest,
|
||||||
|
// which files a board ticket (kuhyx/utils DOCS-app-errors.md). The release
|
||||||
|
// build passes the versionCode and name as dart-defines (release-apk.yml).
|
||||||
|
final errors = await installAppErrors(
|
||||||
|
const AppErrorsConfig(
|
||||||
|
app: 'diet-guard',
|
||||||
|
repo: 'kuhyx/diet-guard',
|
||||||
|
package: 'diet_guard_app',
|
||||||
|
// 0 unless the release build passes --dart-define=APP_BUILD.
|
||||||
|
// ignore: avoid_redundant_argument_values
|
||||||
|
build: int.fromEnvironment('APP_BUILD'),
|
||||||
|
version: String.fromEnvironment('APP_VERSION'),
|
||||||
|
),
|
||||||
|
);
|
||||||
// Before anything that stamps an Hlc or syncs: until this resolves, the
|
// Before anything that stamps an Hlc or syncs: until this resolves, the
|
||||||
// device id falls back to the pre-migration role constant.
|
// device id falls back to the pre-migration role constant.
|
||||||
await initSyncDeviceId();
|
final deviceId = await initSyncDeviceId();
|
||||||
|
errors.connect(
|
||||||
|
sink: () async => (await openFirebase())?.patchValues,
|
||||||
|
deviceId: () async => deviceId,
|
||||||
|
);
|
||||||
await LogStorageService.init();
|
await LogStorageService.init();
|
||||||
await AppSettingsService.init();
|
await AppSettingsService.init();
|
||||||
await BudgetHistoryService.init();
|
await BudgetHistoryService.init();
|
||||||
@ -55,19 +77,25 @@ Future<void> main() async {
|
|||||||
// coverage:ignore-start
|
// coverage:ignore-start
|
||||||
if (frameStatsEnabled) startFrameStats();
|
if (frameStatsEnabled) startFrameStats();
|
||||||
// coverage:ignore-end
|
// coverage:ignore-end
|
||||||
runApp(const DietGuardApp());
|
runApp(DietGuardApp(errors: errors));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Root widget for the Diet Guard companion app.
|
/// Root widget for the Diet Guard companion app.
|
||||||
class DietGuardApp extends StatelessWidget {
|
class DietGuardApp extends StatelessWidget {
|
||||||
/// Creates the [DietGuardApp] root widget.
|
/// Creates the [DietGuardApp] root widget.
|
||||||
const DietGuardApp({super.key});
|
const DietGuardApp({this.errors, super.key});
|
||||||
|
|
||||||
|
/// App-wide error reporting; null in widget tests.
|
||||||
|
final AppErrors? errors;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Diet Guard',
|
title: 'Diet Guard',
|
||||||
theme: buildAppTheme(),
|
theme: buildAppTheme(),
|
||||||
|
navigatorObservers: [
|
||||||
|
if (errors case final errors?) AppErrorsRouteObserver(errors),
|
||||||
|
],
|
||||||
home: const LogMealScreen(),
|
home: const LogMealScreen(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ library;
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:crdt_sync_flutter/crdt_sync_flutter.dart' show WaitWatch;
|
||||||
import 'package:diet_guard_app/models/day_status.dart';
|
import 'package:diet_guard_app/models/day_status.dart';
|
||||||
import 'package:diet_guard_app/models/period_average.dart';
|
import 'package:diet_guard_app/models/period_average.dart';
|
||||||
import 'package:diet_guard_app/screens/history_screen.dart';
|
import 'package:diet_guard_app/screens/history_screen.dart';
|
||||||
@ -153,7 +154,7 @@ class _CalendarScreenState extends State<CalendarScreen> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (_loading) {
|
if (_loading) {
|
||||||
return const Scaffold(body: Center(child: CircularProgressIndicator()));
|
return const Scaffold(body: WaitWatch.centered('calendar.load'));
|
||||||
}
|
}
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(),
|
appBar: AppBar(),
|
||||||
|
|||||||
@ -8,6 +8,7 @@ library;
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:crdt_sync_flutter/crdt_sync_flutter.dart' show WaitWatch;
|
||||||
import 'package:diet_guard_app/models/food_bank_record.dart';
|
import 'package:diet_guard_app/models/food_bank_record.dart';
|
||||||
import 'package:diet_guard_app/services/foodbank_service.dart';
|
import 'package:diet_guard_app/services/foodbank_service.dart';
|
||||||
import 'package:diet_guard_app/widgets/food_bank/fb_add_entry_dialog.dart';
|
import 'package:diet_guard_app/widgets/food_bank/fb_add_entry_dialog.dart';
|
||||||
@ -183,7 +184,7 @@ class _FoodBankScreenState extends State<FoodBankScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: all == null
|
body: all == null
|
||||||
? const Center(child: CircularProgressIndicator())
|
? const WaitWatch.centered('food_bank.load')
|
||||||
: _displayed.isEmpty
|
: _displayed.isEmpty
|
||||||
? Center(
|
? Center(
|
||||||
child: Icon(
|
child: Icon(
|
||||||
|
|||||||
@ -8,6 +8,7 @@ library;
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:crdt_sync_flutter/crdt_sync_flutter.dart' show WaitWatch;
|
||||||
import 'package:diet_guard_app/services/firebase_client.dart';
|
import 'package:diet_guard_app/services/firebase_client.dart';
|
||||||
import 'package:diet_guard_app/services/github_client_factory.dart';
|
import 'package:diet_guard_app/services/github_client_factory.dart';
|
||||||
import 'package:diet_guard_app/services/sync_health.dart';
|
import 'package:diet_guard_app/services/sync_health.dart';
|
||||||
@ -100,7 +101,7 @@ class _GitHubMirrorScreenState extends State<GitHubMirrorScreen>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (_loading) {
|
if (_loading) {
|
||||||
return const Scaffold(body: Center(child: CircularProgressIndicator()));
|
return const Scaffold(body: WaitWatch.centered('github_mirror.load'));
|
||||||
}
|
}
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
// No title and no explanatory paragraph: the code glyph that opened this
|
// No title and no explanatory paragraph: the code glyph that opened this
|
||||||
|
|||||||
@ -7,6 +7,7 @@ library;
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:crdt_sync_flutter/crdt_sync_flutter.dart' show WaitWatch;
|
||||||
import 'package:diet_guard_app/models/food_entry.dart';
|
import 'package:diet_guard_app/models/food_entry.dart';
|
||||||
import 'package:diet_guard_app/screens/edit_entry_screen.dart';
|
import 'package:diet_guard_app/screens/edit_entry_screen.dart';
|
||||||
import 'package:diet_guard_app/services/log_storage_service.dart';
|
import 'package:diet_guard_app/services/log_storage_service.dart';
|
||||||
@ -189,7 +190,7 @@ class _HistoryScreenState extends State<HistoryScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: allEntries == null
|
body: allEntries == null
|
||||||
? const Center(child: CircularProgressIndicator())
|
? const WaitWatch.centered('history.load')
|
||||||
: _displayed.isEmpty
|
: _displayed.isEmpty
|
||||||
? Center(
|
? Center(
|
||||||
child: Icon(
|
child: Icon(
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
/// encrypted either.
|
/// encrypted either.
|
||||||
library;
|
library;
|
||||||
|
|
||||||
|
import 'package:crdt_sync_flutter/crdt_sync_flutter.dart' show WaitWatch;
|
||||||
import 'package:diet_guard_app/services/kuchnia_client.dart';
|
import 'package:diet_guard_app/services/kuchnia_client.dart';
|
||||||
import 'package:diet_guard_app/services/kuchnia_credential_service.dart';
|
import 'package:diet_guard_app/services/kuchnia_credential_service.dart';
|
||||||
import 'package:diet_guard_app/services/kuchnia_import.dart';
|
import 'package:diet_guard_app/services/kuchnia_import.dart';
|
||||||
@ -188,9 +189,12 @@ class _KuchniaSettingsSectionState extends State<KuchniaSettingsSection> {
|
|||||||
IconButton.outlined(
|
IconButton.outlined(
|
||||||
onPressed: canFetch && !_busy ? _fetch : null,
|
onPressed: canFetch && !_busy ? _fetch : null,
|
||||||
icon: _busy
|
icon: _busy
|
||||||
? const SizedBox.square(
|
? const WaitWatch(
|
||||||
dimension: 20,
|
operation: 'kuchnia.sync',
|
||||||
child: CircularProgressIndicator(strokeWidth: 2),
|
child: SizedBox.square(
|
||||||
|
dimension: 20,
|
||||||
|
child: CircularProgressIndicator(strokeWidth: 2),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: const Icon(
|
: const Icon(
|
||||||
Icons.local_shipping_outlined,
|
Icons.local_shipping_outlined,
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
/// send or log.
|
/// send or log.
|
||||||
library;
|
library;
|
||||||
|
|
||||||
|
import 'package:crdt_sync_flutter/crdt_sync_flutter.dart' show WaitWatch;
|
||||||
import 'package:diet_guard_app/ui/theme.dart';
|
import 'package:diet_guard_app/ui/theme.dart';
|
||||||
import 'package:material_ui/material_ui.dart';
|
import 'package:material_ui/material_ui.dart';
|
||||||
|
|
||||||
@ -127,10 +128,13 @@ class MealActionRow extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Widget _claudeFace() => switch (claude) {
|
Widget _claudeFace() => switch (claude) {
|
||||||
ClaudeButtonState.sending => const SizedBox(
|
ClaudeButtonState.sending => const WaitWatch(
|
||||||
width: 24,
|
operation: 'claude.estimate',
|
||||||
height: 24,
|
child: SizedBox(
|
||||||
child: CircularProgressIndicator(strokeWidth: 3),
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
child: CircularProgressIndicator(strokeWidth: 3),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
ClaudeButtonState.queued => const Icon(
|
ClaudeButtonState.queued => const Icon(
|
||||||
Icons.hourglass_top,
|
Icons.hourglass_top,
|
||||||
|
|||||||
@ -166,11 +166,11 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: crdt_sync_flutter
|
path: crdt_sync_flutter
|
||||||
ref: "crdt_sync_flutter-v0.8.3"
|
ref: "crdt_sync_flutter-v0.9.0"
|
||||||
resolved-ref: "6e3f86ef0d73ba45db975bf03915fecce8a60f98"
|
resolved-ref: dfc5d07f5225ed15609f9709748ed2efd6cc4d1d
|
||||||
url: "https://github.com/kuhyx/utils"
|
url: "https://github.com/kuhyx/utils"
|
||||||
source: git
|
source: git
|
||||||
version: "0.8.3"
|
version: "0.9.0"
|
||||||
cross_file:
|
cross_file:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -18,7 +18,7 @@ dependencies:
|
|||||||
crdt_sync_flutter:
|
crdt_sync_flutter:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/kuhyx/utils
|
url: https://github.com/kuhyx/utils
|
||||||
ref: crdt_sync_flutter-v0.8.3
|
ref: crdt_sync_flutter-v0.9.0
|
||||||
path: crdt_sync_flutter
|
path: crdt_sync_flutter
|
||||||
crypto: 3.0.8
|
crypto: 3.0.8
|
||||||
cryptography: 2.9.0
|
cryptography: 2.9.0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user