feat(downloads): Generic function to set download state

Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2024-11-09 20:15:04 +11:00
parent 8204795ba6
commit f10d92d623
4 changed files with 30 additions and 3 deletions

View File

@ -135,6 +135,16 @@ pub async fn resume_game_download(
Ok(())
}
#[tauri::command]
pub async fn set_download_state(
state: tauri::State<'_, Mutex<AppState>>,
game_id: String,
status: GameDownloadState
) -> Result<(), String> {
get_game_download(state, game_id).change_state(status);
Ok(())
}
fn get_game_download(
state: tauri::State<'_, Mutex<AppState>>,

View File

@ -12,7 +12,6 @@ use std::{
path::PathBuf,
sync::{Arc, RwLock},
thread::sleep,
time::Duration,
};
use urlencoding::encode;