From dc181d0d85e21057f9392f1b7c6ee27317aec899 Mon Sep 17 00:00:00 2001 From: Thomas SharedInbox Date: Sat, 23 May 2026 16:05:05 +0200 Subject: [PATCH] fix: add git hash to crash screen and extend DB path retries (#179) Two issues from #179: - crash_screen.dart now reads GIT_HASH compile-time constant and includes 'Git Commit: ' in both the on-screen UI and the copied report, so crash reports always show the exact build that crashed. - _resolveDatabasePath() retry delays extended from [100, 300, 600] ms (total ~1 s, 4 attempts) to [200, 500, 1000, 2000, 4000] ms (total ~7.7 s, 6 attempts) to handle slow/non-standard Android devices where the path_provider Pigeon channel takes several seconds to become ready. Co-Authored-By: Claude Sonnet 4.6 --- lib/data/db/database.dart | 2 +- lib/ui/screens/crash_screen.dart | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/data/db/database.dart b/lib/data/db/database.dart index c277111..f35c74c 100644 --- a/lib/data/db/database.dart +++ b/lib/data/db/database.dart @@ -599,7 +599,7 @@ Future _resolveDatabasePath() async { // that the engine is fully initialised, with back-off. Some slow Android // devices need several seconds for the Pigeon channel to become ready // (issue #166), so use a longer schedule than the initial attempt. - const delays = [200, 500, 1000, 2000]; + const delays = [200, 500, 1000, 2000, 4000]; for (final ms in delays) { try { final dir = await getApplicationSupportDirectory(); diff --git a/lib/ui/screens/crash_screen.dart b/lib/ui/screens/crash_screen.dart index cce9a0c..31cc559 100644 --- a/lib/ui/screens/crash_screen.dart +++ b/lib/ui/screens/crash_screen.dart @@ -23,6 +23,7 @@ class CrashScreen extends StatelessWidget { final info = await PackageInfo.fromPlatform(); version = '${info.version}+${info.buildNumber}'; } catch (_) {} + final gitLine = _gitHash.isNotEmpty ? 'Git Commit: $_gitHash\n' : ''; final platform = '${Platform.operatingSystem} ${Platform.operatingSystemVersion}'; final gitLine = _gitHash.isNotEmpty @@ -56,6 +57,14 @@ class CrashScreen extends StatelessWidget { style: Theme.of(ctx).textTheme.titleMedium, textAlign: TextAlign.center, ), + if (_gitHash.isNotEmpty) ...[ + const SizedBox(height: 8), + const Text( + 'Git Commit: $_gitHash', + style: TextStyle(fontSize: 12, color: Colors.grey), + textAlign: TextAlign.center, + ), + ], const SizedBox(height: 24), const Text( 'Error Details:',