mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-14 00:31:33 +10:00
feat(downloads): Added function to take and set any game state
Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
@ -116,33 +116,14 @@ pub async fn get_game_download_progress(
|
||||
Ok(progress)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn pause_game_download(
|
||||
state: tauri::State<'_, Mutex<AppState>>,
|
||||
game_id: String,
|
||||
) -> Result<(), String> {
|
||||
get_game_download(state, game_id).change_state(GameDownloadState::Paused);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn resume_game_download(
|
||||
state: tauri::State<'_, Mutex<AppState>>,
|
||||
game_id: String,
|
||||
) -> Result<(), String> {
|
||||
get_game_download(state, game_id).change_state(GameDownloadState::Downloading);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
#[tauri::command]
|
||||
pub async fn set_download_state(
|
||||
state: tauri::State<'_, Mutex<AppState>>,
|
||||
game_id: String,
|
||||
status: GameDownloadState
|
||||
) -> Result<(), String> {
|
||||
info!("Setting game state");
|
||||
get_game_download(state, game_id).change_state(status);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user