Functioning download progress updates

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2024-11-04 17:11:37 +11:00
parent bd39f1fd72
commit 0528c78092
9 changed files with 89 additions and 27 deletions

View File

@ -106,3 +106,15 @@ pub async fn stop_specific_game_download(
Ok(())
}
#[tauri::command]
pub async fn get_game_download_progress(
state: tauri::State<'_, Mutex<AppState>>,
game_id: String
) -> Result<f64, String> {
let lock = state.lock().unwrap();
let download_agent = lock.game_downloads.get(&game_id).unwrap();
let progress = download_agent.progress.get_progress_percentage();
info!("{}", progress);
return Ok(progress)
}