I think that download queuing is working

This commit is contained in:
quexeky
2024-10-28 19:23:41 +11:00
parent c9d9d2e94f
commit 1ab61c86b1
6 changed files with 117 additions and 56 deletions

View File

@ -10,6 +10,7 @@ mod tests;
use auth::{auth_initiate, generate_authorization_header, recieve_handshake};
use db::{DatabaseInterface, DATA_ROOT_DIR};
use downloads::download_commands::{queue_game_download, start_game_downloads};
use env_logger::Env;
use http::{header::*, response::Builder as ResponseBuilder};
use library::{fetch_game, fetch_library, Game};
@ -22,7 +23,7 @@ use std::{
use std::sync::Arc;
use tauri_plugin_deep_link::DeepLinkExt;
use crate::db::DatabaseImpls;
use crate::downloads::download_agent::{start_game_download, GameDownloadAgent};
use crate::downloads::download_agent::{GameDownloadAgent};
#[derive(Clone, Copy, Serialize)]
pub enum AppStatus {
@ -49,7 +50,7 @@ pub struct AppState {
games: HashMap<String, Game>,
#[serde(skip_serializing)]
game_downloads: Vec<Arc<GameDownloadAgent>>
game_downloads: HashMap<String, Arc<GameDownloadAgent>>
}
#[tauri::command]
@ -69,7 +70,7 @@ fn setup() -> AppState {
status: AppStatus::NotConfigured,
user: None,
games: HashMap::new(),
game_downloads: vec![],
game_downloads: HashMap::new(),
};
}
@ -78,7 +79,7 @@ fn setup() -> AppState {
status: auth_result.0,
user: auth_result.1,
games: HashMap::new(),
game_downloads: vec![],
game_downloads: HashMap::new(),
}
}
@ -113,7 +114,8 @@ pub fn run() {
fetch_library,
fetch_game,
// Downloads
start_game_download
queue_game_download,
start_game_downloads
])
.plugin(tauri_plugin_shell::init())
.setup(|app| {