From beb78fada0e5b8e09a03a131e267d9e0a5a54a6a Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:06:22 +0100 Subject: [PATCH] fix: eager artwork dir init, guard back nav on root --- lib/focus/key_event_utils.dart | 4 ++++ lib/services/download_storage_service.dart | 3 +++ 2 files changed, 7 insertions(+) diff --git a/lib/focus/key_event_utils.dart b/lib/focus/key_event_utils.dart index e156388c..156e70ac 100644 --- a/lib/focus/key_event_utils.dart +++ b/lib/focus/key_event_utils.dart @@ -78,6 +78,10 @@ KeyEventResult handleBackKeyAction(KeyEvent event, VoidCallback onBack) { } KeyEventResult handleBackKeyNavigation(BuildContext context, KeyEvent event, {T? result}) { + // Let system handle back if there's nothing to pop (e.g. root screen) + if (!Navigator.canPop(context)) { + return KeyEventResult.ignored; + } // Handle on KeyUpEvent to prevent double-pop when returning from child screens // (KeyDownEvent can be received by both the popping screen and the returned-to screen) return handleBackKeyAction(event, () => Navigator.pop(context, result)); diff --git a/lib/services/download_storage_service.dart b/lib/services/download_storage_service.dart index 7676929d..0ec7d838 100644 --- a/lib/services/download_storage_service.dart +++ b/lib/services/download_storage_service.dart @@ -40,6 +40,9 @@ class DownloadStorageService { // Reset cached directories to force recalculation _baseDownloadsDir = null; _artworkDirectoryPath = null; + + // Eagerly initialize artwork directory for sync access + await getArtworkDirectory(); } /// Refresh custom path from settings (call when settings change)