Claude: Progress report for extraction fixed

This commit is contained in:
Fiery Imp 2025-04-24 12:29:13 -04:00
parent 98def5fa73
commit 70c0492d7a

View File

@ -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();
}
});
// 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(