From 70c0492d7afda9b11c4c6a6550b31361491a2218 Mon Sep 17 00:00:00 2001 From: Fiery Imp Date: Thu, 24 Apr 2025 12:29:13 -0400 Subject: [PATCH] Claude: Progress report for extraction fixed --- rust/src/app.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/rust/src/app.rs b/rust/src/app.rs index 20d1418..66a1bd9 100644 --- a/rust/src/app.rs +++ b/rust/src/app.rs @@ -112,6 +112,14 @@ impl<> eframe::App for SinfarInstallerApp<> { self.download_error = Some(error.clone()); } } + } else if self.state == InstallerState::Installing { + // Sync extraction progress from shared state + if let Ok(state) = self.download_state.lock() { + self.extraction_progress = state.progress; + if let Some(error) = &state.error { + self.install_error = Some(error.clone()); + } + } } egui::CentralPanel::default().show(ctx, |ui| { @@ -280,12 +288,20 @@ impl SinfarInstallerApp<> { let runtime = self.runtime.clone(); let game_type = self.game_type.clone().expect("Game type should be set"); + // Reset the download state for installation progress + if let Ok(mut state) = self.download_state.lock() { + state.progress = 0.0; + state.completed = false; + state.error = None; + state.cancelled = false; + } + // Create extraction manager with progress callback let extractor = crate::installer::extractor::ExtractionManager::new(move |progress: f32, _filename: &str| { if let Ok(mut app_state) = progress_state.lock() { app_state.progress = progress; + eframe_ctx.request_repaint(); } - eframe_ctx.request_repaint(); }); // Get downloaded files before spawning the async task @@ -296,6 +312,7 @@ impl SinfarInstallerApp<> { }; if let Some(files) = downloaded_files { + let download_state = download_state.clone(); // Clone again for the async block runtime.spawn(async move { // Try to install the files if let Err(e) = extractor.install_all_files(